@shijiu/jsview-vue-samples 2.2.426-test.0 → 2.3.151-test.0

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 (246) hide show
  1. package/BakeViewDemo/AnimatePic.vue +1 -1
  2. package/Basic/components/text/TextDirection.vue +7 -1
  3. package/BasicFocusControl/components/BaseBlock.vue +65 -18
  4. package/BreakRender/assets/imageList.json +235 -235
  5. package/ColorSpace/App.vue +2 -2
  6. package/CoupletsTest/App.vue +1 -1
  7. package/CoupletsTest/widget/Banger/Banger.vue +3 -3
  8. package/CoupletsTest/widget/Banger/MaroonLoader.vue +5 -5
  9. package/CoupletsTest/widget/Couplets/Couplets.vue +4 -4
  10. package/CoupletsTest/widget/Fireworks/Fireworks.vue +13 -13
  11. package/CustomShader/App.vue +4 -4
  12. package/CustomShader/gaussianBlur.glsl +1 -1
  13. package/DashPath/App.vue +80 -0
  14. package/DashPath/AppForOperator.vue +33 -0
  15. package/DemoForOperator/AnimPic/AnimPic.vue +69 -0
  16. package/DemoForOperator/AnimPic/App.vue +28 -0
  17. package/DemoForOperator/Banger/App.vue +26 -0
  18. package/DemoForOperator/Banger/Banger/Banger.vue +316 -0
  19. package/DemoForOperator/Banger/Banger/Maroon.vue +123 -0
  20. package/DemoForOperator/Banger/Banger/MaroonLoader.vue +78 -0
  21. package/DemoForOperator/Banger/Banger/SpriteDeal.js +30 -0
  22. package/DemoForOperator/Blur/Blur.vue +146 -0
  23. package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +158 -0
  24. package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
  25. package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +113 -0
  26. package/DemoForOperator/BookFlip/App.vue +115 -0
  27. package/DemoForOperator/BookFlip/BookFlip/FlipPage.vue +179 -0
  28. package/DemoForOperator/BookFlip/BookFlip/FlippingBook.vue +310 -0
  29. package/DemoForOperator/BookFlip/BookFlip/flip.glsl +135 -0
  30. package/DemoForOperator/BookFlip/BookPage.vue +82 -0
  31. package/DemoForOperator/Bounce/App.vue +43 -0
  32. package/DemoForOperator/Bounce/Bounce.vue +81 -0
  33. package/DemoForOperator/Bounce/FreeMoveBuilder.js +139 -0
  34. package/DemoForOperator/ChunLian/App.vue +47 -0
  35. package/DemoForOperator/ChunLian/Couplets.vue +291 -0
  36. package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
  37. package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
  38. package/DemoForOperator/DominantColor/App.vue +187 -0
  39. package/DemoForOperator/EpisodeList/App.vue +80 -0
  40. package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +110 -0
  41. package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +250 -0
  42. package/DemoForOperator/EpisodeList/GroupItem.vue +65 -0
  43. package/DemoForOperator/EpisodeList/ListItem.vue +48 -0
  44. package/DemoForOperator/Firework1/App.vue +25 -0
  45. package/DemoForOperator/Firework1/Fireworks.vue +397 -0
  46. package/DemoForOperator/Firework1/SpriteDeal.js +30 -0
  47. package/DemoForOperator/FlipPage/App.vue +75 -0
  48. package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +178 -0
  49. package/DemoForOperator/FlipPage/FlipPage/flipIn.glsl +41 -0
  50. package/DemoForOperator/FlipPage/FlipPage/flipOut.glsl +41 -0
  51. package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +95 -0
  52. package/DemoForOperator/Focus/Alpha/AlphaPage.vue +40 -0
  53. package/DemoForOperator/Focus/Alpha/Item.vue +64 -0
  54. package/DemoForOperator/Focus/App.vue +124 -0
  55. package/DemoForOperator/Focus/CommonPageSetting.js +30 -0
  56. package/DemoForOperator/Focus/Item.vue +46 -0
  57. package/DemoForOperator/Focus/Light/Item.vue +67 -0
  58. package/DemoForOperator/Focus/Light/LightFocusBox.vue +87 -0
  59. package/DemoForOperator/Focus/Light/LightPage.vue +43 -0
  60. package/DemoForOperator/Focus/Light/utils/FrameCanvasStore.ts +68 -0
  61. package/DemoForOperator/Focus/Light/utils/RotateFrame.vue +146 -0
  62. package/DemoForOperator/Focus/Light/utils/circleHaloMask.png +0 -0
  63. package/DemoForOperator/Focus/Normal/Item.vue +64 -0
  64. package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +65 -0
  65. package/DemoForOperator/Focus/Normal/NormalPage.vue +41 -0
  66. package/DemoForOperator/Focus/SwipeLight/Item.vue +73 -0
  67. package/DemoForOperator/Focus/SwipeLight/SwipeLightBox.vue +62 -0
  68. package/DemoForOperator/Focus/SwipeLight/SwipeLightPage.vue +44 -0
  69. package/DemoForOperator/FrameShadow/App.vue +193 -0
  70. package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
  71. package/DemoForOperator/FullscreenIn/App.vue +105 -0
  72. package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +56 -0
  73. package/DemoForOperator/FullscreenIn/Item.vue +50 -0
  74. package/DemoForOperator/Genie/App.vue +78 -0
  75. package/DemoForOperator/Genie/geniePakcer/Genie.vue +741 -0
  76. package/DemoForOperator/Genie/geniePakcer/genieBottom.glsl +49 -0
  77. package/DemoForOperator/Genie/geniePakcer/genieLeft.glsl +50 -0
  78. package/DemoForOperator/Genie/geniePakcer/genieRight.glsl +57 -0
  79. package/DemoForOperator/Genie/geniePakcer/genieTop.glsl +50 -0
  80. package/DemoForOperator/GrayFilter/App.vue +51 -0
  81. package/DemoForOperator/GrayFilter/GrayFilter.vue +59 -0
  82. package/DemoForOperator/Jigsaw/App.vue +45 -0
  83. package/DemoForOperator/Jigsaw/JigsawFull.vue +142 -0
  84. package/DemoForOperator/Jigsaw/JigsawSingle.vue +118 -0
  85. package/DemoForOperator/LongChatBox/App.vue +36 -0
  86. package/DemoForOperator/LongChatBox/Bubble.vue +104 -0
  87. package/DemoForOperator/LongChatBox/LongChat.vue +173 -0
  88. package/DemoForOperator/LongChatBox/TextManager.ts +147 -0
  89. package/DemoForOperator/LongChatBox/VirtualList.vue +298 -0
  90. package/DemoForOperator/LongChatBox/testData.js +51 -0
  91. package/DemoForOperator/LongChatBox/utile.js +331 -0
  92. package/DemoForOperator/Particle/App.vue +69 -0
  93. package/DemoForOperator/Particle/Drop/DropParticle.vue +208 -0
  94. package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +120 -0
  95. package/DemoForOperator/PosterAnim/App.vue +125 -0
  96. package/DemoForOperator/PosterAnim/Bounce/BouncePage.vue +54 -0
  97. package/DemoForOperator/PosterAnim/Bounce/Item.vue +85 -0
  98. package/DemoForOperator/PosterAnim/Breath/BreathPage.vue +47 -0
  99. package/DemoForOperator/PosterAnim/Breath/Item.vue +58 -0
  100. package/DemoForOperator/PosterAnim/CommonPageSetting.js +30 -0
  101. package/DemoForOperator/PosterAnim/Item.vue +46 -0
  102. package/DemoForOperator/PosterAnim/PosterAnim.js +79 -0
  103. package/DemoForOperator/PosterAnim/Scale/Item.vue +72 -0
  104. package/DemoForOperator/PosterAnim/Scale/ScalePage.vue +48 -0
  105. package/DemoForOperator/PosterAnim/Shake/Item.vue +85 -0
  106. package/DemoForOperator/PosterAnim/Shake/ShakePage.vue +53 -0
  107. package/DemoForOperator/PosterOverflow/App.vue +116 -0
  108. package/DemoForOperator/PosterOverflow/Item.vue +67 -0
  109. package/DemoForOperator/PosterOverflow/PosterOverflow.vue +39 -0
  110. package/DemoForOperator/Resize/App.vue +157 -0
  111. package/DemoForOperator/Resize/Resize/Item.vue +234 -0
  112. package/DemoForOperator/Resize/Resize/Resize.vue +96 -0
  113. package/DemoForOperator/Ripple/App.vue +54 -0
  114. package/DemoForOperator/Ripple/Ripple.vue +65 -0
  115. package/DemoForOperator/ScreenShootScale/App.vue +96 -0
  116. package/DemoForOperator/ScreenShootScale/Back.vue +86 -0
  117. package/DemoForOperator/ScreenShootScale/Front.vue +133 -0
  118. package/DemoForOperator/ScreenShootScale/Item.vue +62 -0
  119. package/DemoForOperator/ScreenShootScale/ScreenShootScale.vue +109 -0
  120. package/DemoForOperator/SmoothSwiper/App.vue +50 -0
  121. package/DemoForOperator/Sound/Bounce/App.vue +56 -0
  122. package/DemoForOperator/Sound/Bounce/Bounce.vue +87 -0
  123. package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +146 -0
  124. package/DemoForOperator/Sound/Bounce/bgmusic.mp3 +0 -0
  125. package/DemoForOperator/Sound/Bounce/coin.mp3 +0 -0
  126. package/DemoForOperator/Sound/FocusMove/App.vue +134 -0
  127. package/DemoForOperator/Sound/FocusMove/Item.vue +43 -0
  128. package/DemoForOperator/Sound/FocusMove/move.mp3 +0 -0
  129. package/DemoForOperator/Sound/Rain/App.vue +11 -0
  130. package/DemoForOperator/Sound/Rain/Raining/Rain.vue +69 -0
  131. package/DemoForOperator/Sound/Rain/Raining/RainScene.vue +118 -0
  132. package/DemoForOperator/Sound/Sound/Sound.vue +24 -0
  133. package/DemoForOperator/Sound/Sound/index.js +4 -0
  134. package/DemoForOperator/Sound/Sound/useSound.js +112 -0
  135. package/DemoForOperator/Sprite/App.vue +33 -0
  136. package/DemoForOperator/Sprite/Sprite.vue +147 -0
  137. package/DemoForOperator/Stretch/App.vue +103 -0
  138. package/DemoForOperator/Stretch/Stretch/Item.vue +192 -0
  139. package/DemoForOperator/Stretch/Stretch/Stretch.vue +218 -0
  140. package/DemoForOperator/Swiper/App.vue +101 -0
  141. package/DemoForOperator/Swiper/Item.vue +56 -0
  142. package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -0
  143. package/DemoForOperator/TabContent/App.vue +89 -0
  144. package/DemoForOperator/TabContent/ContentPage.vue +66 -0
  145. package/DemoForOperator/TabContent/Item.vue +85 -0
  146. package/DemoForOperator/TabContent/PageItem.vue +40 -0
  147. package/DemoForOperator/TabContent/TabContent/CreepFocus.vue +160 -0
  148. package/DemoForOperator/TabContent/TabContent/Item.vue +63 -0
  149. package/DemoForOperator/TabContent/TabContent/TabContent.vue +184 -0
  150. package/DemoForOperator/TabContent/TabContent/TabItem.vue +368 -0
  151. package/DemoForOperator/TabContent/TabContent/TabWidget.vue +243 -0
  152. package/DemoForOperator/TabContent/TabContent/Util.js +3 -0
  153. package/DemoForOperator/TabContent/TabContent/ViewSwiper.vue +110 -0
  154. package/DemoForOperator/TabContent/testData.js +241 -0
  155. package/DemoForOperator/TabContentVertical/App.vue +104 -0
  156. package/DemoForOperator/TabContentVertical/ContentPage.vue +67 -0
  157. package/DemoForOperator/TabContentVertical/Item.vue +94 -0
  158. package/DemoForOperator/TabContentVertical/PageItem.vue +40 -0
  159. package/DemoForOperator/TabContentVertical/TabContent/CreepFocus.vue +160 -0
  160. package/DemoForOperator/TabContentVertical/TabContent/Item.vue +63 -0
  161. package/DemoForOperator/TabContentVertical/TabContent/TabContent.vue +184 -0
  162. package/DemoForOperator/TabContentVertical/TabContent/TabItem.vue +368 -0
  163. package/DemoForOperator/TabContentVertical/TabContent/TabWidget.vue +259 -0
  164. package/DemoForOperator/TabContentVertical/TabContent/Util.js +3 -0
  165. package/DemoForOperator/TabContentVertical/TabContent/ViewSwiper.vue +110 -0
  166. package/DemoForOperator/TabContentVertical/assets/children_science.png +0 -0
  167. package/DemoForOperator/TabContentVertical/assets/documentary.png +0 -0
  168. package/DemoForOperator/TabContentVertical/assets/free.png +0 -0
  169. package/DemoForOperator/TabContentVertical/assets/game.png +0 -0
  170. package/DemoForOperator/TabContentVertical/assets/home_selected.png +0 -0
  171. package/DemoForOperator/TabContentVertical/assets/movie_ticket.png +0 -0
  172. package/DemoForOperator/TabContentVertical/assets/my_account.png +0 -0
  173. package/DemoForOperator/TabContentVertical/assets/opera.png +0 -0
  174. package/DemoForOperator/TabContentVertical/assets/sports.png +0 -0
  175. package/DemoForOperator/TabContentVertical/assets/tv_drama.png +0 -0
  176. package/DemoForOperator/TabContentVertical/assets/variety_show.png +0 -0
  177. package/DemoForOperator/TabContentVertical/assets/vip.png +0 -0
  178. package/DemoForOperator/TabContentVertical/testData.js +76 -0
  179. package/DemoForOperator/Vortex/App.vue +78 -0
  180. package/DemoForOperator/Vortex/Vortex/Vortex.vue +180 -0
  181. package/DemoForOperator/Vortex/Vortex/vortexIn.glsl +38 -0
  182. package/DemoForOperator/Vortex/Vortex/vortexOut.glsl +38 -0
  183. package/DemoForOperator/index.js +6 -0
  184. package/DemoForOperator/routeList.js +259 -0
  185. package/DemoHomepage/App.vue +50 -30
  186. package/DemoHomepage/components/Dialog.vue +1 -0
  187. package/DemoHomepage/components/Item.vue +11 -0
  188. package/DemoHomepage/components/TabFrame.vue +7 -0
  189. package/DemoHomepage/router.js +178 -81
  190. package/DemoHomepage/views/Homepage.vue +7 -2
  191. package/DivMetroPerformance/data.js +3 -3
  192. package/DriftScopeTest/App.vue +1 -1
  193. package/FilterDemo/AnimatePic.vue +1 -1
  194. package/FilterDemo/VideoLayer.vue +2 -2
  195. package/FullScreenFlex/TestFrame2.vue +1 -1
  196. package/GiftRain/App.vue +12 -12
  197. package/GiftRain/components/SpriteTranslate.vue +68 -48
  198. package/HashHistory/App.vue +2 -2
  199. package/HashHistory/router.js +1 -1
  200. package/JsvPreDownloader/App.vue +4 -4
  201. package/MediaDemo/components/frames/AudioFrame.vue +1 -1
  202. package/MediaDemo/components/frames/VideoFrame.vue +1 -1
  203. package/MetroWidgetDemos/MassiveItems/ContentItem.vue +1 -1
  204. package/MetroWidgetDemos/MassiveItems/data.js +1 -1
  205. package/MetroWidgetDemos/PerformanceTest/data.js +3 -3
  206. package/MetroWidgetDemos/RefreshDemo/assets/imageList.json +235 -235
  207. package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +235 -235
  208. package/MetroWidgetDemos/TripleWidget/App.vue +7 -1
  209. package/MetroWidgetDemos/TripleWidget/Item.vue +16 -2
  210. package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +7 -1
  211. package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +8 -2
  212. package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +3 -1
  213. package/MetroWidgetDemos/routeList.js +34 -17
  214. package/Poster3d/App.vue +69 -0
  215. package/Poster3d/Poster3d.vue +92 -0
  216. package/PosterPacker/App.vue +5 -5
  217. package/PosterPacker/tools/vortexPacker/Vortex.vue +1 -1
  218. package/QrcodeDemo/App.vue +1 -1
  219. package/Ripple/App.vue +1 -1
  220. package/ScaleDownNeon/App.vue +4 -4
  221. package/SceneTransition/App.vue +2 -2
  222. package/SceneTransition/maskConfig/config2.js +12 -12
  223. package/SceneTransition/maskConfig/config3.js +14 -14
  224. package/SprayView/App.vue +96 -51
  225. package/SpringFestival/App.vue +73 -0
  226. package/SpringFestival/SpringFestivalScene/ChunLian.vue +211 -0
  227. package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +139 -0
  228. package/SpringFestival/SpringFestivalScene/LanternAnim.js +60 -0
  229. package/SpringFestival/SpringFestivalScene/Rain.vue +137 -0
  230. package/SpringFestival/SpringFestivalScene/Scene.vue +218 -0
  231. package/SpringFestival/SpringFestivalScene/imageConfig.js +87 -0
  232. package/SpringFestival/SpringFestivalScene/index.js +1 -0
  233. package/Swiper/App.vue +28 -29
  234. package/Swiper/Item.vue +19 -0
  235. package/SwiperTest/App.vue +9 -9
  236. package/TestNativeSharedView/AckEventDefine.ts +82 -0
  237. package/TestNativeSharedView/App.vue +4 -6
  238. package/TestNativeSharedView/JsvDemoTester.js +131 -0
  239. package/TextureAnimation/App.vue +16 -6
  240. package/TextureAnimation/App3.vue +100 -0
  241. package/TextureAnimation/utils/FrameCanvasStore.ts +68 -0
  242. package/TextureAnimation/utils/RotateFrame.vue +146 -0
  243. package/TextureAnimation/utils/circleHaloMask.png +0 -0
  244. package/TombSweepingDayTest/Raining/RainScene.vue +4 -4
  245. package/ViewOpacity/App.vue +21 -2
  246. package/package.json +1 -1
@@ -0,0 +1,139 @@
1
+ const SQRT2VAL = Math.sqrt(2)
2
+
3
+
4
+ // 获取原地起跳抛物的处理
5
+ function getParabola(
6
+ cmds,
7
+ condGroupId, // 后续改为specName
8
+ xSpeed,
9
+ ySpeed,
10
+ gravity,
11
+ times,
12
+ onLandCmds
13
+ ) {
14
+ let actCmds;
15
+ if (times > 0) {
16
+ actCmds = getParabola(
17
+ cmds,
18
+ condGroupId,
19
+ xSpeed,
20
+ ySpeed / SQRT2VAL,
21
+ gravity,
22
+ times - 1,
23
+ onLandCmds
24
+ );
25
+ } else {
26
+ actCmds = onLandCmds;
27
+ }
28
+
29
+ return [
30
+ cmds.state().removeConditionByName(sFloorConditionName),
31
+ // (state: any) => {
32
+ // console.log(`State on t=${Date.now()} land y=${ySpeed} setStartOffsetPos times=${times}`,
33
+ // JSON.stringify(state))
34
+ // },
35
+ cmds.state().setStartPos(undefined, -1), // 离开接触点
36
+ cmds.action().setSpdAndAccel(xSpeed, ySpeed, 0, gravity),
37
+
38
+ // 下一帧再重启condition,避免当前帧的判断循环中仍然激活condition
39
+ cmds
40
+ .condition(condGroupId)
41
+ .onNextTick()
42
+ .then([
43
+ cmds
44
+ .condition(condGroupId, false, sFloorConditionName)
45
+ .reachPosition(undefined, 0)
46
+ .then([
47
+ ...actCmds,
48
+ ]),
49
+ ]),
50
+ ];
51
+ }
52
+
53
+ const sFloorConditionName = "floorCond";
54
+ const sWallConditionName = "wallCond";
55
+
56
+ /*
57
+ 弹跳处理
58
+ */
59
+ export function buildBounce(
60
+ cmds,// FreeMove的cmds句柄
61
+ condGroupId,
62
+ startX, // 起始位置和目标位置的偏差, 单位px
63
+ startY, // 起始位置和目标位置的偏差, 单位px
64
+ times, // 整数,落点数(弹起次数-1)
65
+ gravity, // y轴的加速度, 建议设置成0.8
66
+ onEnd,
67
+ ) {
68
+ let xDistance = startX - 0;
69
+ let yDistance = startY - 0;
70
+
71
+ if (times < 1) {
72
+ times = 1;
73
+ console.log("at least 1 times");
74
+ }
75
+
76
+ // 每个碰撞点之间的x的距离为
77
+ // sx * (1 + 1/sqrt(2) + 1/sqrt(2)^2 + ...) (=次数的数列)
78
+ // sx 为第一次下落过程x轴走过的距离
79
+ let sqrt2 = 1 / SQRT2VAL;
80
+ let sxSubBase = 2;
81
+ let sxSub = sxSubBase / 2;
82
+ for (let i = 0; i < times - 1; i++) {
83
+ sxSubBase = sxSubBase * sqrt2;
84
+ sxSub += sxSubBase;
85
+ }
86
+ let sx = -(xDistance / sxSub);
87
+
88
+ // 求首次下落使用的时间, 按照 s = 1/2*a*t^2的公式求解
89
+ let t1st = Math.sqrt(Math.abs(yDistance) * 2 / gravity);
90
+
91
+ // 求x的速度
92
+ let vx = sx / t1st;
93
+
94
+ // 求第一次落点的y速度
95
+ let vy1st = gravity * t1st;
96
+
97
+ let onLandCmds = [
98
+ cmds.action().teleportTo(0, 0),
99
+ // cmds.action().stopMoving(true),
100
+ cmds.state().removeConditionByGroup(condGroupId),
101
+ (...args) => {
102
+ onEnd?.(...args);
103
+ }
104
+ ];
105
+
106
+ let parabolaCmds;
107
+ if (times > 1) {
108
+ // 递归创建所有运动处理
109
+ parabolaCmds = getParabola(cmds, condGroupId, vx, -vy1st / SQRT2VAL, gravity, times - 2, onLandCmds);
110
+ } else {
111
+ parabolaCmds = onLandCmds;
112
+ }
113
+
114
+ let wallname = xDistance > 0 ? "left" : "right";
115
+
116
+ let cmdsArray = [
117
+ // 清理掉所有condition,除了group的外,还有wallposition
118
+ // 但后续specName的bug修正后,可以用specName来控制动画,只清理group即可
119
+ cmds.state().removeConditionByGroup(condGroupId),
120
+
121
+ // wallPosition用于规避运动路程计算超出(times越大超出越多)时,解决动画结尾的回弹问题
122
+ cmds.condition(condGroupId, true, sWallConditionName).wallPosition(wallname, 0, undefined).then([
123
+ cmds.action().teleportTo(0, undefined),
124
+ cmds.action().setSpdAndAccel(0, undefined, undefined, undefined),
125
+ ]),
126
+
127
+ // 启动从起始点的抛物下落动画
128
+ cmds.state().setStartPos(startX, startY),
129
+ cmds.action().setSpdAndAccel(vx, 0, 0, gravity),
130
+ cmds
131
+ .condition(condGroupId, false, sFloorConditionName)
132
+ .reachPosition(undefined, 0)
133
+ .then([
134
+ ...parabolaCmds
135
+ ])
136
+ ];
137
+
138
+ return cmdsArray;
139
+ }
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <div
3
+ :style="{
4
+ width: 1280,
5
+ height: 720,
6
+ backgroundColor: '#007788',
7
+ }"
8
+ ></div>
9
+
10
+ <couplets
11
+ :sourceMap="sourceMap"
12
+ :leftPosition="leftPosition"
13
+ :rightPosition="rightPosition"
14
+ :size="size"
15
+ :duration="2"
16
+ ></couplets>
17
+ </template>
18
+
19
+ <script setup>
20
+ import Couplets from "./Couplets.vue";
21
+ const leftImage = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ChunLian/App/couplet_left.png";
22
+ const rightImage = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ChunLian/App/couplet_right.png";
23
+ const scrollSprite = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ChunLian/App/scroll.png";
24
+ const scrollStatic = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ChunLian/App/scroll_static.png";
25
+
26
+ const sourceMap = {
27
+ leftContent: leftImage,
28
+ rightContent: rightImage,
29
+ scrollSprite: scrollSprite,
30
+ scrollStatic: scrollStatic,
31
+ };
32
+
33
+ const size = {
34
+ width: 180,
35
+ height: 600,
36
+ };
37
+
38
+ const leftPosition = {
39
+ left: 100,
40
+ top: 30,
41
+ };
42
+
43
+ const rightPosition = {
44
+ left: 1000,
45
+ top: 30,
46
+ };
47
+ </script>
@@ -0,0 +1,291 @@
1
+ <!--
2
+ * 【模块 export 内容】
3
+ * JsvCouplets:春联组件
4
+ * props说明:
5
+ * width {Number} 春联宽度
6
+ * duration {Number} 春联滚动时间
7
+ * left {Number} 春联Left位置
8
+ * top {Number} 春联Top位置
9
+ *
10
+ -->
11
+ <template>
12
+ <JsvPreload
13
+ :preloadList="preload_info"
14
+ :onPreloadDone="loadDone"
15
+ ></JsvPreload>
16
+ <div v-for="layout in layouts">
17
+ <div
18
+ v-show="myShow"
19
+ :style="{
20
+ width: 180,
21
+ height: size.height,
22
+ top: layout.top,
23
+ left: layout.left,
24
+ transform: `scale3d(${size.width / 180},${size.width / 180},1)`,
25
+ transformOrigin: 'left top',
26
+ }"
27
+ >
28
+ <div
29
+ :style="{
30
+ top: 0,
31
+ left: 0,
32
+ width: 180,
33
+ height: size.height,
34
+ overflow: 'hidden',
35
+ animation: aniName1,
36
+ }"
37
+ >
38
+ <div
39
+ :style="{
40
+ top: 0,
41
+ left: 0,
42
+ width: 180,
43
+ height: size.height,
44
+ backgroundImage: layout.isLeft
45
+ ? sourceMap.leftContent
46
+ : sourceMap.rightContent,
47
+ animation: aniName2,
48
+ }"
49
+ ></div>
50
+ </div>
51
+ <!-- 滚轴动画 -->
52
+ <JsvSpriteLoader
53
+ :imageUrl="sourceMap.scrollSprite"
54
+ :configUrl="scrollJson"
55
+ :onConfigReady="preloadCallback"
56
+ :noNeedResource="false"
57
+ >
58
+ <div
59
+ :style="{
60
+ left: -30,
61
+ top: size.height,
62
+ transform: `scale3d(${(180 + 60) / view_size.w},1,1)`,
63
+ }"
64
+ >
65
+ <div
66
+ :style="{
67
+ width: view_size.w,
68
+ height: view_size.h,
69
+ animation: aniName1,
70
+ }"
71
+ >
72
+ <JsvSpriteAnim
73
+ :spriteInfo="sprite_info.info"
74
+ :loop="4"
75
+ :duration="props.duration / 4"
76
+ :imageUrl="sourceMap.scrollSprite"
77
+ ref="myRef"
78
+ >
79
+ </JsvSpriteAnim>
80
+ </div>
81
+ </div>
82
+ </JsvSpriteLoader>
83
+ <!-- 滚轴图片 -->
84
+ <div
85
+ :style="{
86
+ top: -30,
87
+ left: -30,
88
+ width: 180 + 60,
89
+ height: 30,
90
+ backgroundImage: sourceMap.scrollStatic,
91
+ }"
92
+ ></div>
93
+ </div>
94
+ </div>
95
+ </template>
96
+
97
+ <script setup>
98
+ import {
99
+ JsvSpriteAnim,
100
+ getKeyFramesGroup,
101
+ JsvSpriteLoader,
102
+ JsvPreload,
103
+ buildPreloadInfo,
104
+ } from "jsview";
105
+ import { shallowRef, onBeforeUnmount, watch } from "vue";
106
+
107
+ const props = defineProps({
108
+ /**
109
+ * 春联图片资源配置对象
110
+ * @type {Object}
111
+ * @property {string} leftContent - 左侧春联图片URL
112
+ * @property {string} rightContent - 右侧春联图片URL
113
+ * @property {string} scrollSprite - 滚轴精灵图URL
114
+ * @property {string} scrollStatic - 静态滚轴图片URL
115
+ * @required
116
+ */
117
+ sourceMap: {
118
+ type: Object,
119
+ require: true,
120
+ validator: function (value) {
121
+ return (
122
+ "leftContent" in value &&
123
+ "rightContent" in value &&
124
+ "scrollSprite" in value &&
125
+ "scrollStatic" in value
126
+ );
127
+ },
128
+ },
129
+
130
+ /**
131
+ * 春联尺寸配置
132
+ * @type {Object}
133
+ * @property {number} width - 春联宽度
134
+ * @property {number} height - 春联高度
135
+ * @required
136
+ */
137
+ size: {
138
+ type: Object,
139
+ required: true,
140
+ validator: function (value) {
141
+ return "width" in value && "height" in value;
142
+ },
143
+ },
144
+
145
+ /**
146
+ * 左侧春联位置配置
147
+ * @type {Object}
148
+ * @property {number} left - 左侧春联的水平位置
149
+ * @property {number} top - 左侧春联的垂直位置
150
+ * @required
151
+ */
152
+ leftPosition: {
153
+ type: Object,
154
+ require: true,
155
+ validator: function (value) {
156
+ return "left" in value && "top" in value;
157
+ },
158
+ },
159
+
160
+ /**
161
+ * 右侧春联位置配置
162
+ * @type {Object}
163
+ * @property {number} left - 右侧春联的水平位置
164
+ * @property {number} top - 右侧春联的垂直位置
165
+ * @required
166
+ */
167
+ rightPosition: {
168
+ type: Object,
169
+ require: true,
170
+ validator: function (value) {
171
+ return "left" in value && "top" in value;
172
+ },
173
+ },
174
+
175
+ /**
176
+ * 动画持续时间(单位:秒)
177
+ * @type {Number}
178
+ * @required
179
+ */
180
+ duration: {
181
+ type: Number,
182
+ require: true
183
+ }
184
+ });
185
+ const layouts = [{ ...props.leftPosition, isLeft: true }, props.rightPosition];
186
+ let myShow = shallowRef(false);
187
+ const scrollJson = props.sourceMap.scrollSprite.split("?")[0] + ".json";
188
+
189
+ //预加载
190
+ const preload_info = [
191
+ buildPreloadInfo(props.sourceMap.leftContent),
192
+ buildPreloadInfo(props.sourceMap.rightContent),
193
+ buildPreloadInfo(props.sourceMap.scrollSprite),
194
+ buildPreloadInfo(props.sourceMap.scrollStatic),
195
+ ];
196
+
197
+ let readyNum = shallowRef(0);
198
+ const loadDone = (a) => {
199
+ readyNum.value++;
200
+ };
201
+ let sprite_info = shallowRef(null);
202
+ const view_size = shallowRef(null);
203
+
204
+ const _formatInfo = (action_json) => {
205
+ const info = {
206
+ frames: [],
207
+ meta: {
208
+ size: action_json.meta.size,
209
+ },
210
+ };
211
+ let frames_ref = info.frames;
212
+ let max_width = 0;
213
+ let max_height = 0;
214
+
215
+ for (let i = 0; i < action_json.frames.length; i++) {
216
+ const target = action_json.frames[i].spriteSourceSize;
217
+ frames_ref.push({
218
+ target,
219
+ source: action_json.frames[i].frame,
220
+ });
221
+ const sprite_with = target.x + target.w;
222
+ const sprite_height = target.y + target.h;
223
+ if (sprite_with > max_width) {
224
+ max_width = sprite_with;
225
+ }
226
+ if (sprite_height > max_height) {
227
+ max_height = sprite_height;
228
+ }
229
+ }
230
+ return { info, maxW: max_width, maxH: max_height };
231
+ };
232
+ const preloadCallback = (config_json, resolve_set) => {
233
+ sprite_info.value = _formatInfo(config_json);
234
+ view_size.value = {
235
+ w: sprite_info.value.maxW,
236
+ h: sprite_info.value.maxH,
237
+ };
238
+ resolve_set(); // 通知loader数组设置完成
239
+ readyNum.value++;
240
+ };
241
+ //动画名字
242
+ let aniName1 = shallowRef(null);
243
+ let aniName2 = shallowRef(null);
244
+
245
+ //插入动画
246
+ const idRandom = Math.floor(Math.random() * 1000000);
247
+ let name1 = "anim1-" + idRandom;
248
+ let name2 = "anim2-" + idRandom;
249
+ let styleShell = getKeyFramesGroup();
250
+ let anim1 = `@keyframes ${name1} {
251
+ from {
252
+ transform: translate3d(0,${-props.size.height}, 0);
253
+ }
254
+ to {
255
+ transform: translate3d(0, 0, 0);
256
+ }
257
+ }`;
258
+ styleShell.insertRule(anim1);
259
+ let anim2 = `@keyframes ${name2} {
260
+ from {
261
+ transform: translate3d(0,${props.size.height}, 0);
262
+ }
263
+ to {
264
+ transform: translate3d(0, 0, 0);
265
+ }
266
+ }`;
267
+ styleShell.insertRule(anim2);
268
+
269
+ let timer = { id: -1 };
270
+ //ref
271
+ let myRef = shallowRef(null);
272
+ watch(readyNum, (n, o) => {
273
+ if (o != 2 && n == 2) {
274
+ timer.id = setTimeout(() => {
275
+ myShow.value = true;
276
+ myRef.value?.forEach((i) => i.start());
277
+ aniName1.value = `${name1} ${props.duration}s linear`;
278
+ aniName2.value = `${name2} ${props.duration}s linear`;
279
+ }, 0);
280
+ }
281
+ });
282
+
283
+ onBeforeUnmount(() => {
284
+ styleShell.removeRule(name1);
285
+ styleShell.removeRule(name2);
286
+ clearTimeout(timer.id);
287
+ timer.id = -1;
288
+ });
289
+ </script>
290
+
291
+ <style scoped></style>
@@ -0,0 +1,130 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2023-03-08 14:52:08
4
+ * @Description: file content
5
+ -->
6
+ <script setup>
7
+ import { MetroWidget, VERTICAL, useFocusHub } from "jsview";
8
+ import Item from "./Item.vue";
9
+ import { onMounted, shallowRef } from "vue";
10
+
11
+ const TAG = "MetroWidgetDemo";
12
+
13
+ const focusHub = useFocusHub();
14
+
15
+ const provideData = () => {
16
+ const data = [
17
+ {
18
+ width: 50,
19
+ height: 50,
20
+ marginRight: 10,
21
+ index: 0,
22
+ },
23
+ {
24
+ width: 50,
25
+ height: 50,
26
+ marginRight: 10,
27
+ index: 1,
28
+ },
29
+ {
30
+ width: 50,
31
+ height: 50,
32
+ marginRight: 10,
33
+ index: 2,
34
+ spriteSrc:
35
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ClickSpriteAnim/good.png",
36
+ },
37
+ ];
38
+ return data;
39
+ };
40
+
41
+ const measures = (data) => {
42
+ return {
43
+ width: data.width,
44
+ height: data.height,
45
+ marginRight: data.marginRight,
46
+ marginBottom: data.marginBottom,
47
+ };
48
+ };
49
+
50
+ // callbacks
51
+ const onEdge = (edgeInfo) => {
52
+ console.log(TAG, "onEdge", edgeInfo);
53
+ };
54
+
55
+ const onFocus = () => {
56
+ console.log(TAG, "onFocus");
57
+ };
58
+
59
+ const onBlur = () => {
60
+ console.log(TAG, "onBlur");
61
+ };
62
+
63
+ const onScroll = (start, range, totalSize) => {
64
+ console.log(TAG, "onScroll", start, range, totalSize);
65
+ };
66
+
67
+ const widgetLayout = {
68
+ left: (1280 - 180) / 2,
69
+ top: 100,
70
+ width: 180,
71
+ height: 300,
72
+ };
73
+
74
+ onMounted(() => {
75
+ //组件mount后设置焦点
76
+ focusHub.setFocus("mainMw");
77
+ });
78
+
79
+ const widgetRef = shallowRef(null);
80
+ window.widgetRef = widgetRef;
81
+
82
+ const show = shallowRef(false);
83
+ setTimeout(() => {
84
+ show.value = true;
85
+ }, 1000);
86
+ </script>
87
+
88
+ <template>
89
+ <div
90
+ :style="{
91
+ width: 1280,
92
+ height: 720,
93
+ backgroundColor: '#007788',
94
+ }"
95
+ />
96
+ <metro-widget
97
+ v-if="show"
98
+ ref="widgetRef"
99
+ name="mainMw"
100
+ :left="widgetLayout.left"
101
+ :top="widgetLayout.top"
102
+ :width="widgetLayout.width"
103
+ :height="widgetLayout.height"
104
+ :provideData="provideData"
105
+ :direction="VERTICAL"
106
+ :measures="measures"
107
+ :onEdge="onEdge"
108
+ :onFocus="onFocus"
109
+ :onBlur="onBlur"
110
+ :onScroll="onScroll"
111
+ >
112
+ <template #renderItem="{ data, onAction }">
113
+ <item :data="data" :onAction="onAction" />
114
+ </template>
115
+ </metro-widget>
116
+
117
+ <div
118
+ :style="{
119
+ width: 1280,
120
+ height: 80,
121
+ lineHeight: 80,
122
+ backgroundColor: '#00000077',
123
+ fontSize: 30,
124
+ textAlign: 'center',
125
+ color: '#ffffff',
126
+ }"
127
+ >
128
+ 第三项摁OK会有动画
129
+ </div>
130
+ </template>
@@ -0,0 +1,74 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2023-03-08 14:52:17
4
+ * @Description: file content
5
+ -->
6
+ <script setup>
7
+ import { ref, shallowRef } from "vue";
8
+ import Sprite from "../Sprite/Sprite.vue";
9
+
10
+ const props = defineProps({
11
+ data: Object,
12
+ onAction: Object,
13
+ });
14
+
15
+ const focused = ref(false);
16
+ const spriteController = shallowRef(null);
17
+ // 注册回调
18
+ const onFocus = () => {
19
+ focused.value = true;
20
+ };
21
+ const onBlur = () => {
22
+ focused.value = false;
23
+ };
24
+ const onClick = () => {
25
+ spriteController.value?.play();
26
+ };
27
+ props.onAction.register("onFocus", onFocus);
28
+ props.onAction.register("onBlur", onBlur);
29
+ props.onAction.register("onClick", onClick);
30
+
31
+ const onAnimEnd = () => {
32
+ console.log("anim end");
33
+ };
34
+ </script>
35
+
36
+ <template>
37
+ <div
38
+ :style="{
39
+ width: data.width,
40
+ height: data.height,
41
+ backgroundColor: focused ? '#22222299' : '#00000000',
42
+ borderRadius: Math.round(data.width / 2),
43
+ }"
44
+ ></div>
45
+ <Sprite
46
+ v-if="data.spriteSrc"
47
+ ref="spriteController"
48
+ :spriteSrc="data.spriteSrc"
49
+ :repeat="0"
50
+ :layout="{
51
+ width: data.width,
52
+ height: data.height,
53
+ }"
54
+ :onEnd="onAnimEnd"
55
+ :duration="1"
56
+ endFrame="end"
57
+ :autoStart="false"
58
+ ></Sprite>
59
+ <div
60
+ v-else
61
+ :style="{
62
+ width: data.width,
63
+ height: data.height,
64
+ fontSize: 30,
65
+ color: '#ffffff',
66
+ textAlign: 'center',
67
+ lineHeight: data.height,
68
+ backgroundColor: '#ffffff33',
69
+ borderRadius: Math.round(data.width / 2),
70
+ }"
71
+ >
72
+ {{ data.index }}
73
+ </div>
74
+ </template>