@shijiu/jsview-vue-samples 2.2.128 → 2.2.373

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 (105) hide show
  1. package/BakeViewDemo/App.vue +6 -1
  2. package/Basic/components/anim/AnimEasingCubicBezier.vue +56 -0
  3. package/Basic/components/anim/AnimGroup2.vue +33 -0
  4. package/Basic/components/panel/Panel2.vue +8 -3
  5. package/CoupletsTest/widget/Banger/Maroon.vue +4 -7
  6. package/CoupletsTest/widget/Fireworks/Fireworks.vue +52 -44
  7. package/CustomShader/App.vue +174 -0
  8. package/CustomShader/gaussianBlur.glsl +27 -0
  9. package/CustomShader/pageFlip.glsl +41 -0
  10. package/CustomShader/sdf.glsl +22 -0
  11. package/CustomShader/test.glsl +8 -0
  12. package/CustomShader/vortex.glsl +38 -0
  13. package/DemoHomepage/App.vue +50 -32
  14. package/DemoHomepage/components/Item.vue +23 -12
  15. package/DemoHomepage/index.d.ts +5 -2
  16. package/DemoHomepage/router.js +105 -72
  17. package/DispersedFocusControl/App.vue +67 -0
  18. package/DispersedFocusControl/Button.vue +76 -0
  19. package/DispersedFocusControl/data.js +44 -0
  20. package/DragBox/App.vue +148 -0
  21. package/DriftScopeTest/App.vue +128 -0
  22. package/FlexCellDemo/App.vue +47 -223
  23. package/FlexCellDemo/TestFrame1.vue +88 -0
  24. package/FlexCellDemo/TestFrame2.vue +100 -0
  25. package/FlexCellDemo/TestFrame3.vue +97 -0
  26. package/FlexCellDemo/TestFrame4.vue +60 -0
  27. package/FlexCellDemo/TestFrame5.vue +60 -0
  28. package/FlexCellDemo/images/6.jpg +0 -0
  29. package/FocusMoveStyle/App.vue +1 -0
  30. package/FocusMoveStyle/CreepFocus.vue +11 -1
  31. package/FocusMoveStyle/FoldableItem.vue +1 -1
  32. package/FreeMove/App.vue +62 -64
  33. package/FreeMoveLink/App.vue +2 -2
  34. package/FullScreenFlex/App.vue +42 -0
  35. package/FullScreenFlex/TestFrame2.vue +107 -0
  36. package/FullScreenFlex/images/1.png +0 -0
  37. package/HashHistory/App.vue +8 -4
  38. package/ImpactStop/App.vue +45 -45
  39. package/Input/App.vue +184 -97
  40. package/Input/InputPanel.vue +98 -82
  41. package/LatexFormula/App.vue +97 -10
  42. package/LongImage/App.vue +1 -2
  43. package/LongText/App.vue +2 -2
  44. package/LongText/LongTextScroll.vue +22 -22
  45. package/LongText/Scroll.vue +28 -9
  46. package/MetroWidgetDemos/RefreshDemo/App.vue +172 -56
  47. package/MetroWidgetDemos/RefreshDemo/ControlItem.vue +45 -0
  48. package/MetroWidgetDemos/RefreshDemo/Item.vue +20 -4
  49. package/MetroWidgetDemos/itemSizeUpdate/backward/Item.vue +1 -1
  50. package/MetroWidgetDemos/routeList.js +17 -17
  51. package/MindMap/App.vue +10 -1
  52. package/MindMap/data.js +34 -8
  53. package/Parkour/appConfig/jsview.config.mjs +0 -4
  54. package/PosterPacker/App.vue +207 -0
  55. package/PosterPacker/images/bg.jpg +0 -0
  56. package/PosterPacker/images/blue.png +0 -0
  57. package/PosterPacker/images/darkGreen.png +0 -0
  58. package/PosterPacker/images/left.png +0 -0
  59. package/PosterPacker/images/orange.png +0 -0
  60. package/PosterPacker/images/pink.png +0 -0
  61. package/PosterPacker/images/purple.png +0 -0
  62. package/PosterPacker/images/red.png +0 -0
  63. package/PosterPacker/images/right.png +0 -0
  64. package/PosterPacker/images/yellowGreen.png +0 -0
  65. package/PosterPacker/tools/geniePakcer/Genie.vue +686 -0
  66. package/PosterPacker/tools/geniePakcer/genieBottom.glsl +49 -0
  67. package/PosterPacker/tools/geniePakcer/genieLeft.glsl +50 -0
  68. package/PosterPacker/tools/geniePakcer/genieRight.glsl +57 -0
  69. package/PosterPacker/tools/geniePakcer/genieTop.glsl +50 -0
  70. package/PosterPacker/tools/particlePacker/Particle.vue +71 -0
  71. package/PosterPacker/tools/vortexPacker/Vortex.vue +135 -0
  72. package/PosterPacker/tools/vortexPacker/vortex.glsl +37 -0
  73. package/Preload/App.vue +1 -1
  74. package/SceneTransition/JsvSceneTransition.vue +30 -42
  75. package/ScrollBoxTest/App.vue +35 -86
  76. package/ScrollBoxTest/ClipBar.vue +154 -0
  77. package/ScrollBoxTest/DrawCircle.ts +25 -0
  78. package/ScrollBoxTest/NinePatchBar.vue +188 -0
  79. package/ScrollBoxTest/NoBackgroundBar.vue +125 -0
  80. package/ScrollBoxTest/SizeDivBar.vue +139 -0
  81. package/SprayMove/App.vue +75 -0
  82. package/SprayMove/SprayMove.vue +173 -0
  83. package/SprayView/App.vue +8 -9
  84. package/TestNativeSharedView/App.vue +6 -4
  85. package/TextShadowDemo/App.vue +3 -3
  86. package/TextureAnimation/App.vue +244 -148
  87. package/TextureAnimation/App2.vue +66 -14
  88. package/TextureAnimation/assets/blackWhiteTurntable.png +0 -0
  89. package/TextureAnimation/assets/circleHaloMask.png +0 -0
  90. package/TombSweepingDayTest/Raining/Rain.vue +8 -8
  91. package/TouchWidget/App.vue +79 -40
  92. package/TouchWidget/Item.vue +15 -3
  93. package/index.d.ts +1 -1
  94. package/package.json +1 -1
  95. package/MetroWidgetDemos/RefreshDemo/data.js +0 -16
  96. package/TextureAnimation/assets/mask.png +0 -0
  97. package/TextureAnimation/assets/php.jpg +0 -0
  98. package/TouchSample/App.vue +0 -136
  99. package/TouchSample/Item.vue +0 -102
  100. package/TouchSample/MetroWidgetHorizontal.vue +0 -144
  101. package/TouchSample/MetroWidgetVertical.vue +0 -144
  102. package/TouchSample/TouchContainerHorizontal.vue +0 -160
  103. package/TouchSample/TouchContainerVertical.vue +0 -160
  104. package/TouchSample/data.js +0 -81
  105. /package/TextureAnimation/assets/{php2.png → borderOpacity.png} +0 -0
@@ -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,71 @@
1
+ <script setup>
2
+ /**
3
+ * @file Particle组件说明
4
+ * Particle:粒子装饰组件
5
+ * props说明:
6
+ * @prop {Object} style (必填) 组件的基础样式
7
+ * @prop {Array<String>} imgArray (必填) 传入的粒子数组,每个item是图片的url
8
+ *
9
+ */
10
+ import { JsvSpray } from "jsview";
11
+
12
+ const props = defineProps({
13
+ style: { type: Object, require: true },
14
+ imgArray: { type: Array,require: true},
15
+ });
16
+ //粒子图片数组
17
+ const ImgData = [];
18
+ //检查传入的imgArray格式
19
+ if (props.imgArray !== undefined) {
20
+ if (Array.isArray(props.imgArray)) {
21
+ props.imgArray.forEach((item, index) => {
22
+ ImgData.push(item);
23
+ });
24
+ } else {
25
+ console.warn("请传入正确的数组格式");
26
+ }
27
+ } else {
28
+ console.error("请传入图片数组");
29
+ }
30
+ //粒子特效配置
31
+ const sprayOk = {
32
+ type: 1,
33
+ particleNum: 5,
34
+ deltaAngle: 0,
35
+ deltaWidth: props.style.width / 2,
36
+ deltaHeight: 1,
37
+ pointSizeMin: 20,
38
+ pointSizeMax: 30,
39
+ speedMin: -3,
40
+ speedMax: -5,
41
+ lifeMin: 1500,
42
+ lifeMax: 3000,
43
+ accelerateX: 0,
44
+ accelerateY: 0,
45
+ particleAddSpeed: 0.002,
46
+ angularVelocityMin: 10,
47
+ angularVelocityMax: 15,
48
+ enableFade: false,
49
+ enableShrink: false,
50
+ };
51
+ </script>
52
+ <template>
53
+ <div
54
+ :style="{
55
+ width: props.style.width,
56
+ height: props.style.height,
57
+ left: props.style.left,
58
+ top: props.style.top,
59
+ overflow: 'hidden',
60
+ }"
61
+ >
62
+ <jsv-spray
63
+ v-for="item in ImgData"
64
+ :key="`item_${item}`"
65
+ :pointRes="`url(${item})`"
66
+ :sprayStyle="sprayOk"
67
+ :ignoreClip="false"
68
+ />
69
+ </div>
70
+ </template>
71
+ <style scoped></style>
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <div :key="keyNum">
3
+ <jsv-frag-shader-view
4
+ ref="rWidgetRef"
5
+ :style="{ left: 100, top: 200, width: props.width, height: props.height }"
6
+ :duration="rShaderInfo.duration"
7
+ :shaderStr="rShaderInfo.shader.value"
8
+ :autoplay="true"
9
+ :textures="rShaderInfo.textures"
10
+ :onEnd="rShaderInfo.onEnd"
11
+ >
12
+ </jsv-frag-shader-view>
13
+ <div
14
+ :style="{
15
+ width: props.width,
16
+ height: props.height,
17
+ left: 100,
18
+ top: 200,
19
+ }"
20
+ >
21
+ <div
22
+ :style="{
23
+ width: 50,
24
+ height: 50,
25
+ left: myX * props.width - 25,
26
+ top: props.height - (myY * props.height + 25),
27
+ backgroundColor: '#FF1213',
28
+ }"
29
+ ></div>
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script setup>
35
+ import vortexShader from "./vortex.glsl?raw";
36
+ import { shallowRef, computed, onMounted, onUnmounted } from "vue";
37
+ import { JsvFragShaderView } from "jsview";
38
+ const props = defineProps({
39
+ width: { type: Number, require: true },
40
+ height: { type: Number, require: true },
41
+ imgUrl: { type: String, require: true },
42
+ left: { type: Number, default: 0 },
43
+ top: { type: Number, default: 0 },
44
+ });
45
+ //图片
46
+ const ImagePanda = "https://oss.image.qcast.cn/ai-draw/panda.jpeg";
47
+ //0-1的x和y的坐标值(初始为x和y的中心点)
48
+ let myX = 0.5;
49
+ let myY = 0.5;
50
+ let keyNum = shallowRef(0);
51
+ //ref
52
+ const rWidgetRef = shallowRef();
53
+ let vSTRENGTH = '10.'
54
+ //替换
55
+ let replacedShader = shallowRef(
56
+ vortexShader
57
+ .replace(/\$\{myCustomCenterX\}/g, myX)
58
+ .replace(/\$\{myCustomCenterY\}/g, myY)
59
+ .replace(/\$\{STRENGTH\}/g, vSTRENGTH)
60
+ );
61
+ console.log(9998,vortexShader);
62
+
63
+ //随机替换
64
+ const getRandomDecimal = () => {
65
+ myX = 0.9;
66
+ myY = 0.1;
67
+ //根据x轴的位置确定转数
68
+ if(myX>=0.8||myX<=0.2){
69
+ console.log('很小或很大');
70
+ vSTRENGTH = '40.'
71
+ }else if(myX>0.2<=0.4){
72
+ vSTRENGTH = '30.'
73
+ }else if(myX >=0.6 && myX < 0.8 ){
74
+ vSTRENGTH = '30.'
75
+ }else if(myX>0.4 && myX<0.6){
76
+ vSTRENGTH = '10.'
77
+ }
78
+
79
+ replacedShader.value = vortexShader
80
+ .replace(/\$\{myCustomCenterX\}/g, myX)
81
+ .replace(/\$\{myCustomCenterY\}/g, myY)
82
+ .replace(/\$\{STRENGTH\}/g, vSTRENGTH)
83
+ keyNum.value += 1;
84
+ };
85
+ //接收外部设定中心点
86
+ const SetCenter = (x, y) => {
87
+ myX = x;
88
+ myY = y;
89
+ replacedShader.value = vortexShader
90
+ .replace(/\$\{myCustomCenterX\}/g, myX)
91
+ .replace(/\$\{myCustomCenterY\}/g, myY);
92
+ keyNum.value += 1;
93
+ };
94
+ //重新加载动画
95
+ const reloading1 = () => {
96
+ rWidgetRef.value?.startAnim();
97
+ };
98
+ const rShowShaderView = shallowRef(true);
99
+ //配置
100
+ const cShaderSettings = {
101
+ name: "vortex",
102
+ shader: replacedShader,
103
+ uniforms: [],
104
+ textures: [
105
+ {
106
+ name: "iChannel0",
107
+ resource: ImagePanda,
108
+ },
109
+ ],
110
+ duration: 3000,
111
+ onEnd: () => {
112
+ console.log("flip anim end");
113
+ rShowShaderView.value = false;
114
+ },
115
+ };
116
+
117
+ const rShaderInfo = computed(() => {
118
+ return cShaderSettings;
119
+ });
120
+ onMounted(() => {
121
+ window.JsView?.enableFpsDisplay(true);
122
+ });
123
+
124
+ onUnmounted(() => {
125
+ window.JsView?.enableFpsDisplay(false);
126
+ });
127
+ //向父组件暴露方法
128
+ defineExpose({
129
+ getRandomDecimal,
130
+ reloading1,
131
+ SetCenter,
132
+ });
133
+ </script>
134
+
135
+ <style lang="scss" scoped></style>
@@ -0,0 +1,37 @@
1
+ #define RANGE 6.
2
+ #define SPEED .5
3
+
4
+ mat2 rotate(float a) {
5
+ float s = sin(a);
6
+ float c = cos(a);
7
+ return mat2(c, -s, s, c);
8
+ }
9
+
10
+ void mainImage(out vec4 fragColor, vec2 coord) {
11
+ /** mediump精度10bit, 直接使用0-1的uv, 小值的normalize()会有精度问题, 导致异常大的结果; 但乘1920x1080又会有大值的问题, 所以选取16x9 */
12
+ vec2 aspect = (iResolution.xy / iResolution.y) * 9.;
13
+ vec2 center = vec2(${myCustomCenterX}, ${myCustomCenterY}) * aspect;
14
+
15
+ vec2 uv = coord / iResolution.xy * aspect;
16
+ uv -= center;
17
+
18
+ float d = length(uv);
19
+ float progress = sin(iTime * SPEED);
20
+
21
+ //vortex
22
+ float cTime = ${STRENGTH} * progress;
23
+ d = smoothstep(0., RANGE, RANGE - d) * cTime;
24
+ uv *= rotate(d);
25
+
26
+
27
+ float edge = aspect.y * abs(progress);
28
+ uv = uv + normalize(uv) * edge;
29
+
30
+ uv += center;
31
+ uv /= aspect;
32
+ if(uv.x > 1. || uv.y > 1. || uv.x < 0. || uv.y < 0.) {
33
+ fragColor = vec4(0.0, 0.5, 0.6, 1.);
34
+ } else {
35
+ fragColor = jsvTexture2D(iChannel0, uv);
36
+ }
37
+ }
package/Preload/App.vue CHANGED
@@ -131,7 +131,7 @@ setTimeout(() => {
131
131
  :style="{
132
132
  left: 100,
133
133
  top: 350,
134
- width: 800,
134
+ width: 1000,
135
135
  height: 800,
136
136
  fontSize: 30,
137
137
  color: '#000000',
@@ -98,61 +98,49 @@ const randomSelect = () => {
98
98
  const sag = () => {
99
99
  centerItemArray.forEach((item, index) => {
100
100
  if (center.x - item.x <= Math.abs(60)) {
101
- controlArray[index].run([
102
- controlArray[index]
103
- .action()
104
- .setSpdAndAccel(16, randomSelect(), 0, 15, null, null),
105
- controlArray[index]
101
+ controlArray[index].run((cmds) => [
102
+ cmds.action().setSpdAndAccel(16, randomSelect(), 0, 15, null, null),
103
+ cmds
106
104
  .condition()
107
105
  .reachPosition(undefined, 1380)
108
- .then([controlArray[index].action().stopMoving()]),
106
+ .then([cmds.action().stopMoving()]),
109
107
  ]);
110
108
  } else if (center.x - item.x <= 200) {
111
- controlArray[index].run([
112
- controlArray[index]
113
- .action()
114
- .setSpdAndAccel(8, randomSelect(), 0, 15, null, null),
115
- controlArray[index]
109
+ controlArray[index].run((cmds) => [
110
+ cmds.action().setSpdAndAccel(8, randomSelect(), 0, 15, null, null),
111
+ cmds
116
112
  .condition()
117
113
  .reachPosition(undefined, 1380)
118
- .then([controlArray[index].action().stopMoving()]),
114
+ .then([cmds.action().stopMoving()]),
119
115
  ]);
120
116
  } else if (center.x - item.x <= 500) {
121
- controlArray[index].run([
122
- controlArray[index]
123
- .action()
124
- .setSpdAndAccel(-8, randomSelect(), 0, 15, null, null),
125
- controlArray[index]
117
+ controlArray[index].run((cmds) => [
118
+ cmds.action().setSpdAndAccel(-8, randomSelect(), 0, 15, null, null),
119
+ cmds
126
120
  .condition()
127
121
  .reachPosition(undefined, 1380)
128
- .then([controlArray[index].action().stopMoving()]),
122
+ .then([cmds.action().stopMoving()]),
129
123
  ]);
130
124
  } else if (center.x - item.x > 500) {
131
- controlArray[index].run([
132
- controlArray[index]
133
- .action()
134
- .setSpdAndAccel(-16, randomSelect(), 0, 15, null, null),
135
- controlArray[index]
125
+ controlArray[index].run((cmds) => [
126
+ cmds.action().setSpdAndAccel(-16, randomSelect(), 0, 15, null, null),
127
+ cmds
136
128
  .condition()
137
129
  .reachPosition(undefined, 1380)
138
- .then([controlArray[index].action().stopMoving()]),
130
+ .then([cmds.action().stopMoving()]),
139
131
  ]);
140
132
  } else if (center.x - item.x < -60) {
141
- controlArray[index].run([
142
- controlArray[index]
143
- .action()
144
- .setSpdAndAccel(20, randomSelect(), 0, 15, null, null),
145
- controlArray[index]
133
+ controlArray[index].run((cmds) => [
134
+ cmds.action().setSpdAndAccel(20, randomSelect(), 0, 15, null, null),
135
+ cmds
146
136
  .condition()
147
137
  .reachPosition(undefined, 1380)
148
- .then([
149
- controlArray[index].action().stopMoving(),
150
- ]),
138
+ .then([cmds.action().stopMoving()]),
151
139
  ]);
152
140
  }
153
141
  //给所有运动物体创建onNexusEvent条件以便召回
154
- controlArray[index].run([
155
- controlArray[index]
142
+ controlArray[index].run((cmds) => [
143
+ cmds
156
144
  .condition()
157
145
  .onNexusEvent(interactNexus, 1001 + index)
158
146
  .then([
@@ -171,16 +159,16 @@ const sag = () => {
171
159
 
172
160
  const fireNeEvent = () => {
173
161
  controlArray.forEach((item, index) => {
174
- item.run([
175
- item.action().stopMoving(),
176
- item.state().fireNexusEvent(interactNexus, 1001 + index),
162
+ item.run((cmds) => [
163
+ cmds.action().stopMoving(),
164
+ cmds.state().fireNexusEvent(interactNexus, 1001 + index),
177
165
  ]);
178
166
  });
179
167
  };
180
168
  //往回恢复的函数
181
169
  const recover = (index) => {
182
- controlArray[index].run([
183
- controlArray[index]
170
+ controlArray[index].run((cmds) => [
171
+ cmds
184
172
  .action()
185
173
  .moveTo(
186
174
  0,
@@ -189,9 +177,9 @@ const recover = (index) => {
189
177
  Math.abs(recallArray[index].y),
190
178
  recallArray[index].y / 15,
191
179
  () => {
192
- controlArray[index].run([
193
- controlArray[index].action().teleportTo(0, 0),
194
- controlArray[index].state().clearAllConditions(),
180
+ controlArray[index].run((cmds) => [
181
+ cmds.action().teleportTo(0, 0),
182
+ cmds.state().clearAllConditions(),
195
183
  ]);
196
184
  }
197
185
  ),