@shijiu/jsview-vue-samples 1.9.747

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/AnimPicture/App.vue +207 -0
  2. package/AnimPicture/assets/animated_webp.webp +0 -0
  3. package/AnimPicture/assets/ball_3.webp +0 -0
  4. package/AnimPicture/assets/girl_run.gif +0 -0
  5. package/AnimPicture/assets/quan.webp +0 -0
  6. package/Basic/App.vue +134 -0
  7. package/Basic/assets/border.png +0 -0
  8. package/Basic/assets/border2.png +0 -0
  9. package/Basic/assets/icon.png +0 -0
  10. package/Basic/assets/test.jpg +0 -0
  11. package/Basic/components/ContentBlock.vue +38 -0
  12. package/Basic/components/FontStyle.css +16 -0
  13. package/Basic/components/anim/AnimGroup.vue +66 -0
  14. package/Basic/components/anim/AnimKeyframeBasic.vue +119 -0
  15. package/Basic/components/anim/AnimKeyframeComposite.vue +52 -0
  16. package/Basic/components/anim/AnimTransition.vue +157 -0
  17. package/Basic/components/div/DivBackground.vue +44 -0
  18. package/Basic/components/div/DivClip.vue +159 -0
  19. package/Basic/components/div/DivCssScoped.vue +20 -0
  20. package/Basic/components/div/DivCssVar.vue +53 -0
  21. package/Basic/components/div/DivGroup1.vue +47 -0
  22. package/Basic/components/div/DivGroup2.vue +65 -0
  23. package/Basic/components/div/DivLayout.vue +70 -0
  24. package/Basic/components/div/DivRadius.vue +65 -0
  25. package/Basic/components/div/DivTransform.vue +32 -0
  26. package/Basic/components/img/ImageGroup.vue +31 -0
  27. package/Basic/components/img/ImgLayout.vue +41 -0
  28. package/Basic/components/panel/Panel1.vue +55 -0
  29. package/Basic/components/panel/Panel2.vue +31 -0
  30. package/Basic/components/panel/TitleBar.vue +29 -0
  31. package/Basic/components/text/TextAlign.vue +66 -0
  32. package/Basic/components/text/TextEmoji.vue +26 -0
  33. package/Basic/components/text/TextFontStyle.vue +89 -0
  34. package/Basic/components/text/TextGroup1.vue +49 -0
  35. package/Basic/components/text/TextGroup2.vue +28 -0
  36. package/Basic/components/text/TextOverflow.vue +110 -0
  37. package/BasicFocusControl/App.vue +104 -0
  38. package/BasicFocusControl/components/BaseBlock.vue +50 -0
  39. package/BasicFocusControl/components/MainArea.vue +83 -0
  40. package/BasicFocusControl/components/MainAreaLeftBlock.vue +17 -0
  41. package/BasicFocusControl/components/MainAreaRightBlock.vue +27 -0
  42. package/BasicFocusControl/components/SideBar.vue +58 -0
  43. package/BasicFocusControl/components/SideBarBlock.vue +27 -0
  44. package/Collision/App.vue +452 -0
  45. package/ColorSpace/App.vue +126 -0
  46. package/ColorSpace/bmpDemo.bmp +0 -0
  47. package/ColorSpace/jpegDemo.jpeg +0 -0
  48. package/ColorSpace/pngDemo.png +0 -0
  49. package/ColorSpace/pngNoAlphaDemo.png +0 -0
  50. package/DemoHomepage/App.vue +27 -0
  51. package/DemoHomepage/components/BodyFrame.vue +95 -0
  52. package/DemoHomepage/components/Dialog.vue +94 -0
  53. package/DemoHomepage/components/Item.vue +77 -0
  54. package/DemoHomepage/components/TabFrame.vue +85 -0
  55. package/DemoHomepage/router.js +196 -0
  56. package/DemoHomepage/views/Homepage.vue +195 -0
  57. package/FilterDemo/AnimatePic.vue +58 -0
  58. package/FilterDemo/App.vue +159 -0
  59. package/FilterDemo/VideoLayer.vue +62 -0
  60. package/FilterDemo/jpegDemo.jpeg +0 -0
  61. package/FilterDemo/webpDemo.webp +0 -0
  62. package/FlipCard/App.vue +71 -0
  63. package/FlipCard/FlipCard.vue +118 -0
  64. package/FlipCard/assets/blue_egg.png +0 -0
  65. package/FlipCard/assets/red_egg.png +0 -0
  66. package/FlipCard/data.js +13 -0
  67. package/GridDemo/App.vue +215 -0
  68. package/GridDemo/ButtonBlock.vue +112 -0
  69. package/GridDemo/FocusItem.vue +37 -0
  70. package/GridDemo/Item.vue +93 -0
  71. package/HashHistory/App.vue +115 -0
  72. package/HashHistory/components/HorizontalButtonList.vue +91 -0
  73. package/HashHistory/components/Item.vue +60 -0
  74. package/HashHistory/router.js +41 -0
  75. package/HashHistory/views/MainPage.vue +57 -0
  76. package/HashHistory/views/SubPage.vue +66 -0
  77. package/ImpactStop/App.vue +435 -0
  78. package/Input/App.vue +164 -0
  79. package/Input/FullKeyboard.vue +87 -0
  80. package/Input/InputPanel.vue +131 -0
  81. package/Input/KeyboardItem.vue +58 -0
  82. package/LongImage/App.vue +80 -0
  83. package/LongImage/Button.vue +58 -0
  84. package/LongImage/ButtonItem.vue +44 -0
  85. package/LongImage/LongImageScroll.vue +92 -0
  86. package/LongImage/Scroll.vue +14 -0
  87. package/LongImage/assets/1280x7200.jpg +0 -0
  88. package/LongText/App.vue +96 -0
  89. package/LongText/Button.vue +51 -0
  90. package/LongText/ButtonItem.vue +44 -0
  91. package/LongText/LongTextScroll.vue +192 -0
  92. package/LongText/Scroll.vue +14 -0
  93. package/Marquee/App.vue +247 -0
  94. package/Marquee/longText.js +14 -0
  95. package/MaskClip/App.vue +122 -0
  96. package/MaskClip/images/mask-025/config.json +29 -0
  97. package/MaskClip/images/mask-025/res/1.png +0 -0
  98. package/MaskClip/images/mask-025/res/2.png +0 -0
  99. package/MaskClip/images/mask-025/res/3.png +0 -0
  100. package/MaskClip/images/mask-025/res/4.png +0 -0
  101. package/MaskClip/images/mask-025/res/icon.png +0 -0
  102. package/MaskClip/images/mask-025/res/stroke.png +0 -0
  103. package/MaskClip/images/php.jpg +0 -0
  104. package/MetroWidgetDemos/Advanced/App.vue +46 -0
  105. package/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
  106. package/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
  107. package/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
  108. package/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
  109. package/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
  110. package/MetroWidgetDemos/Advanced/widgets/Widgets.vue +116 -0
  111. package/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  112. package/MetroWidgetDemos/Item.vue +85 -0
  113. package/MetroWidgetDemos/PerformanceTest/App.vue +210 -0
  114. package/MetroWidgetDemos/PerformanceTest/Item.vue +90 -0
  115. package/MetroWidgetDemos/PerformanceTest/assets/bg.jpg +0 -0
  116. package/MetroWidgetDemos/PerformanceTest/assets/coupon_content.png +0 -0
  117. package/MetroWidgetDemos/PerformanceTest/assets/coupon_left.png +0 -0
  118. package/MetroWidgetDemos/PerformanceTest/assets/coupon_mid.png +0 -0
  119. package/MetroWidgetDemos/PerformanceTest/assets/coupon_right.png +0 -0
  120. package/MetroWidgetDemos/PerformanceTest/assets/focus_border.png +0 -0
  121. package/MetroWidgetDemos/PerformanceTest/assets/holder_logo.png +0 -0
  122. package/MetroWidgetDemos/PerformanceTest/assets/jrbm.png +0 -0
  123. package/MetroWidgetDemos/PerformanceTest/assets/line_left.png +0 -0
  124. package/MetroWidgetDemos/PerformanceTest/assets/line_mid.png +0 -0
  125. package/MetroWidgetDemos/PerformanceTest/assets/line_right.png +0 -0
  126. package/MetroWidgetDemos/PerformanceTest/assets/loading.png +0 -0
  127. package/MetroWidgetDemos/PerformanceTest/assets/logo.png +0 -0
  128. package/MetroWidgetDemos/PerformanceTest/assets/mcjx.png +0 -0
  129. package/MetroWidgetDemos/PerformanceTest/assets/tao.png +0 -0
  130. package/MetroWidgetDemos/PerformanceTest/assets/tmall.png +0 -0
  131. package/MetroWidgetDemos/PerformanceTest/border.png +0 -0
  132. package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +386 -0
  133. package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +129 -0
  134. package/MetroWidgetDemos/PerformanceTest/data.js +45 -0
  135. package/MetroWidgetDemos/PingPong/App.vue +135 -0
  136. package/MetroWidgetDemos/PingPong/AppPage.vue +73 -0
  137. package/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
  138. package/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
  139. package/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
  140. package/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
  141. package/MetroWidgetDemos/Simple/App.vue +45 -0
  142. package/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -0
  143. package/MetroWidgetDemos/WidgetItem.vue +89 -0
  144. package/MetroWidgetDemos/data.js +205 -0
  145. package/NinePatchDemo/App.vue +145 -0
  146. package/NinePatchDemo/Item.vue +69 -0
  147. package/NinePatchDemo/assets/border.png +0 -0
  148. package/Preload/App.vue +135 -0
  149. package/Preload/Item.vue +32 -0
  150. package/Preload/data.js +23 -0
  151. package/Preload/images/awesomeface.png +0 -0
  152. package/Preload/images/cat.jpg +0 -0
  153. package/Preload/images/rank.png +0 -0
  154. package/Preload/images/rank_focus.png +0 -0
  155. package/Preload/images/rule.png +0 -0
  156. package/Preload/images/rule_focus.png +0 -0
  157. package/Preload/images/start.png +0 -0
  158. package/Preload/images/start_focus.png +0 -0
  159. package/QrcodeDemo/App.vue +68 -0
  160. package/ScaleDownNeon/App.vue +107 -0
  161. package/SoundPool/App.vue +134 -0
  162. package/SoundPool/bgmusic.mp3 +0 -0
  163. package/SoundPool/coin.mp3 +0 -0
  164. package/SoundPool/jump.mp3 +0 -0
  165. package/SoundPool/lose.mp3 +0 -0
  166. package/SoundPool/run.mp3 +0 -0
  167. package/SprayView/App.vue +272 -0
  168. package/SprayView/assets/snow.png +0 -0
  169. package/SpriteImage/App.vue +173 -0
  170. package/SpriteImage/images/cat_run.png +0 -0
  171. package/SpriteImage/images/egg_break.json +116 -0
  172. package/SpriteImage/images/egg_break.png +0 -0
  173. package/SpriteImage/images/sprite.png +0 -0
  174. package/TextBox/App.vue +91 -0
  175. package/TextBox/RenderCenter.vue +133 -0
  176. package/TextBox/RenderLeft.vue +138 -0
  177. package/TextBox/RenderOneLine.vue +101 -0
  178. package/TextBox/RenderRight.vue +131 -0
  179. package/TextShadowDemo/App.vue +91 -0
  180. package/TextureAnimation/App.vue +336 -0
  181. package/TextureAnimation/App2.vue +111 -0
  182. package/TextureAnimation/assets/blackWhiteGrid.png +0 -0
  183. package/TextureAnimation/assets/light.png +0 -0
  184. package/TextureAnimation/assets/light2.png +0 -0
  185. package/TextureAnimation/assets/mask.png +0 -0
  186. package/TextureAnimation/assets/php.jpg +0 -0
  187. package/TextureAnimation/assets/php2.png +0 -0
  188. package/TextureAnimation/assets/swipLight.png +0 -0
  189. package/TextureSize/App.vue +132 -0
  190. package/TextureSize/bmpDemo.bmp +0 -0
  191. package/TextureSize/jpegDemo.jpeg +0 -0
  192. package/TextureSize/jpgDemo.jpg +0 -0
  193. package/TextureSize/pngDemo.png +0 -0
  194. package/TextureSize/pngNoAlphaDemo.png +0 -0
  195. package/ThrowMoveDemo/AccelerateDemo.vue +116 -0
  196. package/ThrowMoveDemo/App.vue +114 -0
  197. package/ThrowMoveDemo/LRParabolicDemo.vue +115 -0
  198. package/ThrowMoveDemo/TargetDemo.vue +116 -0
  199. package/ThrowMoveDemo/UDParabolicDemo.vue +121 -0
  200. package/TouchSample/App.vue +136 -0
  201. package/TouchSample/Item.vue +103 -0
  202. package/TouchSample/MetroWidgetHorizontal.vue +144 -0
  203. package/TouchSample/MetroWidgetVertical.vue +144 -0
  204. package/TouchSample/TouchContainerHorizontal.vue +160 -0
  205. package/TouchSample/TouchContainerVertical.vue +160 -0
  206. package/TouchSample/data.js +81 -0
  207. package/TransitPage/App.vue +29 -0
  208. package/VideoDemo/App.vue +121 -0
  209. package/VideoDemo/components/Button.vue +58 -0
  210. package/VideoDemo/components/Controllor.vue +197 -0
  211. package/VideoDemo/components/VideoFrame.vue +140 -0
  212. package/VisibleSensorDemo/App.vue +234 -0
  213. package/package.json +17 -0
@@ -0,0 +1,111 @@
1
+ <script setup>
2
+ import { ref, shallowRef, reactive } from "vue";
3
+ import { useRouter } from "vue-router";
4
+ import {
5
+ jJsvRuntimeBridge,
6
+ getKeyFramesGroup,
7
+ JsvTextureAnim,
8
+ TexAlignAnchor,
9
+ DECORATE_NINEPATCH_ALPHA_MIX,
10
+ DECORATE_BORDER_RADIUS,
11
+ } from "jsview";
12
+ import img from "./assets/light.png";
13
+ import img2 from "./assets/light2.png";
14
+ import mask from "./assets/mask.png";
15
+
16
+ const getRandom = (start, end) => {
17
+ return Math.round(Math.random() * (end - start) + start);
18
+ };
19
+
20
+ const router = useRouter();
21
+ const width = ref(300);
22
+ const height = ref(200);
23
+ const left = ref(50);
24
+ const top = ref(80);
25
+ const rotateAnimation =
26
+ "{from {transform: rotate3d(0,0,1,0);} to {transform: rotate3d(0,0,1,360deg);}}";
27
+
28
+ const ninePatchDecorator = {
29
+ type: DECORATE_NINEPATCH_ALPHA_MIX,
30
+ url: `url(${mask})`,
31
+ imageWidth: 86,
32
+ centerWidth: 2,
33
+ borderOutset: 0,
34
+ animTime: 0.5,
35
+ };
36
+ //注意texture的尺寸需要兼顾最大的view
37
+ const texCoord = {
38
+ width: 600,
39
+ height: 600,
40
+ };
41
+ const onKeyDown = (ev) => {
42
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
43
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
44
+ router?.go(-1); // 有router时,是从DemoHomepage进入,回退
45
+ } else if (ev.keyCode == 13) {
46
+ left.value = getRandom(50, 400);
47
+ top.value = getRandom(80, 200);
48
+ width.value = getRandom(100, 300);
49
+ height.value = getRandom(100, 300);
50
+ }
51
+ return true;
52
+ };
53
+ </script>
54
+ <template>
55
+ <jsv-focus-block
56
+ autoFocus
57
+ :onKeyDown="onKeyDown"
58
+ :style="{
59
+ width: 1280,
60
+ height: 720,
61
+ backgroundImage:
62
+ 'https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/BackgroundLongmao.jpg',
63
+ }"
64
+ >
65
+ <div
66
+ :style="{
67
+ textAlign: 'center',
68
+ fontSize: '30px',
69
+ lineHeight: '50px',
70
+ color: '#ffffff',
71
+ left: 140,
72
+ top: 20,
73
+ width: 1000,
74
+ height: 50,
75
+ backgroundColor: 'rgba(27,38,151,0.8)',
76
+ }"
77
+ >
78
+ .9型的旋转焦点框,OK键进行随机位置+尺寸变换
79
+ </div>
80
+ <div>
81
+ <jsv-texture-anim
82
+ :src="img"
83
+ :left="left"
84
+ :top="top"
85
+ :width="width"
86
+ :height="height"
87
+ :texCoord="texCoord"
88
+ :animation="rotateAnimation"
89
+ :duration="2000"
90
+ :repeat="-1"
91
+ :autoStart="true"
92
+ :decorate="ninePatchDecorator"
93
+ ></jsv-texture-anim>
94
+ </div>
95
+ <div>
96
+ <jsv-texture-anim
97
+ :src="img2"
98
+ :left="left + 500"
99
+ :top="top"
100
+ :width="width"
101
+ :height="height"
102
+ :texCoord="texCoord"
103
+ :animation="rotateAnimation"
104
+ :duration="2000"
105
+ :repeat="-1"
106
+ :autoStart="true"
107
+ :decorate="ninePatchDecorator"
108
+ ></jsv-texture-anim>
109
+ </div>
110
+ </jsv-focus-block>
111
+ </template>
Binary file
Binary file
Binary file
@@ -0,0 +1,132 @@
1
+ <script setup>
2
+ import jpegDemo from "./jpegDemo.jpeg";
3
+ import pngDemo from "./pngDemo.png";
4
+ import pngNoAlphaDemo from "./pngNoAlphaDemo.png";
5
+ import bmpDemo from "./bmpDemo.bmp";
6
+ import { useRouter } from "vue-router";
7
+
8
+ const router = useRouter();
9
+
10
+ const onKeyDown = (ev) => {
11
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
12
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
13
+ if (window.JsView) {
14
+ window.JsView.setGlobalConfig({
15
+ texCache: -1,
16
+ });
17
+ }
18
+
19
+ router.go(-1); // 有router时,回退
20
+ return true;
21
+ }
22
+ return false;
23
+ };
24
+ </script>
25
+ <template>
26
+ <jsv-focus-block autoFocus :onKeyDown="onKeyDown">
27
+ <div class="allBgc">
28
+ <div class="block">
29
+ <div :style="{ left: 0, top: 0 }">
30
+ <div class="leftFont top0">
31
+ {{ `原图加载\n内存占用由图片尺寸决定` }}
32
+ </div>
33
+ <div class="leftFont top250">
34
+ {{
35
+ `指定尺寸加载\n内存占用由给定尺寸决定,图片质量基本没变,但更省内存`
36
+ }}
37
+ </div>
38
+ </div>
39
+
40
+ <div :style="{ left: 220, top: 0 }">
41
+ <img alt="" class="graphSize top0" :src="bmpDemo" />
42
+ <img
43
+ alt=""
44
+ class="graphSize top250"
45
+ jsvImgScaledownTex
46
+ :src="bmpDemo"
47
+ />
48
+ <div class="underFont">
49
+ {{ `bmp图片\n指定尺寸噪点明显更大` }}
50
+ </div>
51
+ </div>
52
+
53
+ <div :style="{ left: 440, top: 0 }">
54
+ <img alt="" class="graphSize top0" :src="jpegDemo" />
55
+ <img
56
+ alt=""
57
+ class="graphSize top250"
58
+ jsvImgScaledownTex
59
+ :src="jpegDemo"
60
+ />
61
+ <div class="underFont">
62
+ {{ "jpg/jpeg图片" }}
63
+ </div>
64
+ </div>
65
+
66
+ <div :style="{ left: 660, top: 0 }">
67
+ <img alt="" class="graphSize top0" :src="pngDemo" />
68
+ <img
69
+ alt=""
70
+ :src="pngDemo"
71
+ class="graphSize top250"
72
+ jsvImgScaledownTex
73
+ />
74
+ <div class="underFont">
75
+ {{ `png有透明图片\n指定尺寸有明显锯齿` }}
76
+ </div>
77
+ </div>
78
+
79
+ <div :style="{ left: 880, top: 0 }">
80
+ <img alt="" class="graphSize top0" :src="pngNoAlphaDemo" />
81
+ <img
82
+ alt=""
83
+ :src="pngNoAlphaDemo"
84
+ class="graphSize top250"
85
+ jsvImgScaledownTex
86
+ />
87
+ <div class="underFont">
88
+ {{ `png无透明图片` }}
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+ </jsv-focus-block>
94
+ </template>
95
+ <style scoped>
96
+ .allBgc {
97
+ width: 1920;
98
+ height: 1080;
99
+ background-color: #334c4c;
100
+ }
101
+ .block {
102
+ left: 20;
103
+ top: 50;
104
+ }
105
+ .leftFont {
106
+ left: 0;
107
+ width: 210;
108
+ height: 200;
109
+ color: #ffffff;
110
+ font-size: 30px;
111
+ }
112
+ .top0 {
113
+ top: 0;
114
+ }
115
+ .top250 {
116
+ top: 250;
117
+ }
118
+ .graphSize {
119
+ left: 0;
120
+ width: 200;
121
+ height: 200;
122
+ border-radius: 15px 15px 15px 15px;
123
+ }
124
+ .underFont {
125
+ left: 0;
126
+ top: 500;
127
+ width: 200;
128
+ height: 200;
129
+ color: #ffffff;
130
+ font-size: 20px;
131
+ }
132
+ </style>
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,116 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2021-10-20 18:27:25
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-07-08 14:11:05
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import { JsvActorMoveControl, JsvActorMove } from "jsview";
10
+ export default {
11
+ components: {
12
+ JsvActorMove,
13
+ },
14
+ props: {
15
+ name: String,
16
+ },
17
+ data() {
18
+ return {
19
+ direction: 1,
20
+ };
21
+ },
22
+ computed: {
23
+ directionDetail() {
24
+ return this.direction > 0 ? "上" : "下";
25
+ },
26
+ },
27
+ setup() {
28
+ let throwControl = new JsvActorMoveControl(); // 抛物运动体控制器
29
+ let moveControl = new JsvActorMoveControl(); // 平移运动体控制器
30
+
31
+ return {
32
+ throwControl,
33
+ moveControl,
34
+ };
35
+ },
36
+ methods: {
37
+ onKeyDown(ev) {
38
+ if (ev.keyCode === 13) {
39
+ let preDirection = this.direction;
40
+ this.direction = -this.direction;
41
+ this.throwControl.throwAlongY(
42
+ 0,
43
+ 750 * preDirection,
44
+ {
45
+ type: "catch",
46
+ position: 200 * preDirection,
47
+ direction: preDirection,
48
+ },
49
+ (x, y) => {
50
+ console.log(`Throw end with x=${x} y=${y}`);
51
+ }
52
+ );
53
+ return true;
54
+ }
55
+ return false;
56
+ },
57
+ },
58
+ };
59
+ </script>
60
+
61
+ <template>
62
+ <jsv-focus-block
63
+ ref="focusNode"
64
+ :name="name"
65
+ autoFocus
66
+ :onAction="{
67
+ onKeyDown: onKeyDown,
68
+ }"
69
+ >
70
+ <div
71
+ key="sample1"
72
+ class="detail-font"
73
+ :style="{ top: 150, left: 425, width: 430, height: 40 }"
74
+ >
75
+ {{ `向${directionDetail}加速` }}
76
+ </div>
77
+ <div
78
+ key="DirectText"
79
+ class="font"
80
+ :style="{ top: 250, left: 425, width: 430, height: 40 }"
81
+ >
82
+ {{ `当前方向:${directionDetail}` }}
83
+ </div>
84
+ <div :style="{ top: 590, left: 625 }">
85
+ <jsv-actor-move key="move" :control="moveControl">
86
+ <jsv-actor-move key="throw" :control="throwControl">
87
+ <div
88
+ :style="{ backgroundColor: '#FF0000', width: 30, height: 30 }"
89
+ ></div>
90
+ </jsv-actor-move>
91
+ </jsv-actor-move>
92
+ </div>
93
+ </jsv-focus-block>
94
+ </template>
95
+
96
+ <style scoped>
97
+ .font {
98
+ font-size: 32px;
99
+ color: #73665c;
100
+ line-height: 40px;
101
+ overflow: hidden;
102
+ white-space: nowrap;
103
+ text-overflow: ellipsis;
104
+ text-align: center;
105
+ }
106
+
107
+ .detail-font {
108
+ font-size: 32px;
109
+ color: #f7f7eb;
110
+ line-height: 30px;
111
+ overflow: hidden;
112
+ white-space: nowrap;
113
+ text-overflow: ellipsis;
114
+ text-align: center;
115
+ }
116
+ </style>
@@ -0,0 +1,114 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2021-10-20 18:27:08
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2021-10-25 09:38:21
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import LRParabolicDemo from "./LRParabolicDemo.vue";
10
+ import UDParabolicDemo from "./UDParabolicDemo.vue";
11
+ import TargetDemo from "./TargetDemo.vue";
12
+ import AccelerateDemo from "./AccelerateDemo.vue";
13
+
14
+ export default {
15
+ components: {
16
+ LRParabolicDemo,
17
+ UDParabolicDemo,
18
+ TargetDemo,
19
+ AccelerateDemo,
20
+ },
21
+ data() {
22
+ return {
23
+ demoIndex: 0,
24
+ };
25
+ },
26
+ methods: {
27
+ onKeyDown(ev) {
28
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
29
+ this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
30
+ return true;
31
+ }
32
+ if (ev.keyCode === 37) {
33
+ this.demoIndex = this.demoIndex - 1 < 0 ? 3 : this.demoIndex - 1;
34
+ } else if (ev.keyCode === 39) {
35
+ this.demoIndex = this.demoIndex - +1 > 3 ? 0 : this.demoIndex + 1;
36
+ }
37
+ return true;
38
+ },
39
+ },
40
+ };
41
+ </script>
42
+
43
+ <template>
44
+ <div
45
+ :style="{
46
+ width: 1920,
47
+ height: 1080,
48
+ backgroundColor: '#000000',
49
+ }"
50
+ >
51
+ <div
52
+ key="leftWall"
53
+ :style="{
54
+ top: 0,
55
+ left: 425,
56
+ width: 5,
57
+ height: 620,
58
+ backgroundColor: '#F0F000',
59
+ }"
60
+ />
61
+ <div
62
+ key="rightWall"
63
+ :style="{
64
+ top: 0,
65
+ left: 850,
66
+ width: 5,
67
+ height: 620,
68
+ backgroundColor: '#F0F000',
69
+ }"
70
+ />
71
+ <div
72
+ key="bottomWall"
73
+ :style="{
74
+ top: 620,
75
+ left: 425,
76
+ width: 430,
77
+ height: 5,
78
+ backgroundColor: '#F0F000',
79
+ }"
80
+ />
81
+ <div
82
+ key="GuidText1"
83
+ className="{CssStyles.FontStyle.getName()}"
84
+ :style="{ top: 625, left: (1280 - 430) / 2, width: 430, height: 40 }"
85
+ >
86
+ {`按OK键进行跳跃和转向`}
87
+ </div>
88
+ <div
89
+ key="GuidText2"
90
+ className="{CssStyles.FontStyle.getName()}"
91
+ :style="{ top: 625 + 40, left: (1280 - 430) / 2, width: 430, height: 40 }"
92
+ >
93
+ {`左右键切换不同模式的Demo`}
94
+ </div>
95
+ <jsv-focus-block
96
+ autoFocus
97
+ ref="focusNode"
98
+ :onAction="{
99
+ onKeyDown: onKeyDown,
100
+ }"
101
+ >
102
+ <LRParabolicDemo
103
+ v-if="demoIndex === 0"
104
+ name="/actorMove"
105
+ ></LRParabolicDemo>
106
+ <UDParabolicDemo v-if="demoIndex === 1" name="/udDemo"></UDParabolicDemo>
107
+ <TargetDemo v-if="demoIndex === 2" name="/targetDemo"></TargetDemo>
108
+ <AccelerateDemo
109
+ v-if="demoIndex === 3"
110
+ name="/accelerateDemo"
111
+ ></AccelerateDemo>
112
+ </jsv-focus-block>
113
+ </div>
114
+ </template>
@@ -0,0 +1,115 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2021-10-20 18:27:25
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2021-10-21 14:01:59
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import { JsvActorMoveControl, JsvActorMove } from "jsview";
10
+
11
+ export default {
12
+ components: {
13
+ JsvActorMove,
14
+ },
15
+ props: {
16
+ name: String,
17
+ },
18
+ data() {
19
+ return {
20
+ direction: 1,
21
+ };
22
+ },
23
+ setup() {
24
+ let throwControl = new JsvActorMoveControl(); // 抛物运动体控制器
25
+ let moveControl = new JsvActorMoveControl(); // 平移运动体控制器
26
+
27
+ return {
28
+ throwControl,
29
+ moveControl,
30
+ };
31
+ },
32
+ methods: {
33
+ onKeyDown(ev) {
34
+ switch (ev.keyCode) {
35
+ case 13:
36
+ this.direction = -this.direction;
37
+
38
+ this.moveControl.moveToX(195 * this.direction, 250, (x, y) => {
39
+ console.log(`Move end with x=${x} y=${y}`);
40
+ });
41
+ this.throwControl.throwAlongY(
42
+ -500,
43
+ 750,
44
+ { type: "catch", position: 0, direction: 1 },
45
+ (x, y) => {
46
+ console.log(`Throw end with x=${x} y=${y}`);
47
+ },
48
+ () => {
49
+ console.log("Get to the pole...");
50
+ }
51
+ );
52
+ return true;
53
+ }
54
+ return false;
55
+ },
56
+ },
57
+ };
58
+ </script>
59
+
60
+ <template>
61
+ <jsv-focus-block
62
+ ref="focusNode"
63
+ :name="name"
64
+ autoFocus
65
+ :onAction="{
66
+ onKeyDown: onKeyDown,
67
+ }"
68
+ >
69
+ <div
70
+ key="sample1"
71
+ class="detail-font"
72
+ :style="{ top: 150, left: 425, width: 430, height: 40 }"
73
+ >
74
+ 抛物线运动
75
+ </div>
76
+ <div
77
+ key="DirectText"
78
+ class="font"
79
+ :style="{ top: 250, left: 425, width: 430, height: 40 }"
80
+ >
81
+ {{ `当前方向:${direction > 0 ? "右" : "左"}` }}
82
+ </div>
83
+ <div :style="{ top: 590, left: 625 }">
84
+ <jsv-actor-move key="move" :control="moveControl">
85
+ <jsv-actor-move key="throw" :control="throwControl">
86
+ <div
87
+ :style="{ backgroundColor: '#00FF00', width: 30, height: 30 }"
88
+ ></div>
89
+ </jsv-actor-move>
90
+ </jsv-actor-move>
91
+ </div>
92
+ </jsv-focus-block>
93
+ </template>
94
+
95
+ <style scoped>
96
+ .font {
97
+ font-size: 32px;
98
+ color: #73665c;
99
+ line-height: 40px;
100
+ overflow: hidden;
101
+ white-space: nowrap;
102
+ text-overflow: ellipsis;
103
+ text-align: center;
104
+ }
105
+
106
+ .detail-font {
107
+ font-size: 32px;
108
+ color: #f7f7eb;
109
+ line-height: 30px;
110
+ overflow: hidden;
111
+ white-space: nowrap;
112
+ text-overflow: ellipsis;
113
+ text-align: center;
114
+ }
115
+ </style>