@shijiu/jsview-vue-samples 2.1.367-test.0 → 2.1.435

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 (37) hide show
  1. package/CoupletsTest/App.vue +37 -52
  2. package/CoupletsTest/widget/Fireworks/Fireworks.vue +173 -45
  3. package/DemoHomepage/router.js +21 -5
  4. package/FlexCellDemo/App.vue +315 -0
  5. package/FlexCellDemo/images/1.png +0 -0
  6. package/FlexCellDemo/images/2.png +0 -0
  7. package/FlexCellDemo/images/3.png +0 -0
  8. package/FlexCellDemo/images/4.jpg +0 -0
  9. package/FlexCellDemo/images/5.png +0 -0
  10. package/GradientTexture/App.vue +135 -0
  11. package/ImpactStop/App.vue +1 -1
  12. package/LongText/LongTextScroll.vue +3 -7
  13. package/QrcodeDemo/App.vue +37 -9
  14. package/SceneTransition/App.vue +268 -0
  15. package/SceneTransition/JsvSceneTransition.vue +167 -0
  16. package/SceneTransition/images/mask/1.png +0 -0
  17. package/SceneTransition/images/mask/10.png +0 -0
  18. package/SceneTransition/images/mask/11.png +0 -0
  19. package/SceneTransition/images/mask/12.png +0 -0
  20. package/SceneTransition/images/mask/2.png +0 -0
  21. package/SceneTransition/images/mask/3.png +0 -0
  22. package/SceneTransition/images/mask/4.png +0 -0
  23. package/SceneTransition/images/mask/5.png +0 -0
  24. package/SceneTransition/images/mask/6.png +0 -0
  25. package/SceneTransition/images/mask/7.png +0 -0
  26. package/SceneTransition/images/mask/8.png +0 -0
  27. package/SceneTransition/images/mask/9.png +0 -0
  28. package/SceneTransition/maskConfig/config1.js +101 -0
  29. package/SceneTransition/maskConfig/config2.js +88 -0
  30. package/SceneTransition/maskConfig/config3.js +102 -0
  31. package/SecTorTest/App.vue +145 -23
  32. package/SwiperTest/App.vue +4 -4
  33. package/TextureStoreTest/App.vue +111 -45
  34. package/TouchWidget/App.vue +95 -0
  35. package/TouchWidget/Item.vue +64 -0
  36. package/TouchWidget/WidgetItem.vue +96 -0
  37. package/package.json +1 -1
@@ -0,0 +1,268 @@
1
+ <template>
2
+ <JsvPreload
3
+ :preloadList="preload_info"
4
+ :onPreloadDone="loadDone"
5
+ ></JsvPreload>
6
+ <jsv-focus-block autoFocus :onKeyDown="onKeyDown">
7
+ <div class="bgStyle">
8
+ <div :style="{ width: 640, height: 360, backgroundImage: bg, top: 100 }">
9
+ <JsvSceneTransition
10
+ v-show="isShow"
11
+ :imageUrl="fly1"
12
+ :ArraySet="SelectArray"
13
+ :displayWidth="640"
14
+ :style="style"
15
+ :onOff="onOff"
16
+ ></JsvSceneTransition>
17
+ </div>
18
+ <!-- 文字说明 -->
19
+ <div class="text" :style="{ left: 20, top: 20 }">
20
+ {{ "操作说明:按【OK】键进行随机遮罩层碎片过渡效果。" }}
21
+ </div>
22
+ <div class="text" :style="{ left: 810, top: 20 }">{{ "素材展示" }}</div>
23
+ <div class="text" :style="{ left: 400, top: 500 }">
24
+ {{ "按需采用碎片式的图片来进行遮罩,此例只展示一组遮罩素材。" }}
25
+ </div>
26
+ <!-- 报错小框 -->
27
+ <div v-if="boxSwitch" class="smallBox">
28
+ <div class="text" :style="{ left: 50, top: 40 }">
29
+ {{ "图片没预加载完成!" }}
30
+ </div>
31
+ </div>
32
+ <!-- 素材展示 -->
33
+ <div
34
+ :style="{
35
+ width: 320,
36
+ height: 180,
37
+ backgroundImage: fly1,
38
+ top: 80,
39
+ left: 700,
40
+ }"
41
+ ></div>
42
+ <div
43
+ :style="{
44
+ width: 320,
45
+ height: 180,
46
+ backgroundImage: fly2,
47
+ top: 280,
48
+ left: 700,
49
+ }"
50
+ ></div>
51
+ <div
52
+ :style="{
53
+ width: 100,
54
+ height: 60,
55
+ backgroundImage: ArraySet1[0].url,
56
+ top: 500,
57
+ left: 700,
58
+ }"
59
+ ></div>
60
+ <div
61
+ :style="{
62
+ width: 100,
63
+ height: 60,
64
+ backgroundImage: ArraySet1[1].url,
65
+ top: 500,
66
+ left: 800,
67
+ }"
68
+ ></div>
69
+ <div
70
+ :style="{
71
+ width: 100,
72
+ height: 60,
73
+ backgroundImage: ArraySet1[2].url,
74
+ top: 500,
75
+ left: 920,
76
+ }"
77
+ ></div>
78
+ <div
79
+ :style="{
80
+ width: 100,
81
+ height: 60,
82
+ backgroundImage: ArraySet1[3].url,
83
+ top: 550,
84
+ left: 700,
85
+ }"
86
+ ></div>
87
+ <div
88
+ :style="{
89
+ width: 100,
90
+ height: 60,
91
+ backgroundImage: ArraySet1[4].url,
92
+ top: 550,
93
+ left: 820,
94
+ }"
95
+ ></div>
96
+ <div
97
+ :style="{
98
+ width: 100,
99
+ height: 60,
100
+ backgroundImage: ArraySet1[5].url,
101
+ top: 550,
102
+ left: 920,
103
+ }"
104
+ ></div>
105
+ <div
106
+ :style="{
107
+ width: 100,
108
+ height: 60,
109
+ backgroundImage: ArraySet1[6].url,
110
+ top: 600,
111
+ left: 700,
112
+ }"
113
+ ></div>
114
+ <div
115
+ :style="{
116
+ width: 100,
117
+ height: 60,
118
+ backgroundImage: ArraySet1[7].url,
119
+ top: 600,
120
+ left: 770,
121
+ }"
122
+ ></div>
123
+ <div
124
+ :style="{
125
+ width: 80,
126
+ height: 60,
127
+ backgroundImage: ArraySet1[8].url,
128
+ top: 600,
129
+ left: 860,
130
+ }"
131
+ ></div>
132
+ <div
133
+ :style="{
134
+ width: 60,
135
+ height: 60,
136
+ backgroundImage: ArraySet1[9].url,
137
+ top: 600,
138
+ left: 930,
139
+ }"
140
+ ></div>
141
+ <div
142
+ :style="{
143
+ width: 30,
144
+ height: 30,
145
+ backgroundImage: ArraySet1[10].url,
146
+ top: 590,
147
+ left: 950,
148
+ }"
149
+ ></div>
150
+ <div
151
+ :style="{
152
+ width: 40,
153
+ height: 60,
154
+ backgroundImage: ArraySet1[11].url,
155
+ top: 600,
156
+ left: 980,
157
+ }"
158
+ ></div>
159
+ </div>
160
+ </jsv-focus-block>
161
+ </template>
162
+
163
+ <script setup>
164
+ import { shallowRef, onBeforeUnmount } from "vue";
165
+ import { JsvPreload, buildPreloadInfo } from "jsview";
166
+ import JsvSceneTransition from "./jsvSceneTransition.vue";
167
+ import { ArraySet1 } from "./maskConfig/config1";
168
+ import { ArraySet2 } from "./maskConfig/config2";
169
+ import { ArraySet3 } from "./maskConfig/config3";
170
+
171
+ const fly1 =
172
+ "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/fly1.jpg";
173
+ const fly2 =
174
+ "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/fly2.jpg";
175
+ //预加载数组
176
+ const preload_info = [buildPreloadInfo(fly1), buildPreloadInfo(fly2)];
177
+
178
+ //三个配置数组分别添加自己的图片地址进行预加载
179
+ ArraySet1.forEach((item, index) => {
180
+ preload_info.push(buildPreloadInfo(item.url));
181
+ });
182
+ ArraySet2.forEach((item, index) => {
183
+ preload_info.push(buildPreloadInfo(item.url));
184
+ });
185
+ ArraySet3.forEach((item, index) => {
186
+ preload_info.push(buildPreloadInfo(item.url));
187
+ });
188
+
189
+ //预加载完成标志
190
+ let isDone = shallowRef(false);
191
+ //小框显示标志
192
+ let boxSwitch = shallowRef(false);
193
+ //计时器
194
+ let timer = { id: -1 };
195
+ //预加载完成回调
196
+ const loadDone = () => {
197
+ isDone.value = true;
198
+ };
199
+ const style = { width: 1280, height: 720 };
200
+ let isShow = shallowRef(false);
201
+ let bg = shallowRef(fly1);
202
+ let onOff = shallowRef(false);
203
+
204
+ //随机选择数组
205
+ const randomSelect = () => {
206
+ let randomNum = Math.random();
207
+ if (randomNum <= 0.33) {
208
+ return ArraySet1;
209
+ } else if (randomNum <= 0.66) {
210
+ return ArraySet2;
211
+ } else {
212
+ return ArraySet3;
213
+ }
214
+ };
215
+ const SelectArray = randomSelect();
216
+
217
+ const onKeyDown = (ev) => {
218
+ switch (ev.keyCode) {
219
+ case 13:
220
+ if (isDone.value == true) {
221
+ bg.value = fly2;
222
+ onOff.value = true;
223
+ isShow.value = true;
224
+ } else {
225
+ boxSwitch.value = true;
226
+ timer.id = setTimeout(() => {
227
+ boxSwitch.value = false;
228
+ }, 1000);
229
+ }
230
+
231
+ break;
232
+
233
+ default:
234
+ break;
235
+ }
236
+ };
237
+ //卸载时清除定时器
238
+ onBeforeUnmount(() => {
239
+ if (timer.id) {
240
+ clearTimeout(timer.id);
241
+ timer.id = -1;
242
+ }
243
+ });
244
+ </script>
245
+
246
+ <style scoped>
247
+ .text {
248
+ width: 300;
249
+ height: 80;
250
+ color: #ffffff;
251
+ font-weight: bold;
252
+ line-height: 26;
253
+ font-size: 24;
254
+ }
255
+ .bgStyle {
256
+ width: 1280;
257
+ height: 720;
258
+ background-color: #007788;
259
+ }
260
+ .smallBox {
261
+ width: 300;
262
+ height: 100;
263
+ left: 170;
264
+ top: 230;
265
+ border-radius: 20;
266
+ background-color: #006400;
267
+ }
268
+ </style>
@@ -0,0 +1,167 @@
1
+ <!--
2
+ * 【模块 export 内容】
3
+ * JsvSceneTransition:场景过渡组件。
4
+ * props说明:
5
+ * imageUrl {String} (必填) 显示图片的加载地址
6
+ * displayWidth {Number} (必填) 想要展示的宽度
7
+ * ArraySet {Array} (必填) 模板配置项,包括:每个模块的width,height,left,top,url
8
+ * style {Object} (必填) 模板配置总长度和总宽度。(width,height)
9
+ * onOff {Boolean} (必填) 组件挂载好后是否立即动画的开关,后续可通过改值为true开启。
10
+ -->
11
+
12
+ <template>
13
+ <div
14
+ :style="{
15
+ width: props.style.width,
16
+ height: props.style.height,
17
+ transform: `scale3d(${props.displayWidth / props.style.width},${
18
+ props.displayWidth / props.style.width
19
+ },1)`,
20
+ transformOrigin: 'left top',
21
+ }"
22
+ >
23
+ <jsv-free-move-actor
24
+ v-for="(item, index) in props.ArraySet"
25
+ :ref="(el) => (refArray[index] = el)"
26
+ :top="item.top"
27
+ :left="item.left"
28
+ :width="item.width"
29
+ :height="item.height"
30
+ >
31
+ <jsv-mask-clip-div
32
+ :style="{
33
+ top: 0,
34
+ left: 0,
35
+ width: item.width,
36
+ height: item.height,
37
+ }"
38
+ :viewSrc="props.imageUrl"
39
+ :maskSrc="item.url"
40
+ :maskLeft="item.left / props.style.width"
41
+ :maskTop="item.top / props.style.height"
42
+ :maskWidth="item.width / props.style.width"
43
+ :maskHeight="item.height / props.style.height"
44
+ />
45
+ </jsv-free-move-actor>
46
+ </div>
47
+ </template>
48
+
49
+ <script setup>
50
+ import { JsvMaskClipDiv, JsvFreeMoveActor } from "jsview";
51
+ import { onMounted, watch } from "vue";
52
+
53
+ const props = defineProps({
54
+ imageUrl: { type: String, require: true },
55
+ displayWidth: { type: Number, require: true },
56
+ ArraySet: { type: Array, require: true },
57
+ style: { type: Object, require: true },
58
+ onOff: { type: Boolean, require: true },
59
+ });
60
+ //FreeMove引用
61
+ const refArray = [];
62
+ const controlArray = new Array(props.ArraySet.length).fill(null);
63
+
64
+ //算图的中心点
65
+ const center = {
66
+ x: Math.floor(props.style.width / 2),
67
+ y: Math.floor(props.style.height / 2),
68
+ };
69
+ //算所有遮罩层中心点
70
+ const centerItemArray = [];
71
+ props.ArraySet.forEach((item, index) => {
72
+ const centerX = (item.left + item.width) / 2;
73
+ const centerY = (item.top + item.height) / 2;
74
+ centerItemArray.push({
75
+ x: centerX,
76
+ y: centerY,
77
+ });
78
+ });
79
+
80
+ //监听控制开关的值
81
+ watch(
82
+ () => props.onOff,
83
+ (n, o) => {
84
+ if (n == true) {
85
+ MoveFunc();
86
+ }
87
+ }
88
+ );
89
+ //Y轴方向随机初速度
90
+ const randomYArray = [-60, -70, -80];
91
+ const randomSelect = () => {
92
+ let randomNum = Math.random();
93
+ if (randomNum < 0.33) {
94
+ return randomYArray[0];
95
+ } else if (randomNum < 0.66) {
96
+ return randomYArray[1];
97
+ } else {
98
+ return randomYArray[2];
99
+ }
100
+ };
101
+ //运动函数
102
+ const MoveFunc = () => {
103
+ centerItemArray.forEach((item, index) => {
104
+ if (center.x - item.x <= Math.abs(60)) {
105
+ controlArray[index].run([
106
+ controlArray[index]
107
+ .action()
108
+ .setSpdAndAccel(16, randomSelect(), 0, 15, null, null),
109
+ controlArray[index]
110
+ .condition()
111
+ .reachPosition(undefined, 1380)
112
+ .then([controlArray[index].action().stopMoving()]),
113
+ ]);
114
+ } else if (center.x - item.x <= 200) {
115
+ controlArray[index].run([
116
+ controlArray[index]
117
+ .action()
118
+ .setSpdAndAccel(8, randomSelect(), 0, 15, null, null),
119
+ controlArray[index]
120
+ .condition()
121
+ .reachPosition(undefined, 1380)
122
+ .then([controlArray[index].action().stopMoving()]),
123
+ ]);
124
+ } else if (center.x - item.x <= 500) {
125
+ controlArray[index].run([
126
+ controlArray[index]
127
+ .action()
128
+ .setSpdAndAccel(-8, randomSelect(), 0, 15, null, null),
129
+ controlArray[index]
130
+ .condition()
131
+ .reachPosition(undefined, 1380)
132
+ .then([controlArray[index].action().stopMoving()]),
133
+ ]);
134
+ } else if (center.x - item.x > 500) {
135
+ controlArray[index].run([
136
+ controlArray[index]
137
+ .action()
138
+ .setSpdAndAccel(-16, randomSelect(), 0, 15, null, null),
139
+ controlArray[index]
140
+ .condition()
141
+ .reachPosition(undefined, 1380)
142
+ .then([controlArray[index].action().stopMoving()]),
143
+ ]);
144
+ } else if (center.x - item.x < -60) {
145
+ controlArray[index].run([
146
+ controlArray[index]
147
+ .action()
148
+ .setSpdAndAccel(20, randomSelect(), 0, 15, null, null),
149
+ controlArray[index]
150
+ .condition()
151
+ .reachPosition(undefined, 1380)
152
+ .then([controlArray[index].action().stopMoving()]),
153
+ ]);
154
+ }
155
+ });
156
+ };
157
+ onMounted(() => {
158
+ for (let i = 0; i < refArray.length; i++) {
159
+ controlArray[i] = refArray[i].control;
160
+ }
161
+ if (props.onOff == true) {
162
+ MoveFunc();
163
+ }
164
+ });
165
+ </script>
166
+
167
+ <style scoped></style>
@@ -0,0 +1,101 @@
1
+ // 遮罩拼图格式1的配置
2
+ import mask1_1 from "../images/mask/1.png";
3
+ import mask1_2 from "../images/mask/2.png";
4
+ import mask1_3 from "../images/mask/3.png";
5
+ import mask1_4 from "../images/mask/4.png";
6
+ import mask1_5 from "../images/mask/5.png";
7
+ import mask1_6 from "../images/mask/6.png";
8
+ import mask1_7 from "../images/mask/7.png";
9
+ import mask1_8 from "../images/mask/8.png";
10
+ import mask1_9 from "../images/mask/9.png";
11
+ import mask1_10 from "../images/mask/10.png";
12
+ import mask1_11 from "../images/mask/11.png";
13
+ import mask1_12 from "../images/mask/12.png";
14
+
15
+ const ArraySet1 = [
16
+ {
17
+ left: 0,
18
+ top: 0,
19
+ width: 521,
20
+ height: 302,
21
+ url: mask1_1,
22
+ },
23
+ {
24
+ left: 301,
25
+ top: 0,
26
+ width: 590,
27
+ height: 266,
28
+ url: mask1_2,
29
+ },
30
+ {
31
+ left: 693,
32
+ top: 0,
33
+ width: 587,
34
+ height: 306,
35
+ url: mask1_3,
36
+ },
37
+ {
38
+ left: 0,
39
+ top: 140,
40
+ width: 561,
41
+ height: 431,
42
+ url: mask1_4,
43
+ },
44
+ {
45
+ left: 482,
46
+ top: 140,
47
+ width: 409,
48
+ height: 377,
49
+ url: mask1_5,
50
+ },
51
+ {
52
+ left: 717,
53
+ top: 247,
54
+ width: 563,
55
+ height: 247,
56
+ url: mask1_6,
57
+ },
58
+ {
59
+ left: 0,
60
+ top: 385,
61
+ width: 533,
62
+ height: 335,
63
+ url: mask1_7,
64
+ },
65
+ {
66
+ left: 333,
67
+ top: 392,
68
+ width: 293,
69
+ height: 328,
70
+ url: mask1_8,
71
+ },
72
+ {
73
+ left: 569,
74
+ top: 452,
75
+ width: 213,
76
+ height: 268,
77
+ url: mask1_9,
78
+ },
79
+ {
80
+ left: 714,
81
+ top: 405,
82
+ width: 332,
83
+ height: 315,
84
+ url: mask1_10,
85
+ },
86
+ {
87
+ left: 810,
88
+ top: 387,
89
+ width: 172,
90
+ height: 117,
91
+ url: mask1_11,
92
+ },
93
+ {
94
+ left: 893,
95
+ top: 428,
96
+ width: 387,
97
+ height: 292,
98
+ url: mask1_12,
99
+ },
100
+ ];
101
+ export { ArraySet1 }
@@ -0,0 +1,88 @@
1
+ // 遮罩拼图格式2的配置
2
+ const ArraySet2 = [
3
+ {
4
+ left: 0,
5
+ top: 0,
6
+ width: 565,
7
+ height: 395,
8
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/1.png",
9
+ },
10
+ {
11
+ left: 245,
12
+ top: 0,
13
+ width: 377,
14
+ height: 305,
15
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/2.png",
16
+ },
17
+ {
18
+ left: 600,
19
+ top: 0,
20
+ width: 236,
21
+ height: 276,
22
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/3.png",
23
+ },
24
+ {
25
+ left: 719,
26
+ top: 0,
27
+ width: 418,
28
+ height: 306,
29
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/4.png",
30
+ },
31
+ {
32
+ left: 783,
33
+ top: 0,
34
+ width: 497,
35
+ height: 415,
36
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/5.png",
37
+ },
38
+ {
39
+ left: 0,
40
+ top: 366,
41
+ width: 531,
42
+ height: 301,
43
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/6.png",
44
+ },
45
+ {
46
+ left: 494,
47
+ top: 217,
48
+ width: 481,
49
+ height: 340,
50
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/7.png",
51
+ },
52
+ {
53
+ left: 891,
54
+ top: 332,
55
+ width: 389,
56
+ height: 388,
57
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/8.png",
58
+ },
59
+ {
60
+ left: 0,
61
+ top: 429,
62
+ width: 601,
63
+ height: 291,
64
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/9.png",
65
+ },
66
+ {
67
+ left: 364,
68
+ top: 510,
69
+ width: 254,
70
+ height: 210,
71
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/10.png",
72
+ },
73
+ {
74
+ left: 573,
75
+ top: 447,
76
+ width: 230,
77
+ height: 273,
78
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/11.png",
79
+ },
80
+ {
81
+ left: 708,
82
+ top: 453,
83
+ width: 474,
84
+ height: 267,
85
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask1/12.png",
86
+ },
87
+ ];
88
+ export { ArraySet2}