@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,207 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2021-10-13 14:44:03
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-07-08 10:09:50
6
+ * @Description: file content
7
+ -->
8
+ <script setup>
9
+ import { ref, shallowRef } from "vue";
10
+ import { useRouter, useRoute } from "vue-router";
11
+ import { LoopType, JsvApic } from "jsview";
12
+ import catRun from "./assets/animated_webp.webp";
13
+ import girlRun from "./assets/girl_run.gif";
14
+ import quan from "./assets/quan.webp";
15
+ import ball from "./assets/ball_3.webp";
16
+
17
+ const router = useRouter();
18
+ const route = useRoute();
19
+ let catRunPlay = ref(false);
20
+ let girlRunPlay = ref(false);
21
+ let quanPlay = ref(false);
22
+ let ballPlay = ref(false);
23
+
24
+ const catRunCallback = {
25
+ onStart: () => {
26
+ catRunPlay.value = true;
27
+ },
28
+ onEnd: () => {
29
+ catRunPlay.value = false;
30
+ },
31
+ };
32
+ const girlRunCallback = {
33
+ onStart: () => {
34
+ girlRunPlay.value = true;
35
+ },
36
+ onEnd: () => {
37
+ girlRunPlay.value = false;
38
+ },
39
+ };
40
+ const quanCallback = {
41
+ onStart: () => {
42
+ quanPlay.value = true;
43
+ },
44
+ onEnd: () => {
45
+ quanPlay.value = false;
46
+ },
47
+ };
48
+ const ballCallback = {
49
+ onStart: () => {
50
+ ballPlay.value = true;
51
+ },
52
+ onEnd: () => {
53
+ ballPlay.value = false;
54
+ },
55
+ };
56
+ let catRunRef = shallowRef(null);
57
+ let girlRunRef = shallowRef(null);
58
+ let quanRef = shallowRef(null);
59
+ let ballRef = shallowRef(null);
60
+
61
+ const onKeyDown = (ev) => {
62
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
63
+ router.go(-1); // 有router时,是从DemoHomepage进入,回退
64
+ return true;
65
+ }
66
+
67
+ if (ev.keyCode === 37) {
68
+ if (catRunRef.value) {
69
+ if (catRunPlay.value) {
70
+ catRunRef.value.stop();
71
+ catRunPlay.value = false;
72
+ } else {
73
+ catRunRef.value.play();
74
+ catRunPlay.value = true;
75
+ }
76
+ }
77
+ } else if (ev.keyCode === 13) {
78
+ if (girlRunRef.value) {
79
+ if (girlRunPlay.value) {
80
+ girlRunRef.value.stop();
81
+ girlRunPlay.value = false;
82
+ } else {
83
+ girlRunRef.value.play();
84
+ girlRunPlay.value = true;
85
+ }
86
+ }
87
+ } else if (ev.keyCode === 39) {
88
+ if (quanRef.value) {
89
+ if (quanPlay.value) {
90
+ quanRef.value.stop();
91
+ quanPlay.value = false;
92
+ } else {
93
+ quanRef.value.play();
94
+ quanPlay.value = true;
95
+ }
96
+ }
97
+ } else if (ev.keyCode === 38) {
98
+ if (ballRef.value) {
99
+ if (ballPlay.value) {
100
+ ballRef.value.stop();
101
+ ballPlay.value = false;
102
+ } else {
103
+ ballRef.value.play();
104
+ ballPlay.value = true;
105
+ }
106
+ }
107
+ }
108
+ return true;
109
+ };
110
+ </script>
111
+
112
+ <template>
113
+ <jsv-focus-block ref="rootNode" autoFocus :onKeyDown="onKeyDown">
114
+ <div :style="{ width: 1920, height: 1080, backgroundColor: '#334C4C' }">
115
+ <div :style="{ left: 20, top: 20 }">
116
+ <jsv-apic
117
+ ref="catRunRef"
118
+ :src="`url(${catRun})`"
119
+ :style="{ width: 250, height: 250 }"
120
+ :autoPlay="true"
121
+ :loopType="LoopType.LOOP_DEFAULT"
122
+ :onStart="catRunCallback.onStart"
123
+ :onEnd="catRunCallback.onEnd"
124
+ />
125
+ <div className="text" :style="{ top: 270, width: 250 }">
126
+ {{ `WEBP(${catRunPlay ? "运行" : "停止"})\n左键控制` }}
127
+ </div>
128
+ </div>
129
+
130
+ <div :style="{ left: 280, top: 20 }">
131
+ <JsvApic
132
+ ref="girlRunRef"
133
+ :src="`url(${girlRun})`"
134
+ :style="{ width: 250, height: 214 }"
135
+ :autoPlay="true"
136
+ :loopType="LoopType.LOOP_DEFAULT"
137
+ :onStart="girlRunCallback.onStart"
138
+ :onEnd="girlRunCallback.onEnd"
139
+ />
140
+ <div className="text" :style="{ top: 219, width: 250 }">
141
+ {{ `GIF(${girlRunPlay ? "运行" : "停止"})\nOK键控制` }}
142
+ </div>
143
+ </div>
144
+
145
+ <div :style="{ left: 540, top: 20 }">
146
+ <JsvApic
147
+ ref="quanRef"
148
+ :src="`url(${quan})`"
149
+ :style="{ width: 250, height: 296 }"
150
+ :autoPlay="true"
151
+ :loopType="LoopType.LOOP_DEFAULT"
152
+ :onStart="quanCallback.onStart"
153
+ :onEnd="quanCallback.onEnd"
154
+ />
155
+ <div className="text" :style="{ top: 301, width: 250 }">
156
+ {{ `单次播放WEBP(${quanPlay ? "运行" : "停止"})\n右键控制` }}
157
+ </div>
158
+ </div>
159
+
160
+ <div :style="{ left: 800, top: 20 }">
161
+ <JsvApic
162
+ ref="ballRef"
163
+ :src="`url(${ball})`"
164
+ :style="{ width: 300, height: 200 }"
165
+ :autoPlay="true"
166
+ :loopType="LoopType.LOOP_PART"
167
+ :loopInfo="[
168
+ [3, 2, 4],
169
+ [5, 7, 10],
170
+ ]"
171
+ :onStart="ballCallback.onStart"
172
+ :onEnd="ballCallback.onEnd"
173
+ />
174
+ <div class="text" :style="{ top: 205, width: 300, height: 200 }">
175
+ {{
176
+ `局部循环WEBP(${
177
+ ballPlay ? "运行" : "停止"
178
+ })\n先循环2次后循环4次\n上键控制`
179
+ }}
180
+ </div>
181
+ </div>
182
+
183
+ <div
184
+ :style="{
185
+ left: 50,
186
+ top: 590,
187
+ width: 1180,
188
+ textAlign: 'center',
189
+ color: '#000000',
190
+ fontSize: '30px',
191
+ }"
192
+ >
193
+ {{ `(按键可进行停止/重播操作)` }}
194
+ </div>
195
+ </div>
196
+ </jsv-focus-block>
197
+ </template>
198
+
199
+ <style scoped>
200
+ .text {
201
+ font-size: 25px;
202
+ height: 68px;
203
+ line-height: 34px;
204
+ color: #000000;
205
+ text-align: center;
206
+ }
207
+ </style>
Binary file
Binary file
Binary file
package/Basic/App.vue ADDED
@@ -0,0 +1,134 @@
1
+ <!--
2
+ * 【界面概述】
3
+ * div元素style中设置值对应的样例
4
+ *
5
+ * 【控件介绍】
6
+ * 无
7
+ *
8
+ * 【技巧说明】
9
+ * Q: 如何将div布局到指定坐标中?
10
+ * A: 设置div style中的top和left,坐标值是相对于父div的左上角的坐标值
11
+ *
12
+ * Q: 如何在界面上描画图片?
13
+ * A: 参照div/DivBackground,div的style中,
14
+ * 描绘纯色时,通过backgroundColor来设置,例如
15
+ * <div style={{width:200, height:200, backgroundColor: 'rgba(255, 255, 0, 1)'}}>
16
+ * 描绘图片时,通过backgroundImage来设置,例如
17
+ * <div style={{width:200, height:200, backgroundColor:`url(${iconImgPath})`}}>
18
+ * 注意,不设置width和height的情况是默认尺寸为0px * 0px,不会展示图片
19
+ *
20
+ * Q: 如何对图片进行剪切,只展示图片的局部内容?
21
+ * A: 参照div/DivClip,使用style中的overflow:"hidden"属性进行裁剪,或者使用style中clipPath属性进行裁剪
22
+ *
23
+ * Q: 如何将展示图片的四个角变成圆角?
24
+ * A: 参照img/ImgRadius,通过设置style中的borderRadius属性完成圆角改变
25
+ *
26
+ * Q: 文字如何描绘?
27
+ * A: 在div标签的内容中可填写需要描绘的文字,文字的字体字号等属性,通过div标签中的style来控制,参照text文件夹中的各个js。
28
+ * 注意:若文字内容中需要折行,则需要把要显示内容放入字符串中,并加入'\n'来达到换行效果,例如:
29
+ * <div>{"第一行
30
+ * 第二行"}</div>
31
+ * =======需要改成=======
32
+ * <div>{"第一行\n\
33
+ * 第二行"}</div>
34
+ *
35
+ * Q: 几个位置使用的文字属性是统一的情况下,如何减少每个div中设置文字style的代码量?
36
+ * A: 将统一的文字属性定义到一个js文件中(例如本Demo中的CommonFontStyle),使用时,在style中采用array扩展的方式即可:
37
+ * <div style={{...TitleFont}}>
38
+ *
39
+ * Q: 如何让div产生动画效果?
40
+ * A: 动画需要通过以下两种方式实现,具体见anim文件夹各个js:
41
+ * 方式1:声明keyframe结构,通过div的style中的animation来引用keyFrame,启动动画
42
+ * 方式2:设置div style中的transition属性,然后调整div的left/top/width/height之后,会按照transition规则进行动画。
43
+ * 注意点1:keyFrame可以声明在css文件中,也可以通过document.styleSheet来动态加载,可以参考转盘demo(turntableDemo)
44
+ * 在JsView系统中,css文件中只能声明keyFrame内容,不能声明其他内容
45
+ * 注意点2:transition目前只支持left/top/width/height属性的跟踪,其他属性目前不支持
46
+ -->
47
+
48
+ <script setup>
49
+ import { jJsvRuntimeBridge } from "jsview";
50
+ import { reactive, onMounted } from "vue";
51
+ import { useRouter } from "vue-router";
52
+ import Panel1 from "./components/panel/Panel1.vue";
53
+ import Panel2 from "./components/panel/Panel2.vue";
54
+
55
+ const router = useRouter();
56
+ const itemSides = {
57
+ top: 0,
58
+ left: 0,
59
+ width: 240,
60
+ height: 160,
61
+ };
62
+
63
+ const panelInfo = reactive({
64
+ index: 1,
65
+ total: 2,
66
+ desc: "1/2",
67
+ });
68
+ const onKeyDown = (ev) => {
69
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
70
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
71
+ router.go(-1); // 有router时,是从DemoHomepage进入,回退
72
+ return true;
73
+ } else if (ev.keyCode == 37) {
74
+ // left
75
+ panelInfo.index = --panelInfo.index > 1 ? panelInfo.index : 1;
76
+ panelInfo.desc = panelInfo.index + "/" + panelInfo.total;
77
+ return true;
78
+ } else if (ev.keyCode == 39) {
79
+ // right
80
+ panelInfo.index =
81
+ ++panelInfo.index < panelInfo.total ? panelInfo.index : panelInfo.total;
82
+ panelInfo.desc = panelInfo.index + "/" + panelInfo.total;
83
+ return true;
84
+ }
85
+
86
+ return false;
87
+ };
88
+ onMounted(() => {
89
+ jJsvRuntimeBridge.notifyPageLoaded();
90
+ });
91
+ </script>
92
+
93
+ <template>
94
+ <div>
95
+ <!-- 有router时,将按键交给router去处理,此处没有其他用处 -->
96
+ <jsv-focus-block autoFocus :onKeyDown="onKeyDown" />
97
+
98
+ <div class="root">
99
+ <Panel1
100
+ v-if="panelInfo.index == 1"
101
+ :style="{ top: 10, left: 20 }"
102
+ panelClass="panel-size"
103
+ :itemSides="itemSides"
104
+ />
105
+ <Panel2
106
+ v-else-if="panelInfo.index == 2"
107
+ :style="{ top: 10, left: 20 }"
108
+ panelClass="panel-size"
109
+ :itemSides="itemSides"
110
+ />
111
+ <div :style="{ top: 650, left: 20, width: 500, color: '#0000FF' }">
112
+ {{ panelInfo.desc }}
113
+ </div>
114
+ <div :style="{ top: 650, left: 50, width: 500, color: '#0000FF' }">
115
+ 按左/右键切换Panel,按Back键返回
116
+ </div>
117
+ </div>
118
+ </div>
119
+ </template>
120
+
121
+ <style>
122
+ .root {
123
+ top: 10;
124
+ left: 10;
125
+ width: 1250;
126
+ height: 670;
127
+ background-color: rgba(200, 200, 200, 1);
128
+ }
129
+
130
+ .panel-size {
131
+ width: 1210;
132
+ height: 630;
133
+ }
134
+ </style>
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,38 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ title: String,
4
+ index: Number,
5
+ itemSides: Object,
6
+ });
7
+ const titleStyle = {
8
+ lineHeight: 18,
9
+ width: props.itemSides.width,
10
+ height: 18,
11
+ backgroundColor: "rgba(0,0,255,0.7)",
12
+ };
13
+ const blockOpacity = props.index % 2 === 0 ? 0.2 : 0.5;
14
+ </script>
15
+
16
+ <template>
17
+ <div>
18
+ <div class="container-font" :style="titleStyle">
19
+ {{ title }}
20
+ </div>
21
+ <div
22
+ key="blockColor"
23
+ :style="{
24
+ top: titleStyle.lineHeight,
25
+ width: itemSides.width,
26
+ height: itemSides.height - 18,
27
+ backgroundColor: 'rgba(0,0,255,' + blockOpacity + ')',
28
+ }"
29
+ ></div>
30
+ <div key="container" :style="{ top: titleStyle.lineHeight }">
31
+ <slot></slot>
32
+ </div>
33
+ </div>
34
+ </template>
35
+
36
+ <style>
37
+ @import "./FontStyle.css";
38
+ </style>
@@ -0,0 +1,16 @@
1
+
2
+ .title-font {
3
+ font-family: 黑体;
4
+ font-size: 16px;
5
+ }
6
+
7
+ .container-font {
8
+ color: #FFFFFF;
9
+ font-family: 黑体;
10
+ font-size: 16px;
11
+ }
12
+
13
+ .content-font {
14
+ font-family: 黑体;
15
+ font-size: 12px;
16
+ }
@@ -0,0 +1,66 @@
1
+ <script setup>
2
+ import { reactive, onMounted, onBeforeUnmount } from "vue";
3
+ import ContentBlock from "../ContentBlock.vue";
4
+ import AnimKeyframeBasic from "./AnimKeyframeBasic.vue";
5
+ import AnimKeyframeComposite from "./AnimKeyframeComposite.vue";
6
+ import AnimTransition from "./AnimTransition.vue";
7
+
8
+ const props = defineProps({
9
+ contentClass: String,
10
+ itemSides: Object,
11
+ });
12
+
13
+ const contentBlockProps = {
14
+ colIndex: 0,
15
+ itemSides: props.itemSides,
16
+ };
17
+ let timerId = -1;
18
+ const state = reactive({
19
+ timeCount: 20,
20
+ });
21
+
22
+ onMounted(() => {
23
+ timerId = setInterval(() => {
24
+ state.timeCount = state.timeCount + 5;
25
+ }, 2000);
26
+ });
27
+
28
+ onBeforeUnmount(() => {
29
+ if (timerId >= 0) {
30
+ clearInterval(timerId);
31
+ }
32
+ timerId = -1;
33
+ });
34
+ </script>
35
+
36
+ <template>
37
+ <div id="item-root">
38
+ <ContentBlock
39
+ :class="contentClass"
40
+ :style="{ top: itemSides.height * 0 }"
41
+ :="contentBlockProps"
42
+ :index="1"
43
+ title="Keyframe基础动画集合"
44
+ >
45
+ <AnimKeyframeBasic />
46
+ </ContentBlock>
47
+ <ContentBlock
48
+ :class="contentClass"
49
+ :style="{ top: itemSides.height * 1 }"
50
+ :="contentBlockProps"
51
+ :index="2"
52
+ title="Keyframe组合示例"
53
+ >
54
+ <AnimKeyframeComposite />
55
+ </ContentBlock>
56
+ <ContentBlock
57
+ :class="contentClass"
58
+ :style="{ top: itemSides.height * 2 }"
59
+ :="{ ...contentBlockProps, itemSides: { ...itemSides, height: 290 } }"
60
+ :index="3"
61
+ title="Transition动画示例"
62
+ >
63
+ <AnimTransition :timeCount="state.timeCount" />
64
+ </ContentBlock>
65
+ </div>
66
+ </template>
@@ -0,0 +1,119 @@
1
+ <script setup>
2
+ const blockSize = {
3
+ width: 70,
4
+ height: 70,
5
+ };
6
+ const titleStyle = {
7
+ width: 60,
8
+ height: 20,
9
+ textAlign: "center",
10
+ lineHeight: 20,
11
+ };
12
+ const itemStyle = {
13
+ top: 20,
14
+ width: 50,
15
+ height: 50,
16
+ backgroundColor: "rgba(255, 0, 0, 1)",
17
+ };
18
+ </script>
19
+
20
+ <template>
21
+ <div id="layout-root">
22
+ <div>
23
+ <div class="content-font" :style="{ ...titleStyle }">Translate3d</div>
24
+ <div :style="{ ...itemStyle, animation: 'AnimTranslate 3s infinite' }" />
25
+ </div>
26
+ <div :style="{ left: blockSize.width }">
27
+ <div class="content-font" :style="{ ...titleStyle }">Scale3d</div>
28
+ <div
29
+ :style="{ ...itemStyle, animation: 'AnimScale 3s infinite linear' }"
30
+ />
31
+ </div>
32
+ <div :style="{ left: blockSize.width * 2 }">
33
+ <div class="content-font" :style="{ ...titleStyle }">Rotate3d</div>
34
+ <div
35
+ :style="{ ...itemStyle, animation: 'AnimRotate 3s infinite linear' }"
36
+ />
37
+ </div>
38
+ <div :style="{ left: blockSize.width, top: blockSize.height }">
39
+ <div class="content-font" :style="{ ...titleStyle }">Skew</div>
40
+ <div
41
+ :style="{ ...itemStyle, animation: 'AnimSkew 3s infinite ease-in' }"
42
+ />
43
+ </div>
44
+ <div :style="{ left: blockSize.width * 2, top: blockSize.height }">
45
+ <div class="content-font" :style="{ ...titleStyle }">Opacity</div>
46
+ <div
47
+ :style="{
48
+ ...itemStyle,
49
+ width: 20,
50
+ animation: 'AnimOpacityOut 3s infinite ease-out',
51
+ }"
52
+ />
53
+ <div
54
+ :style="{
55
+ ...itemStyle,
56
+ left: 25,
57
+ width: 20,
58
+ animation: 'AnimOpacityIn 3s infinite ease-in-out',
59
+ }"
60
+ />
61
+ </div>
62
+ </div>
63
+ </template>
64
+
65
+ <style>
66
+ @keyframes AnimTranslate {
67
+ from {
68
+ transform: translate3d(50%, 50px, 0);
69
+ }
70
+ to {
71
+ transform: translate3d(0, 0, 0);
72
+ }
73
+ }
74
+
75
+ @keyframes AnimScale {
76
+ from {
77
+ transform: scale3d(1.5, 1.5, 1);
78
+ }
79
+ to {
80
+ transform: scale3d(0, 0, 0);
81
+ }
82
+ }
83
+
84
+ @keyframes AnimRotate {
85
+ from {
86
+ transform: rotate3d(1.5, 1, 1, 90deg);
87
+ }
88
+ to {
89
+ transform: rotate3d(1.5, 1, 1, 0);
90
+ }
91
+ }
92
+
93
+ @keyframes AnimSkew {
94
+ from {
95
+ transform: skew(30deg, 45deg);
96
+ }
97
+ to {
98
+ transform: skew(0, 0);
99
+ }
100
+ }
101
+
102
+ @keyframes AnimOpacityOut {
103
+ from {
104
+ opacity: 0.1;
105
+ }
106
+ to {
107
+ opacity: 1;
108
+ }
109
+ }
110
+
111
+ @keyframes AnimOpacityIn {
112
+ from {
113
+ opacity: 1;
114
+ }
115
+ to {
116
+ opacity: 20%;
117
+ }
118
+ }
119
+ </style>
@@ -0,0 +1,52 @@
1
+ <script setup>
2
+ const titleStyle = {
3
+ width: 100,
4
+ height: 20,
5
+ textAlign: "center",
6
+ lineHeight: 20,
7
+ };
8
+ const itemStyle = {
9
+ top: 20,
10
+ width: 50,
11
+ height: 50,
12
+ backgroundColor: "rgba(255, 0, 0, 1)",
13
+ };
14
+ </script>
15
+
16
+ <template>
17
+ <div id="layout-root">
18
+ <div>
19
+ <div class="content-font" :style="{ ...titleStyle }">四种变形动画</div>
20
+ <div :style="{ ...itemStyle, animation: 'AnimComposite1 3s infinite' }" />
21
+ </div>
22
+ <div :style="{ left: 100 }">
23
+ <div class="content-font" :style="{ ...titleStyle }">变形+透明动画</div>
24
+ <div :style="{ ...itemStyle, animation: 'AnimComposite2 3s infinite' }" />
25
+ </div>
26
+ </div>
27
+ </template>
28
+
29
+ <style>
30
+ @import "../FontStyle.css";
31
+ </style>
32
+
33
+ <style>
34
+ @keyframes AnimComposite1 {
35
+ from {
36
+ transform: translate3d(50%, 30px, 0) scale3d(1.5, 1.5, 1)
37
+ rotate3d(1.5, 1, 1, 90deg) skew(30deg, 45deg);
38
+ }
39
+ to {
40
+ }
41
+ }
42
+
43
+ @keyframes AnimComposite2 {
44
+ from {
45
+ transform: translate3d(50%, 30px, 0) scale3d(1.5, 1.5, 1)
46
+ rotate3d(1.5, 1, 0, 90deg) skew(30deg, 45deg);
47
+ opacity: 0.1;
48
+ }
49
+ to {
50
+ }
51
+ }
52
+ </style>