@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,134 @@
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, SeamlessSlide } from "jsview";
8
+ import Item from "./Item.vue";
9
+ import { onMounted, shallowRef } from "vue";
10
+ import { useSound, Sound } from "../Sound";
11
+ import moveSound from "./move.mp3";
12
+
13
+ const TAG = "MetroWidgetDemo";
14
+
15
+ const focusHub = useFocusHub();
16
+
17
+ const randomColor = () => {
18
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
19
+ return (
20
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
21
+ );
22
+ };
23
+
24
+ const provideData = () => {
25
+ const data = [];
26
+
27
+ for (let i = 0; i < 200; i++) {
28
+ data.push({
29
+ width: 180,
30
+ height: 270,
31
+ marginRight: 10,
32
+ marginBottom: 10,
33
+ color: randomColor(),
34
+ content: i,
35
+ });
36
+ }
37
+ return data;
38
+ };
39
+
40
+ const measures = (data) => {
41
+ return {
42
+ width: data.width,
43
+ height: data.height,
44
+ marginRight: data.marginRight,
45
+ marginBottom: data.marginBottom,
46
+ };
47
+ };
48
+
49
+ // callbacks
50
+ const onEdge = (edgeInfo) => {
51
+ console.log(TAG, "onEdge", edgeInfo);
52
+ };
53
+
54
+ const onFocus = () => {
55
+ console.log(TAG, "onFocus");
56
+ };
57
+
58
+ const onBlur = () => {
59
+ console.log(TAG, "onBlur");
60
+ };
61
+
62
+ const onScroll = (start, range, totalSize) => {
63
+ console.log(TAG, "onScroll", start, range, totalSize);
64
+ };
65
+
66
+ const widgetLayout = {
67
+ left: 50,
68
+ top: 50,
69
+ width: 1000,
70
+ height: 600,
71
+ };
72
+
73
+ onMounted(() => {
74
+ //组件mount后设置焦点
75
+ focusHub.setFocus("mainMw");
76
+ });
77
+
78
+ const { playSfx } = useSound(
79
+ null,
80
+ {
81
+ move: moveSound,
82
+ },
83
+ true
84
+ );
85
+
86
+ const onDispatchKeyDown = (ev) => {
87
+ if (
88
+ ev.keyCode == 37 ||
89
+ ev.keyCode == 39 ||
90
+ ev.keyCode == 38 ||
91
+ ev.keyCode == 40
92
+ ) {
93
+ playSfx("move");
94
+ }
95
+ return false;
96
+ };
97
+
98
+ const slideSetting = new SeamlessSlide({
99
+ // easing: "cubic-bezier(.42,.11,.43,.91)",
100
+ easing: "jsv-ease(0.2, 0.6, 1.5)",
101
+ speed: 0.85,
102
+ });
103
+ </script>
104
+
105
+ <template>
106
+ <div
107
+ :style="{
108
+ width: 1920,
109
+ height: 1080,
110
+ backgroundColor: '#007788',
111
+ }"
112
+ />
113
+ <jsv-focus-block :onAction="{ onDispatchKeyDown }">
114
+ <metro-widget
115
+ name="mainMw"
116
+ :left="widgetLayout.left"
117
+ :top="widgetLayout.top"
118
+ :width="widgetLayout.width"
119
+ :height="widgetLayout.height"
120
+ :provideData="provideData"
121
+ :direction="VERTICAL"
122
+ :measures="measures"
123
+ :onEdge="onEdge"
124
+ :onFocus="onFocus"
125
+ :onBlur="onBlur"
126
+ :onScroll="onScroll"
127
+ :slideSetting="slideSetting"
128
+ >
129
+ <template #renderItem="{ data, onAction }">
130
+ <item :data="data" :onAction="onAction" />
131
+ </template>
132
+ </metro-widget>
133
+ </jsv-focus-block>
134
+ </template>
@@ -0,0 +1,43 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2023-03-08 14:52:17
4
+ * @Description: file content
5
+ -->
6
+ <script setup>
7
+ import { ref } from "vue";
8
+
9
+ const props = defineProps({
10
+ data: Object,
11
+ onAction: Object,
12
+ });
13
+
14
+ const focused = ref(false);
15
+
16
+ // 注册回调
17
+ const onFocus = () => {
18
+ focused.value = true;
19
+ };
20
+ const onBlur = () => {
21
+ focused.value = false;
22
+ };
23
+ const onClick = () => {
24
+ console.log("item onclick ", props.data);
25
+ };
26
+ props.onAction.register("onFocus", onFocus);
27
+ props.onAction.register("onBlur", onBlur);
28
+ props.onAction.register("onClick", onClick);
29
+ </script>
30
+
31
+ <template>
32
+ <div
33
+ :style="{
34
+ width: data.width,
35
+ height: data.height,
36
+ fontSize: 30,
37
+ color: focused ? '#FF0000' : '#FFFFFF',
38
+ backgroundColor: data.color,
39
+ }"
40
+ >
41
+ {{ data.content }}
42
+ </div>
43
+ </template>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <RainScene></RainScene>
3
+ </template>
4
+
5
+ <script setup>
6
+ import RainScene from "./Raining/RainScene.vue"
7
+ </script>
8
+
9
+ <style scoped>
10
+
11
+ </style>
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <JsvFreeMoveActor
3
+ :top="-myHeight"
4
+ :left="myLeft"
5
+ :width="2"
6
+ :height="myHeight"
7
+ ref="myRef"
8
+ >
9
+ <div
10
+ :style="{
11
+ width: 2,
12
+ height: myHeight,
13
+ backgroundImage: `jsvtexturestore://${sourceId}`,
14
+ }"
15
+ ></div>
16
+ </JsvFreeMoveActor>
17
+ </template>
18
+
19
+ <script setup>
20
+ import { shallowRef, onBeforeUnmount, onMounted } from "vue";
21
+ import { JsvTextureStoreApi, JsvFreeMoveActor } from "jsview";
22
+ let canvasRef;
23
+ let sourceId = shallowRef("");
24
+ const canvasTexture = JsvTextureStoreApi.canvasTexture(10, 200);
25
+ canvasTexture.drawLine(0, 0, 0, 200, 10, "rgba(255, 255, 255, 0.5)");
26
+ canvasRef = canvasTexture.commit();
27
+ sourceId.value = canvasRef;
28
+ //随机长度函数(限制在80-160)
29
+ const randomHeight = () => {
30
+ return Math.floor(Math.random() * 80) + 80;
31
+ };
32
+
33
+ //随机left值
34
+ const randomLeft = () => {
35
+ return Math.floor(Math.random() * 1280);
36
+ };
37
+ const myHeight = randomHeight();
38
+ const myLeft = randomLeft();
39
+
40
+ let myRef = shallowRef(null);
41
+ let myControl;
42
+ let randomInteger = Math.floor(Math.random() * 200) + 1;
43
+
44
+ onMounted(() => {
45
+ myControl = myRef.value.control;
46
+ myControl.run((cmds) => [
47
+ cmds
48
+ .condition()
49
+ .onNextTick(randomInteger)
50
+ .then([
51
+ cmds.action().setSpeed(undefined, 9),
52
+ cmds.action(3).setAccel(undefined, 0.13),
53
+ ]),
54
+ cmds
55
+ .condition(undefined, true)
56
+ .reachPosition(undefined, 620)
57
+ .then([
58
+ cmds.action().teleportTo(undefined, -580 - myHeight),
59
+ cmds.action().setSpeed(undefined, 9),
60
+ cmds.action(3).setAccel(undefined, 0.13),
61
+ ]),
62
+ ]);
63
+ });
64
+ onBeforeUnmount(() => {
65
+ JsvTextureStoreApi.deleteTexture(sourceId.value);
66
+ });
67
+ </script>
68
+
69
+ <style lang="scss" scoped></style>
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <JsvRipple :width="1280" :height="720" ref="rippleViewRef">
3
+ <jsv-focus-block autoFocus>
4
+ <img
5
+ :src="bg"
6
+ :style="{ width: 1280, height: 720 }"
7
+ :onLoad="funcBackgroundOnLoaded"
8
+ />
9
+ <div
10
+ :style="{
11
+ width: 100,
12
+ height: 100,
13
+ backgroundImage: title,
14
+ left: 900,
15
+ top: 40,
16
+ }"
17
+ ></div>
18
+ <!-- 随机位置和长度的雨滴 -->
19
+ <Rain v-for="(item, index) in 60" />
20
+ <!-- 波纹效果 -->
21
+ </jsv-focus-block>
22
+ </JsvRipple>
23
+ <Sound :bgInfos="bgInfos" />
24
+ </template>
25
+
26
+ <script setup>
27
+ import Rain from "./Rain.vue";
28
+ import { JsvRipple, JsvRippleShape } from "jsview";
29
+ import { shallowRef, onMounted, onBeforeUnmount } from "vue";
30
+ import { useSound, Sound } from "../../Sound";
31
+
32
+ const bg =
33
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/qingming_bg.jpg";
34
+ const title =
35
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/qingming_title.png";
36
+ const musicBg =
37
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/rain_background.mp3";
38
+ const mySound =
39
+ "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/rain_tiktok.mp3";
40
+
41
+ const { playSfx, playBg, pauseBg, bgInfos } = useSound(
42
+ {
43
+ bg: {
44
+ url: musicBg,
45
+ onLoad: () => {
46
+ console.log("bg onLoad");
47
+ playBg("bg");
48
+ },
49
+ },
50
+ },
51
+ { rain: mySound }
52
+ );
53
+
54
+ let timer = { id: -1, id2: -1 };
55
+ let rippleViewRef = shallowRef(null);
56
+ const genSource = () => {
57
+ let leftOrRight = Math.random() >= 0.5 ? true : false;
58
+ if (leftOrRight) {
59
+ return [
60
+ Math.floor(Math.random() * (336 - 214 + 1)) + 214,
61
+ Math.round(Math.random() * 200 + 400),
62
+ Math.round(Math.random() * 100 + 20),
63
+ ];
64
+ } else {
65
+ return [
66
+ Math.floor(Math.random() * (1066 - 960 + 1)) + 960,
67
+ Math.round(Math.random() * 200 + 400),
68
+ Math.round(Math.random() * 100 + 20),
69
+ ];
70
+ }
71
+ };
72
+
73
+ let backgrounLoaded = false;
74
+ const funcBackgroundOnLoaded = () => {
75
+ backgrounLoaded = true;
76
+ console.log("bg image loaded");
77
+ };
78
+
79
+ onMounted(() => {
80
+ if (rippleViewRef.value !== null) {
81
+ timer.id = setInterval(() => {
82
+ if (backgrounLoaded) {
83
+ // 图片加载完成后再追加波纹,规避绘出黑色的波圈
84
+ const p = genSource();
85
+ rippleViewRef.value.addSource(
86
+ ...p,
87
+ {
88
+ type: JsvRippleShape.CIRCLE,
89
+ },
90
+ {
91
+ timeDecay: 0.5,
92
+ distanceDecay: 8,
93
+ speed: 60,
94
+ frequency: 2,
95
+ waveNum: 2,
96
+ }
97
+ );
98
+
99
+ timer.id2 = setTimeout(() => {
100
+ playSfx("rain");
101
+ }, 1000);
102
+ }
103
+ }, 3000);
104
+ }
105
+ });
106
+ onBeforeUnmount(() => {
107
+ if (timer.id !== -1) {
108
+ clearInterval(timer.id);
109
+ timer.id = -1;
110
+ }
111
+ if (timer.id2 !== -1) {
112
+ clearTimeout(timer.id2);
113
+ timer.id2 = -1;
114
+ }
115
+ });
116
+ </script>
117
+
118
+ <style scoped></style>
@@ -0,0 +1,24 @@
1
+ <script setup>
2
+ import { JsvAudio } from "jsview";
3
+
4
+ const props = defineProps({
5
+ bgInfos: {
6
+ type: Object,
7
+ default: () => {},
8
+ },
9
+ });
10
+ console.log("bgInfos", props.bgInfos);
11
+ </script>
12
+
13
+ <template>
14
+ <div>
15
+ <jsv-audio
16
+ v-for="(bgInfo, index) in bgInfos"
17
+ :key="index"
18
+ :onRef="bgInfo.onRef"
19
+ :onLoad="bgInfo.onLoad"
20
+ :src="bgInfo.url"
21
+ :loop="true"
22
+ />
23
+ </div>
24
+ </template>
@@ -0,0 +1,4 @@
1
+ import { useSound } from "./useSound";
2
+ import Sound from "./Sound.vue";
3
+
4
+ export { useSound, Sound };
@@ -0,0 +1,112 @@
1
+ import { onMounted, onBeforeUnmount } from "vue";
2
+ import { JsvSoundPool, globalLoadJsvAudioPlugin } from "jsview";
3
+
4
+ let jsvAudioLoaded = false;
5
+ const safeLoadJsvAudio = () => {
6
+ if (!jsvAudioLoaded) {
7
+ globalLoadJsvAudioPlugin((status) => {
8
+ console.log("load JsvAudio plugin status", status);
9
+ if (status == 4) {
10
+ jsvAudioLoaded = true;
11
+ }
12
+ });
13
+ }
14
+ };
15
+
16
+ export function useSound(bgSourceMap, sfxSourceMap, needRepeat = false) {
17
+ let sfxController = {};
18
+ let bgController = {};
19
+
20
+ let soundPool = null;
21
+ const loadSfx = (sfxMap) => {
22
+ soundPool = new JsvSoundPool(10);
23
+ for (const [key, value] of Object.entries(sfxMap)) {
24
+ if (needRepeat) {
25
+ soundPool.requestInRepeatMode(
26
+ `url(${value})`,
27
+ 100,
28
+ null,
29
+ 1,
30
+ (state, audioController) => {
31
+ if (state === 0) {
32
+ sfxController[key] = audioController;
33
+ }
34
+ }
35
+ );
36
+ } else {
37
+ soundPool.request(
38
+ `url(${value})`,
39
+ null,
40
+ 1,
41
+ (state, audioController) => {
42
+ if (state === 0) {
43
+ sfxController[key] = audioController;
44
+ }
45
+ }
46
+ );
47
+ }
48
+ }
49
+ };
50
+ if (sfxSourceMap && Object.keys(sfxSourceMap).length > 0) {
51
+ loadSfx(sfxSourceMap);
52
+ }
53
+
54
+ const initBg = (bgMap) => {
55
+ if (!bgMap) return [];
56
+ const bgInfos = [];
57
+ for (const [key, value] of Object.entries(bgMap)) {
58
+ const onRef = (ele) => {
59
+ bgController[key] = ele;
60
+ };
61
+ bgInfos.push({
62
+ url: value.url,
63
+ onRef,
64
+ onLoad: () => {
65
+ console.log("bg onLoad 2", value.onLoad);
66
+ value.onLoad?.();
67
+ },
68
+ });
69
+ }
70
+ return bgInfos;
71
+ };
72
+ const bgInfos = initBg(bgSourceMap);
73
+
74
+ onMounted(() => {
75
+ safeLoadJsvAudio();
76
+ });
77
+
78
+ onBeforeUnmount(() => {
79
+ sfxController = {};
80
+ soundPool?.destroy();
81
+
82
+ for (const [key, value] of Object.entries(bgController)) {
83
+ value?.pause();
84
+ value?.unload();
85
+ }
86
+ });
87
+
88
+ const playSfx = (sfxKey) => {
89
+ if (sfxController[sfxKey]) {
90
+ sfxController[sfxKey].play();
91
+ }
92
+ };
93
+
94
+ const playBg = (bgKey) => {
95
+ if (bgController[bgKey]) {
96
+ bgController[bgKey]?.play();
97
+ }
98
+ };
99
+
100
+ const pauseBg = (bgKey) => {
101
+ if (bgController[bgKey]) {
102
+ bgController[bgKey]?.pause();
103
+ }
104
+ };
105
+
106
+ return {
107
+ playSfx,
108
+ playBg,
109
+ pauseBg,
110
+ bgInfos,
111
+ };
112
+ }
@@ -0,0 +1,33 @@
1
+ <script setup>
2
+ import Sprite from "./Sprite.vue";
3
+
4
+ const spriteSrc = "https://oss.image.qcast.cn/JsViewVideo/ImageTestSample/JsViewFrameworkDemo/sprite/egg_break.png";
5
+ const repeat = 3;
6
+ const layout = {
7
+ width: 600,
8
+ height: 600,
9
+ };
10
+ const onEnd = () => {
11
+ console.log("play end");
12
+ };
13
+ const duration = 0.8;
14
+ </script>
15
+
16
+ <template>
17
+ <div class="bgStyle"></div>
18
+ <Sprite
19
+ :spriteSrc="spriteSrc"
20
+ :repeat="repeat"
21
+ :layout="layout"
22
+ :onEnd="onEnd"
23
+ :duration="duration"
24
+ ></Sprite>
25
+ </template>
26
+
27
+ <style scoped>
28
+ .bgStyle {
29
+ width: 1280;
30
+ height: 720;
31
+ background-color: #4d5e8c;
32
+ }
33
+ </style>
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <JsvSpriteLoader
3
+ :imageUrl="spriteSrc"
4
+ :configUrl="jsonUrl"
5
+ :onConfigReady="preloadCallback"
6
+ :noNeedResource="false"
7
+ >
8
+ <JsvSpriteAnim
9
+ ref="spriteController"
10
+ :spriteInfo="spriteJsonInfo"
11
+ :loop="repeat"
12
+ :duration="duration"
13
+ :imageUrl="spriteSrc"
14
+ :spriteFrameSize="spriteOriginSize"
15
+ :viewSize="{ w: layout.width, h: layout.height }"
16
+ :onAnimEnd="onAnimEnd"
17
+ :autostart="props.autoStart"
18
+ />
19
+ </JsvSpriteLoader>
20
+ </template>
21
+
22
+ <script setup>
23
+ import { computed, shallowRef, onMounted, watch } from "vue";
24
+ import { JsvSpriteAnim, JsvSpriteLoader, JsvSpriteTools } from "jsview";
25
+
26
+ const props = defineProps({
27
+ /**
28
+ * 雪碧图资源URL
29
+ * @type {String}
30
+ */
31
+ spriteSrc: {
32
+ type: String,
33
+ },
34
+ /**
35
+ * 动画循环次数
36
+ * -1表示无限循环
37
+ * @type {Number}
38
+ * @default 0
39
+ */
40
+ repeat: {
41
+ type: Number,
42
+ },
43
+ /**
44
+ * 容器尺寸配置
45
+ * @type {Object}
46
+ * @property {number} width - 容器宽度
47
+ * @property {number} height - 容器高度
48
+ */
49
+ layout: {
50
+ type: Object,
51
+ },
52
+ /**
53
+ * 动画结束回调函数
54
+ * @type {Function|undefined}
55
+ */
56
+ onEnd: {
57
+ type: Function,
58
+ },
59
+ /**
60
+ * 动画持续时间(单位:ms)
61
+ * 当设置duration时会覆盖雪碧图原始帧间隔时间
62
+ * @type {Number}
63
+ */
64
+ duration: {
65
+ type: Number,
66
+ },
67
+ /**
68
+ * 是否自动开始动画
69
+ * @type {Boolean}
70
+ * @default true
71
+ */
72
+ autoStart: {
73
+ type: Boolean,
74
+ default: true,
75
+ },
76
+ /**
77
+ * 动画结束帧
78
+ * @type {"start" | "end"}
79
+ */
80
+ endFrame: {
81
+ type: String,
82
+ default: "end",
83
+ },
84
+ });
85
+
86
+ const spriteController = shallowRef();
87
+
88
+ const jsonUrl = computed(() => {
89
+ return props.spriteSrc + ".json";
90
+ });
91
+
92
+ const _formatInfo = (config_json) => {
93
+ const info = {
94
+ frames: [],
95
+ meta: {
96
+ size: config_json.meta.size,
97
+ },
98
+ };
99
+
100
+ let frames_ref = info.frames;
101
+
102
+ for (let i = 0; i < config_json.frames.length; i++) {
103
+ const target = config_json.frames[i].spriteSourceSize;
104
+ frames_ref.push({
105
+ target,
106
+ source: config_json.frames[i].frame,
107
+ });
108
+ }
109
+
110
+ return { info };
111
+ };
112
+
113
+ /**
114
+ * 动画结束处理函数
115
+ * 隐藏组件并触发外部回调
116
+ */
117
+ function onAnimEnd() {
118
+ props.onEnd?.();
119
+ }
120
+
121
+ const spriteJsonInfo = shallowRef();
122
+ const spriteOriginSize = shallowRef();
123
+ const preloadCallback = (config_json, resolve_set) => {
124
+ spriteJsonInfo.value = _formatInfo(config_json).info;
125
+
126
+ // 调整设置的原图尺寸设置
127
+ const guessSize = JsvSpriteTools.guessOriginSize(spriteJsonInfo.value);
128
+ spriteOriginSize.value = guessSize;
129
+ resolve_set(); // 通知loader数组设置完成
130
+ };
131
+
132
+ watch(spriteController, (value) => {
133
+ if (value) {
134
+ if (props.autoStart) {
135
+ value.start("all", props.endFrame, props.duration, props.repeat);
136
+ }
137
+ }
138
+ });
139
+
140
+ defineExpose({
141
+ play: () => {
142
+ spriteController.value.start("all", "end", props.duration, props.repeat);
143
+ },
144
+ });
145
+
146
+ onMounted(() => {});
147
+ </script>