@shijiu/jsview-vue-samples 2.1.428 → 2.1.448-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.
@@ -5,17 +5,17 @@
5
5
  * imageUrl {String} (必填) 显示图片的加载地址
6
6
  * displayWidth {Number} (必填) 想要展示的宽度
7
7
  * ArraySet {Array} (必填) 模板配置项,包括:每个模块的width,height,left,top,url
8
- * style {Object} (必填) 横纵模板总长度和总宽度。(width,height)
8
+ * style {Object} (必填) 模板配置总长度和总宽度。(width,height)
9
9
  * onOff {Boolean} (必填) 组件挂载好后是否立即动画的开关,后续可通过改值为true开启。
10
10
  -->
11
11
 
12
12
  <template>
13
13
  <div
14
14
  :style="{
15
- width: 1280,
16
- height: 720,
17
- transform: `scale3d(${props.displayWidth / 1280},${
18
- props.displayWidth / 1280
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
19
  },1)`,
20
20
  transformOrigin: 'left top',
21
21
  }"
@@ -48,7 +48,7 @@
48
48
 
49
49
  <script setup>
50
50
  import { JsvMaskClipDiv, JsvFreeMoveActor } from "jsview";
51
- import { onMounted, onBeforeUnmount, watch, shallowRef } from "vue";
51
+ import { onMounted, watch } from "vue";
52
52
 
53
53
  const props = defineProps({
54
54
  imageUrl: { type: String, require: true },
@@ -57,12 +57,27 @@ const props = defineProps({
57
57
  style: { type: Object, require: true },
58
58
  onOff: { type: Boolean, require: true },
59
59
  });
60
-
61
- //12个FreeMove引用
60
+ //FreeMove引用
62
61
  const refArray = [];
63
62
  const controlArray = new Array(props.ArraySet.length).fill(null);
64
- const timer = { id: -1 };
65
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
+ //监听控制开关的值
66
81
  watch(
67
82
  () => props.onOff,
68
83
  (n, o) => {
@@ -71,109 +86,80 @@ watch(
71
86
  }
72
87
  }
73
88
  );
74
-
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
+ };
75
101
  //运动函数
76
102
  const MoveFunc = () => {
77
- controlArray[0].run([
78
- controlArray[0].action().setSpdAndAccel(-6, -9, 0, 1, null, null),
79
- controlArray[0]
80
- .condition()
81
- .reachPosition(undefined, 720)
82
- .then([controlArray[0].action().stopMoving()]),
83
- ]);
84
-
85
- controlArray[1].run([
86
- controlArray[1].action().setSpdAndAccel(0, -5, 0, 1, null, null),
87
- controlArray[1]
88
- .condition()
89
- .reachPosition(undefined, 720)
90
- .then([controlArray[1].action().stopMoving()]),
91
- ]);
92
- controlArray[2].run([
93
- controlArray[2].action().setSpdAndAccel(6, -9, 0, 1, null, null),
94
- controlArray[2]
95
- .condition()
96
- .reachPosition(undefined, 720)
97
- .then([controlArray[2].action().stopMoving()]),
98
- ]);
99
- controlArray[3].run([
100
- controlArray[3].action().setSpdAndAccel(-6, -7, 0, 1, null, null),
101
- controlArray[3]
102
- .condition()
103
- .reachPosition(undefined, 720)
104
- .then([controlArray[3].action().stopMoving()]),
105
- ]);
106
- controlArray[4].run([
107
- controlArray[4].action().setSpdAndAccel(0, -8, 0, 1, null, null),
108
- controlArray[4]
109
- .condition()
110
- .reachPosition(undefined, 720)
111
- .then([controlArray[4].action().stopMoving()]),
112
- ]);
113
- controlArray[5].run([
114
- controlArray[5].action().setSpdAndAccel(6, -7, 0, 1, null, null),
115
- controlArray[5]
116
- .condition()
117
- .reachPosition(undefined, 720)
118
- .then([controlArray[5].action().stopMoving()]),
119
- ]);
120
- controlArray[6].run([
121
- controlArray[6].action().setSpdAndAccel(-6, -4, 0, 1, null, null),
122
- controlArray[6]
123
- .condition()
124
- .reachPosition(undefined, 720)
125
- .then([controlArray[6].action().stopMoving()]),
126
- ]);
127
- controlArray[7].run([
128
- controlArray[7].action().setSpdAndAccel(0, -8, 0, 1, null, null),
129
- controlArray[7]
130
- .condition()
131
- .reachPosition(undefined, 720)
132
- .then([controlArray[7].action().stopMoving()]),
133
- ]);
134
- controlArray[8].run([
135
- controlArray[8].action().setSpdAndAccel(2, -7, 0, 1, null, null),
136
- controlArray[8]
137
- .condition()
138
- .reachPosition(undefined, 720)
139
- .then([controlArray[8].action().stopMoving()]),
140
- ]);
141
- controlArray[9].run([
142
- controlArray[9].action().setSpdAndAccel(6, -7, 0, 1, null, null),
143
- controlArray[9]
144
- .condition()
145
- .reachPosition(undefined, 720)
146
- .then([controlArray[9].action().stopMoving()]),
147
- ]);
148
- controlArray[10].run([
149
- controlArray[10].action().setSpdAndAccel(4, -4, 0, 1, null, null),
150
- controlArray[10]
151
- .condition()
152
- .reachPosition(undefined, 720)
153
- .then([controlArray[10].action().stopMoving()]),
154
- ]);
155
- controlArray[11].run([
156
- controlArray[11].action().setSpdAndAccel(6, -4, 0, 1, null, null),
157
- controlArray[11]
158
- .condition()
159
- .reachPosition(undefined, 720)
160
- .then([controlArray[11].action().stopMoving()]),
161
- ]);
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
+ });
162
156
  };
163
157
  onMounted(() => {
164
158
  for (let i = 0; i < refArray.length; i++) {
165
159
  controlArray[i] = refArray[i].control;
166
160
  }
167
161
  if (props.onOff == true) {
168
- // timer.id = setTimeout(() => {
169
- MoveFunc();
170
- // }, 1000);
171
- }
172
- });
173
- onBeforeUnmount(() => {
174
- if (timer.id !== -1) {
175
- clearTimeout(timer.id);
176
- timer.id = -1;
162
+ MoveFunc();
177
163
  }
178
164
  });
179
165
  </script>
@@ -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}
@@ -0,0 +1,102 @@
1
+ const ArraySet3 = [
2
+ {
3
+ left: 0,
4
+ top: 0,
5
+ width: 232,
6
+ height: 287,
7
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/1.png",
8
+ },
9
+ {
10
+ left: 213,
11
+ top: 0,
12
+ width: 588,
13
+ height: 315,
14
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/2.png",
15
+ },
16
+ {
17
+ left: 223,
18
+ top: 0,
19
+ width: 582,
20
+ height: 316,
21
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/3.png",
22
+ },
23
+ {
24
+ left: 811,
25
+ top: 62,
26
+ width: 469,
27
+ height: 257,
28
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/4.png",
29
+ },
30
+ {
31
+ left: 943,
32
+ top: 0,
33
+ width: 337,
34
+ height: 162,
35
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/5.png",
36
+ },
37
+ {
38
+ left: 0,
39
+ top: 260,
40
+ width: 272,
41
+ height: 460,
42
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/6.png",
43
+ },
44
+ {
45
+ left: 86,
46
+ top: 168,
47
+ width: 728,
48
+ height: 350,
49
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/7.png",
50
+ },
51
+ {
52
+ left: 806,
53
+ top: 223,
54
+ width: 474,
55
+ height: 133,
56
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/8.png",
57
+ },
58
+ {
59
+ left: 706,
60
+ top: 0,
61
+ width: 295,
62
+ height: 319,
63
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/9.png",
64
+ },
65
+ {
66
+ left: 51,
67
+ top: 319,
68
+ width: 765,
69
+ height: 401,
70
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/10.png",
71
+ },
72
+ {
73
+ left: 688,
74
+ top: 321,
75
+ width: 304,
76
+ height: 399,
77
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/11.png",
78
+ },
79
+ {
80
+ left: 814,
81
+ top: 320,
82
+ width: 345,
83
+ height: 400,
84
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/12.png",
85
+ },
86
+ {
87
+ left: 816,
88
+ top: 315,
89
+ width: 464,
90
+ height: 211,
91
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/13.png",
92
+ },
93
+ {
94
+ left: 979,
95
+ top: 413,
96
+ width: 301,
97
+ height: 307,
98
+ url: "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SceneTransition/mask2/14.png",
99
+ },
100
+ ];
101
+
102
+ export { ArraySet3 }