@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,49 @@
1
+ #define VTIME 0.3
2
+
3
+ float yPoint(float y0, float y1, float x) {
4
+ float a = 2. * (y0 - y1);
5
+ float b = 3. * (y1 - y0);
6
+ float d = y0;
7
+ return a * x * x * x + b * x * x + d;
8
+ }
9
+
10
+ float remap2(float uv, float inputLow, float inputHigh, float outputLow, float outputHigh){
11
+ float t = (uv - inputLow)/(inputHigh - inputLow);
12
+ float final = mix(outputLow,outputHigh,t);
13
+ return final;
14
+ }
15
+
16
+ void mainImage( out vec4 fragColor, in vec2 fragCoord )
17
+ {
18
+ // Normalized pixel coordinates (from 0 to 1)
19
+ vec2 uv = fragCoord/iResolution.xy;
20
+ float t = ${myTime} ;
21
+ // float t = abs(sin(iTime));
22
+ //v animation
23
+ if (t < VTIME) {
24
+ float vAnimP = (t) / VTIME;
25
+ float top = mix(1.0, ${RANGE_1}, vAnimP);
26
+ float bottom = mix(0.0, ${RANGE_2}, vAnimP);
27
+ float xTop = yPoint(top, 1., uv.y); // Swap uv.x with uv.y
28
+ float xBottom = yPoint(bottom, 0., uv.y); // Swap uv.x with uv.y
29
+ float newUvX = remap2(uv.x, xBottom, xTop, 0.0, 1.0); // Swap uv.x with uv.y
30
+ if (newUvX > 1. || newUvX < 0.) {
31
+ fragColor = vec4(0.);
32
+ } else {
33
+ fragColor = jsvTexture2D(iChannel0, vec2(newUvX, uv.y));
34
+ }
35
+ } else {
36
+ //h animation
37
+ float xTop = yPoint(${RANGE_1}, 1., uv.y); // Swap uv.x with uv.y
38
+ float xBottom = yPoint(${RANGE_2}, 0., uv.y); // Swap uv.x with uv.y
39
+ float newUvX = remap2(uv.x, xBottom, xTop, 0.0, 1.0); // Swap uv.x with uv.y
40
+ float hAnimP = (t - VTIME) / (1. - VTIME);
41
+ float yStart = mix(0., 1., hAnimP); // Calculate the vertical shift
42
+ float newUvY = uv.y + yStart; // Adjust the y-coordinate
43
+ if (newUvX > 1. || newUvX < 0. || newUvY > 1. || newUvY < 0.) {
44
+ fragColor = vec4(0.);
45
+ } else {
46
+ fragColor = jsvTexture2D(iChannel0, vec2(newUvX, newUvY));
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,50 @@
1
+ #define VTIME 0.3
2
+
3
+ float yPoint(float y0, float y1, float x) {
4
+ float a = 2. * (y0 - y1);
5
+ float b = 3. * (y1 - y0);
6
+ //float c. = 0.;
7
+ float d = y0;
8
+ return a * x * x * x + b * x * x + d;
9
+ }
10
+
11
+ float remap2(float uv, float inputLow, float inputHigh, float outputLow, float outputHigh){
12
+ float t = (uv - inputLow)/(inputHigh - inputLow);
13
+ float final = mix(outputLow,outputHigh,t);
14
+ return final;
15
+ }
16
+
17
+ void mainImage( out vec4 fragColor, in vec2 fragCoord )
18
+ {
19
+ // Normalized pixel coordinates (from 0 to 1)
20
+ vec2 uv = fragCoord/iResolution.xy;
21
+ float t = ${myTime} ;
22
+ // float t = abs(sin(iTime));
23
+ //v animation
24
+ if (t < VTIME) {
25
+ float vAnimP = (t) / VTIME;
26
+ float top = mix(1.0, ${RANGE_1}, vAnimP);
27
+ float bottom = mix(0.0, ${RANGE_2}, vAnimP);
28
+ float yTop = yPoint(top, 1., uv.x);
29
+ float yBottom = yPoint(bottom, 0., uv.x);
30
+ float newUvY = remap2(uv.y, yBottom, yTop, 0.0, 1.0);
31
+ if (newUvY > 1. || newUvY < 0.) {
32
+ fragColor = vec4(0.);
33
+ } else {
34
+ fragColor = jsvTexture2D(iChannel0, vec2(uv.x, newUvY));
35
+ }
36
+ } else {
37
+ //h animation
38
+ float yTop = yPoint(${RANGE_1}, 1., uv.x);
39
+ float yBottom = yPoint(${RANGE_2}, 0., uv.x);
40
+ float newUvY = remap2(uv.y, yBottom, yTop, 0.0, 1.0);
41
+ float hAnimP = (t - VTIME) / (1. - VTIME);
42
+ float xStart = mix(0., 1., hAnimP);
43
+ float newUvX = uv.x + xStart;
44
+ if (newUvY > 1. || newUvY < 0. || newUvX > 1. || newUvY < 0.) {
45
+ fragColor = vec4(0.);
46
+ } else {
47
+ fragColor = jsvTexture2D(iChannel0, vec2(newUvX, newUvY));
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,57 @@
1
+ #define VTIME 0.3
2
+
3
+ float yPoint(float y0, float y1, float x) {
4
+ float a = 2. * (y1 - y0); // 交换 y0 和 y1
5
+ float b = 3. * (y0 - y1);
6
+ float d = y1; // 交换 y0 和 y1
7
+ return a * x * x * x + b * x * x + d;
8
+ }
9
+
10
+ float remap2(float uv, float inputLow, float inputHigh, float outputLow, float outputHigh){
11
+ float t = (uv - inputLow)/(inputHigh - inputLow);
12
+ float final = mix(outputLow,outputHigh,t);
13
+ return final;
14
+ }
15
+
16
+ void mainImage( out vec4 fragColor, in vec2 fragCoord )
17
+ {
18
+ // Normalized pixel coordinates (from 0 to 1)
19
+ vec2 uv = fragCoord/iResolution.xy;
20
+ float t = ${myTime} ;
21
+ // float t = abs(sin(iTime));
22
+ //v animation
23
+ if (t < VTIME) {
24
+ // 垂直动画
25
+ float vAnimP = (t) / VTIME;
26
+ float top = mix(1.0, ${RANGE_1}, vAnimP);
27
+ float bottom = mix(0.0, ${RANGE_2}, vAnimP);
28
+ float yTop = yPoint(top, 1., uv.x);
29
+ float yBottom = yPoint(bottom, 0., uv.x);
30
+ float newUvY = remap2(uv.y, yBottom, yTop, 0.0, 1.0);
31
+ if (newUvY > 1. || newUvY < 0.) {
32
+ fragColor = vec4(0.);
33
+ } else {
34
+ fragColor = jsvTexture2D(iChannel0, vec2(uv.x, newUvY));
35
+ }
36
+ } else {
37
+ // 水平动画
38
+ float yTop = yPoint(${RANGE_1}, 1., uv.x);
39
+ float yBottom = yPoint(${RANGE_2}, 0., uv.x);
40
+ float newUvY = remap2(uv.y, yBottom, yTop, 0.0, 1.0);
41
+
42
+ // 水平收缩动画的进度
43
+ float hAnimP = (t - VTIME) / (1. - VTIME);
44
+
45
+ // 从左到右收缩效果,xStart 从 0 渐变到 1
46
+ float xStart = mix(0., 1., hAnimP);
47
+
48
+ // 计算新的 UV X
49
+ float newUvX = uv.x - xStart;
50
+ // 确保 newUvX 和 newUvY 在合法范围内
51
+ if (newUvY > 1. || newUvY < 0. || newUvX > 1. || newUvX < 0.) {
52
+ fragColor = vec4(0.);
53
+ } else {
54
+ fragColor = jsvTexture2D(iChannel0, vec2(newUvX, newUvY));
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,50 @@
1
+ #define VTIME 0.3
2
+
3
+
4
+ float yPoint(float y0, float y1, float x) {
5
+ float a = 2. * (y1 - y0);
6
+ float b = 3. * (y0 - y1);
7
+ float d = y1;
8
+ return a * x * x * x + b * x * x + d;
9
+ }
10
+
11
+ float remap2(float uv, float inputLow, float inputHigh, float outputLow, float outputHigh){
12
+ float t = (uv - inputLow)/(inputHigh - inputLow);
13
+ float final = mix(outputLow, outputHigh, t);
14
+ return final;
15
+ }
16
+
17
+ void mainImage( out vec4 fragColor, in vec2 fragCoord )
18
+ {
19
+ // Normalized pixel coordinates (from 0 to 1)
20
+ vec2 uv = fragCoord/iResolution.xy;
21
+ float t = ${myTime} ;
22
+ // float t = abs(sin(iTime));
23
+ //v animation
24
+ if (t < VTIME) {
25
+ float vAnimP = (t) / VTIME;
26
+ float top = mix(1.0, ${RANGE_1}, vAnimP);
27
+ float bottom = mix(0.0, ${RANGE_2}, vAnimP);
28
+ float xTop = yPoint(top, 1., uv.y);
29
+ float xBottom = yPoint(bottom, 0., uv.y);
30
+ float newUvX = remap2(uv.x, xBottom, xTop, 0.0, 1.0);
31
+ if (newUvX > 1. || newUvX < 0.) {
32
+ fragColor = vec4(0.);
33
+ } else {
34
+ fragColor = jsvTexture2D(iChannel0, vec2(newUvX, uv.y));
35
+ }
36
+ } else {
37
+ //h animation
38
+ float xTop = yPoint(${RANGE_1}, 1., uv.y);
39
+ float xBottom = yPoint(${RANGE_2}, 0., uv.y);
40
+ float newUvX = remap2(uv.x, xBottom, xTop, 0.0, 1.0);
41
+ float hAnimP = (t - VTIME) / (1. - VTIME);
42
+ float yStart = mix(0., 1., hAnimP); // Calculate the vertical shift
43
+ float newUvY = uv.y - yStart; // Adjust the y-coordinate for downward animation
44
+ if (newUvX > 1. || newUvX < 0. || newUvY > 1. || newUvY < 0.) {
45
+ fragColor = vec4(0.);
46
+ } else {
47
+ fragColor = jsvTexture2D(iChannel0, vec2(newUvX, newUvY));
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <jsv-focus-block autoFocus :onAction="{ onKeyDown }"></jsv-focus-block>
3
+ <gray-filter
4
+ :open="openFilter"
5
+ :left="50"
6
+ :top="50"
7
+ :width="400"
8
+ :height="400"
9
+ >
10
+ <div
11
+ :style="{
12
+ width: 400,
13
+ height: 400,
14
+ backgroundColor: '#00ffff',
15
+ }"
16
+ >
17
+ <img
18
+ :src="`url(${imageUrl})`"
19
+ :style="{
20
+ width: 300,
21
+ height: 300,
22
+ }"
23
+ />
24
+ <div
25
+ :style="{
26
+ top: 320,
27
+ width: 300,
28
+ height: 100,
29
+ color: '#ff0000',
30
+ fontSize: 30,
31
+ }"
32
+ >
33
+ 按OK键切换
34
+ </div>
35
+ </div>
36
+ </gray-filter>
37
+ </template>
38
+ <script setup>
39
+ import GrayFilter from "./GrayFilter.vue";
40
+ import { ref } from "vue";
41
+
42
+ const imageUrl = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/GrayFilter/App/jpegDemo.jpeg";
43
+ const openFilter = ref(false);
44
+ const onKeyDown = (ev) => {
45
+ if (ev.keyCode == 13) {
46
+ openFilter.value = !openFilter.value;
47
+ return true;
48
+ }
49
+ return false;
50
+ };
51
+ </script>
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <jsv-filter-view :left="left" :top="top" :width="width" :height="height" :filterType="filterType">
3
+ <slot></slot>
4
+ </jsv-filter-view>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { JsvFilterView } from "jsview";
9
+ import { shallowRef, watchEffect } from "vue";
10
+
11
+ const props = defineProps({
12
+ /**
13
+ * 控制是否开启灰色滤镜
14
+ * @type {Boolean}
15
+ */
16
+ open: {
17
+ type: Boolean,
18
+ },
19
+ /**
20
+ * 组件宽度
21
+ * @type {Number}
22
+ */
23
+ width: {
24
+ type: Number,
25
+ },
26
+ /**
27
+ * 组件高度
28
+ * @type {Number}
29
+ */
30
+ height: {
31
+ type: Number,
32
+ },
33
+ /**
34
+ * 距离左侧的位置
35
+ * @type {Number}
36
+ */
37
+ left: {
38
+ type: Number,
39
+ },
40
+ /**
41
+ * 距离顶部的位置
42
+ * @type {Number}
43
+ */
44
+ top: {
45
+ type: Number,
46
+ }
47
+ });
48
+
49
+ const filterType = shallowRef(props.open ? "gray-down" : null);
50
+
51
+ // 监听open属性变化更新滤镜类型
52
+ watchEffect(() => {
53
+ if (props.open) {
54
+ filterType.value = "gray-down";
55
+ } else {
56
+ filterType.value = null;
57
+ }
58
+ });
59
+ </script>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div :style="{width: 1280, height: 720, backgroundColor: '#007788'}"></div>
3
+ <div
4
+ :style="{
5
+ left: 100,
6
+ top: 100,
7
+ }"
8
+ >
9
+ <JigsawFull
10
+ :imgInfo="{ src: imageSrc, width: 654, height: 654 }"
11
+ :strokeSrc="strokeSrc"
12
+ :size="{
13
+ width: 327,
14
+ height: 327,
15
+ }"
16
+ :configUrl="jsonSrc"
17
+ :displaySetting="[1, 0, 1, 1]"
18
+ />
19
+ </div>
20
+
21
+ <div
22
+ :style="{
23
+ left: 300,
24
+ top: 100,
25
+ }"
26
+ >
27
+ <JigsawSingle
28
+ :imgInfo="{ src: imageSrc, width: 654, height: 654 }"
29
+ :size="{
30
+ width: 327,
31
+ height: 327,
32
+ }"
33
+ :configUrl="jsonSrc"
34
+ :pieceIndex="1"
35
+ />
36
+ </div>
37
+ </template>
38
+ <script setup>
39
+ import JigsawFull from "./JigsawFull.vue";
40
+ import JigsawSingle from "./JigsawSingle.vue";
41
+
42
+ const jsonSrc = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/Jigsaw/App/config.json";
43
+ const imageSrc = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/Jigsaw/App/php.jpg";
44
+ const strokeSrc = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/Jigsaw/App/stroke.png";
45
+ </script>
@@ -0,0 +1,142 @@
1
+ <template>
2
+ <JsvPreload
3
+ v-if="showPreload"
4
+ :preloadList="preloadList"
5
+ :onPreloadDone="preloadDone"
6
+ ></JsvPreload>
7
+
8
+ <div v-if="showComponent">
9
+ <div v-for="(item, index) in maskConfig">
10
+ <jsv-mask-clip-div
11
+ :key="index"
12
+ v-if="displaySetting[index] == 1"
13
+ :style="{
14
+ top: (item.top * size.width) / imgInfo.width,
15
+ left: (item.left * size.width) / imgInfo.width,
16
+ width: (item.width * size.width) / imgInfo.width,
17
+ height: (item.height * size.width) / imgInfo.width,
18
+ }"
19
+ :viewSrc="imgInfo.src"
20
+ :maskSrc="item.src"
21
+ :maskLeft="item.left / imgInfo.width"
22
+ :maskTop="item.top / imgInfo.height"
23
+ :maskWidth="item.width / imgInfo.width"
24
+ :maskHeight="item.height / imgInfo.height"
25
+ />
26
+ </div>
27
+ </div>
28
+ <img
29
+ :src="strokeSrc"
30
+ :style="{
31
+ width: size.width,
32
+ height: size.height,
33
+ }"
34
+ />
35
+ </template>
36
+
37
+ <script setup>
38
+ import { shallowRef } from "vue";
39
+ import { JsvMaskClipDiv, JsvPreload, buildPreloadInfo } from "jsview";
40
+
41
+ const props = defineProps({
42
+ /**
43
+ * 拼图遮罩配置文件的URL
44
+ * @type {String}
45
+ * @description 配置文件格式:{ pieces: [{file: "", left: 0, top: 0, width: 0, height: 0}] }
46
+ * 注意:mask的图片资源需要和json配置文件放在同目录下
47
+ */
48
+ configUrl: {
49
+ type: String,
50
+ },
51
+
52
+ /**
53
+ * 组件显示尺寸
54
+ * @type {Object}
55
+ * @property {number} width - 组件宽度
56
+ * @property {number} height - 组件高度
57
+ */
58
+ size: {
59
+ type: Object,
60
+ },
61
+
62
+ /**
63
+ * 碎片显示控制数组
64
+ * @type {Array<number>}
65
+ * @description 数组元素值为0表示隐藏对应碎片,1表示显示对应碎片
66
+ * 数组索引对应maskConfig的索引
67
+ */
68
+ displaySetting: {
69
+ type: Array,
70
+ },
71
+
72
+ /**
73
+ * 底图信息
74
+ * @type {Object}
75
+ * @property {string} src - 图片URL
76
+ * @property {number} width - 图片原始宽度
77
+ * @property {number} height - 图片原始高度
78
+ */
79
+ imgInfo: {
80
+ type: Object,
81
+ },
82
+
83
+ /**
84
+ * 描边效果图片URL
85
+ * @type {String}
86
+ */
87
+ strokeSrc: {
88
+ type: String,
89
+ },
90
+ });
91
+ const showPreload = shallowRef(false);
92
+ const showComponent = shallowRef(false);
93
+
94
+ const preloadList = [];
95
+ const maskConfig = [];
96
+
97
+ /**
98
+ * 预加载完成回调
99
+ */
100
+ function preloadDone() {
101
+ showComponent.value = true;
102
+ }
103
+
104
+ /**
105
+ * 准备资源加载
106
+ * @description 执行流程:
107
+ * 1. 加载底图和描边图
108
+ * 2. 获取遮罩配置文件
109
+ * 3. 构建预加载列表
110
+ * 4. 显示预加载组件
111
+ */
112
+ function prepareSrc() {
113
+ preloadList.push(buildPreloadInfo(props.imgInfo.src));
114
+ if (props.strokeSrc) {
115
+ preloadList.push(buildPreloadInfo(props.strokeSrc));
116
+ }
117
+
118
+ fetch(props.configUrl)
119
+ .then((res) => res.json())
120
+ .then((data) => {
121
+ const lastSlashIndex = props.configUrl.lastIndexOf("/");
122
+ const baseUrl = props.configUrl.substring(0, lastSlashIndex + 1);
123
+ for (let i = 0; i < data.pieces.length; i++) {
124
+ const url = baseUrl + data.pieces[i].file;
125
+ preloadList.push(buildPreloadInfo(url));
126
+ maskConfig.push({
127
+ src: url,
128
+ left: data.pieces[i].left,
129
+ top: data.pieces[i].top,
130
+ width: data.pieces[i].width,
131
+ height: data.pieces[i].height,
132
+ });
133
+ }
134
+ showPreload.value = true;
135
+ })
136
+ .catch((err) => {
137
+ console.log("fetch mask config failed", err);
138
+ });
139
+ }
140
+
141
+ prepareSrc();
142
+ </script>
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <JsvPreload
3
+ v-if="showPreload"
4
+ :preloadList="preloadList"
5
+ :onPreloadDone="preloadDone"
6
+ ></JsvPreload>
7
+
8
+ <div v-if="showComponent">
9
+ <jsv-mask-clip-div
10
+ :style="{
11
+ top: (maskConfig.top * size.width) / imgInfo.width,
12
+ left: (maskConfig.left * size.width) / imgInfo.width,
13
+ width: (maskConfig.width * size.width) / imgInfo.width,
14
+ height: (maskConfig.height * size.width) / imgInfo.width,
15
+ }"
16
+ :viewSrc="imgInfo.src"
17
+ :maskSrc="maskConfig.src"
18
+ :maskLeft="maskConfig.left / imgInfo.width"
19
+ :maskTop="maskConfig.top / imgInfo.height"
20
+ :maskWidth="maskConfig.width / imgInfo.width"
21
+ :maskHeight="maskConfig.height / imgInfo.height"
22
+ />
23
+ </div>
24
+ </template>
25
+
26
+ <script setup>
27
+ import { shallowRef } from "vue";
28
+ import { JsvMaskClipDiv, JsvPreload, buildPreloadInfo } from "jsview";
29
+
30
+ /**
31
+ * 拼图单一片组件
32
+ */
33
+ const props = defineProps({
34
+ /**
35
+ * @type {String} 拼图配置文件URL
36
+ * @description 拼图配置文件地址,格式为JSON对象包含pieces数组
37
+ * @example {
38
+ * pieces: [
39
+ * {file: "piece1.png", left: 0, top: 0, width: 100, height: 100}
40
+ * ]
41
+ * }
42
+ */
43
+ configUrl: {
44
+ type: String,
45
+ },
46
+
47
+ /**
48
+ * @type {Number} 当前显示的拼图片索引
49
+ * @description 指定要显示的拼图片在pieces数组中的位置
50
+ * @example 0 表示显示第一个拼图片
51
+ */
52
+ pieceIndex: {
53
+ type: Number,
54
+ },
55
+
56
+ /**
57
+ * @type {Object} 容器尺寸
58
+ * @description 包含width和height属性的对象,用于调整拼图片显示尺寸
59
+ * @example { width: 300, height: 200 }
60
+ */
61
+ size: {
62
+ type: Object,
63
+ },
64
+
65
+ /**
66
+ * @type {Object} 图片信息
67
+ * @description 包含图片源和原始尺寸的对象
68
+ * @example {
69
+ * src: "image.jpg",
70
+ * width: 1920,
71
+ * height: 1080
72
+ * }
73
+ */
74
+ imgInfo: {
75
+ type: Object,
76
+ },
77
+ });
78
+ const showPreload = shallowRef(false);
79
+ const showComponent = shallowRef(false);
80
+
81
+ const preloadList = [];
82
+ let maskConfig = null;
83
+
84
+ function preloadDone() {
85
+ showComponent.value = true;
86
+ }
87
+
88
+ function prepareSrc() {
89
+ preloadList.push(buildPreloadInfo(props.imgInfo.src));
90
+ if (props.strokeSrc) {
91
+ preloadList.push(buildPreloadInfo(props.strokeSrc));
92
+ }
93
+ fetch(props.configUrl)
94
+ .then((res) => res.json())
95
+ .then((data) => {
96
+ const lastSlashIndex = props.configUrl.lastIndexOf("/");
97
+ const baseUrl = props.configUrl.substring(0, lastSlashIndex + 1);
98
+ if (data.pieces[props.pieceIndex]) {
99
+ const url = baseUrl + data.pieces[props.pieceIndex].file;
100
+ preloadList.push(buildPreloadInfo(url));
101
+ maskConfig = {
102
+ src: url,
103
+ left: data.pieces[props.pieceIndex].left,
104
+ top: data.pieces[props.pieceIndex].top,
105
+ width: data.pieces[props.pieceIndex].width,
106
+ height: data.pieces[props.pieceIndex].height,
107
+ };
108
+ showPreload.value = true;
109
+ } else {
110
+ console.error("pieceIndex out of range", data, props.pieceIndex);
111
+ }
112
+ })
113
+ .catch((err) => {
114
+ console.log("fetch mask config failed", err);
115
+ });
116
+ }
117
+ prepareSrc();
118
+ </script>
@@ -0,0 +1,36 @@
1
+ <script setup>
2
+ import { ref } from "vue";
3
+ import LongChat from "./LongChat.vue";
4
+ </script>
5
+
6
+ <template>
7
+ <div
8
+ :style="{
9
+ width: 1280,
10
+ height: 720,
11
+ backgroundColor: '#666',
12
+ }"
13
+ >
14
+ <div
15
+ :style="{
16
+ top: 50,
17
+ width: 1280,
18
+ height: 600,
19
+ overflow: 'hidden',
20
+ }"
21
+ >
22
+ <LongChat />
23
+ </div>
24
+ <div
25
+ :style="{
26
+ width: 1280,
27
+ height: 50,
28
+ backgroundColor: '#666',
29
+ fontSize: 30,
30
+ color: '#fff',
31
+ }"
32
+ >
33
+ 按ok键开始生成, 按上下键滚动
34
+ </div>
35
+ </div>
36
+ </template>