@shijiu/jsview-vue-samples 2.1.340-test.0 → 2.1.362-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 (33) hide show
  1. package/CoupletsTest/App.vue +254 -93
  2. package/CoupletsTest/widget/Banger/Banger.vue +249 -0
  3. package/CoupletsTest/widget/Banger/Maroon.vue +130 -0
  4. package/CoupletsTest/widget/Banger/MaroonLoader.vue +81 -0
  5. package/CoupletsTest/widget/Couplets/Couplets.vue +194 -0
  6. package/CoupletsTest/widget/Fireworks/Fireworks.vue +234 -0
  7. package/DemoHomepage/views/Homepage.vue +1 -1
  8. package/package.json +1 -1
  9. package/CoupletsTest/LeadWire.vue +0 -221
  10. package/CoupletsTest/Maroon.vue +0 -112
  11. package/CoupletsTest/Salvo.vue +0 -251
  12. /package/CoupletsTest/{Common → widget/Common}/SpriteDeal.js +0 -0
  13. /package/CoupletsTest/{Sprite → widget/Sprite}/firecracker.json +0 -0
  14. /package/CoupletsTest/{Sprite → widget/Sprite}/firecracker.png +0 -0
  15. /package/CoupletsTest/{Sprite → widget/Sprite}/fireworks.json +0 -0
  16. /package/CoupletsTest/{Sprite → widget/Sprite}/fireworks.png +0 -0
  17. /package/CoupletsTest/{Sprite → widget/Sprite}/scroll.json +0 -0
  18. /package/CoupletsTest/{Sprite → widget/Sprite}/scroll.png +0 -0
  19. /package/CoupletsTest/{Sprite → widget/Sprite}/spark.json +0 -0
  20. /package/CoupletsTest/{Sprite → widget/Sprite}/spark.png +0 -0
  21. /package/CoupletsTest/{images → widget/images}/Couplets.png +0 -0
  22. /package/CoupletsTest/{images → widget/images}/goldencoin1.png +0 -0
  23. /package/CoupletsTest/{images → widget/images}/goldencoin2.png +0 -0
  24. /package/CoupletsTest/{images → widget/images}/leadWire.png +0 -0
  25. /package/CoupletsTest/{images → widget/images}/line.png +0 -0
  26. /package/CoupletsTest/{images → widget/images}/purpleStar.png +0 -0
  27. /package/CoupletsTest/{images → widget/images}/redStar.png +0 -0
  28. /package/CoupletsTest/{images → widget/images}/scroll1.png +0 -0
  29. /package/CoupletsTest/{images → widget/images}/star1.png +0 -0
  30. /package/CoupletsTest/{images → widget/images}/star2.png +0 -0
  31. /package/CoupletsTest/{images → widget/images}/star3.png +0 -0
  32. /package/CoupletsTest/{images → widget/images}/star4.png +0 -0
  33. /package/CoupletsTest/{images → widget/images}/yellowStar.png +0 -0
@@ -3,62 +3,12 @@
3
3
  <div class="bgStyle">
4
4
  <!-- 春联效果 -->
5
5
  <div v-if="myIndex == 1">
6
- <div
7
- :style="{
8
- top: 100,
9
- left: 200,
10
- width: 150,
11
- height: 500,
12
- overflow: 'hidden',
13
- animation: 'recovery-clip 1.5s linear',
14
- }"
15
- >
16
- <div
17
- :style="{
18
- top: 0,
19
- left: 0,
20
- width: 150,
21
- height: 500,
22
- backgroundImage: Couplets,
23
- animation: 'recovery-img 1.5s linear',
24
- }"
25
- ></div>
26
- </div>
27
- <!-- 滚轴动画 -->
28
- <div
29
- :style="{
30
- left: 170,
31
- top: 500 + 96,
32
- transform: `scale3d(${210 / view_size.w},1,1)`,
33
- }"
34
- >
35
- <div
36
- :style="{
37
- width: 280,
38
- height: 118,
39
- animation: 'recovery-clip 1.5s linear',
40
- }"
41
- >
42
- <JsvSpriteAnim
43
- :spriteInfo="sprite_info.info"
44
- :loop="4"
45
- autostart="true"
46
- :duration="0.4"
47
- :imageUrl="scrollPng"
48
- >
49
- </JsvSpriteAnim>
50
- </div>
51
- </div>
52
- <!-- 滚轴图片 -->
53
- <div
54
- :style="{
55
- top: 100,
56
- left: 200 - 30,
57
- width: 210,
58
- height: 30,
59
- backgroundImage: scroll,
60
- }"
61
- ></div>
6
+ <MyCouplets
7
+ :top="130"
8
+ :left="200"
9
+ :width="150"
10
+ :animTime="1.5"
11
+ ></MyCouplets>
62
12
  <!-- 素材1 滚轴图片 -->
63
13
  <div
64
14
  :style="{
@@ -116,15 +66,239 @@
116
66
  </div>
117
67
  </div>
118
68
  <!-- 鞭炮引线 第二页 -->
119
- <div v-else-if="myIndex == 3">
120
- <LeadWire :top="-580" :left="200"></LeadWire>
69
+ <div v-else-if="myIndex == 2">
70
+ <Banger
71
+ :top="100"
72
+ :left="200"
73
+ :num="16"
74
+ :leadWireTime="4"
75
+ :width="100"
76
+ ></Banger>
121
77
  <div
122
78
  class="text"
123
- :style="{ top: 680, left: 980, width: 300, height: 60 }"
79
+ :style="{ top: 40, left: 130, width: 150, height: 100 }"
80
+ >
81
+ {{ "炮仗效果" }}
82
+ </div>
83
+ <!-- 素材1 火花精灵图-->
84
+ <div
85
+ :style="{
86
+ top: 100,
87
+ left: 600,
88
+ width: 210,
89
+ height: 120,
90
+ backgroundImage: sparkPng,
91
+ }"
92
+ ></div>
93
+ <!-- 素材2 炮仗精灵图 -->
94
+ <div
95
+ :style="{
96
+ top: 300,
97
+ left: 600,
98
+ width: 210,
99
+ height: 120,
100
+ backgroundImage: firecrackerPng,
101
+ }"
102
+ ></div>
103
+ <!-- 素材3 引线图 -->
104
+ <div
105
+ :style="{
106
+ top: 520,
107
+ left: 650,
108
+ width: 100,
109
+ height: 150,
110
+ backgroundImage: leadWire,
111
+ }"
112
+ ></div>
113
+ <!-- 素材4 红色星星 -->
114
+ <div
115
+ :style="{
116
+ top: 100,
117
+ left: 900,
118
+ width: 210,
119
+ height: 120,
120
+ backgroundImage: redStar,
121
+ }"
122
+ ></div>
123
+ <!-- 素材5 黄色星星 -->
124
+ <div
125
+ :style="{
126
+ top: 300,
127
+ left: 900,
128
+ width: 210,
129
+ height: 120,
130
+ backgroundImage: yellowStar,
131
+ }"
132
+ ></div>
133
+ <!-- 素材6 紫色星星 -->
134
+ <div
135
+ :style="{
136
+ top: 520,
137
+ left: 900,
138
+ width: 210,
139
+ height: 120,
140
+ backgroundImage: purpleStar,
141
+ }"
124
142
  ></div>
143
+ <!-- 说明 -->
144
+ <div
145
+ class="text"
146
+ :style="{ top: 40, left: 600, width: 210, height: 100 }"
147
+ >
148
+ {{ "素材1" }}
149
+ </div>
150
+ <div
151
+ class="text"
152
+ :style="{ top: 240, left: 600, width: 210, height: 100 }"
153
+ >
154
+ {{ "素材2" }}
155
+ </div>
156
+ <div
157
+ class="text"
158
+ :style="{ top: 460, left: 600, width: 210, height: 100 }"
159
+ >
160
+ {{ "素材3" }}
161
+ </div>
162
+ <div
163
+ class="text"
164
+ :style="{ top: 40, left: 900, width: 210, height: 100 }"
165
+ >
166
+ {{ "素材4" }}
167
+ </div>
168
+ <div
169
+ class="text"
170
+ :style="{ top: 240, left: 900, width: 210, height: 100 }"
171
+ >
172
+ {{ "素材5" }}
173
+ </div>
174
+ <div
175
+ class="text"
176
+ :style="{ top: 460, left: 900, width: 210, height: 100 }"
177
+ >
178
+ {{ "素材6" }}
179
+ </div>
125
180
  </div>
126
181
  <div v-else>
127
- <Salvo></Salvo>
182
+ <Fireworks :top="600" :left="200" />
183
+ <div
184
+ class="text"
185
+ :style="{ top: 40, left: 130, width: 150, height: 100 }"
186
+ >
187
+ {{ "烟花效果" }}
188
+ </div>
189
+ <!-- 素材1 精灵图-->
190
+ <div
191
+ :style="{
192
+ top: 100,
193
+ left: 600,
194
+ width: 210,
195
+ height: 120,
196
+ backgroundImage: fireworksPng,
197
+ }"
198
+ ></div>
199
+ <!-- 素材2 金币图1 -->
200
+ <div
201
+ :style="{
202
+ top: 340,
203
+ left: 670,
204
+ width: 50,
205
+ height: 50,
206
+ backgroundImage: GoldenCoin1,
207
+ }"
208
+ ></div>
209
+ <!-- 素材3 金币图2 -->
210
+ <div
211
+ :style="{
212
+ top: 550,
213
+ left: 670,
214
+ width: 50,
215
+ height: 50,
216
+ backgroundImage: GoldenCoin2,
217
+ }"
218
+ ></div>
219
+ <!-- 素材4 星星1 -->
220
+ <div
221
+ :style="{
222
+ top: 100,
223
+ left: 980,
224
+ width: 50,
225
+ height: 50,
226
+ backgroundImage: star1,
227
+ }"
228
+ ></div>
229
+ <!-- 素材5 星星2 -->
230
+ <div
231
+ :style="{
232
+ top: 260,
233
+ left: 980,
234
+ width: 50,
235
+ height: 50,
236
+ backgroundImage: star2,
237
+ }"
238
+ ></div>
239
+ <!-- 素材6 星星3 -->
240
+ <div
241
+ :style="{
242
+ top: 420,
243
+ left: 980,
244
+ width: 50,
245
+ height: 50,
246
+ backgroundImage: star3,
247
+ }"
248
+ ></div>
249
+ <!-- 素材7 星星4 -->
250
+ <div
251
+ :style="{
252
+ top: 580,
253
+ left: 980,
254
+ width: 50,
255
+ height: 50,
256
+ backgroundImage: star4,
257
+ }"
258
+ ></div>
259
+ <!-- 文字说明 -->
260
+ <div
261
+ class="text"
262
+ :style="{ top: 40, left: 600, width: 210, height: 100 }"
263
+ >
264
+ {{ "素材1" }}
265
+ </div>
266
+ <div
267
+ class="text"
268
+ :style="{ top: 240, left: 600, width: 210, height: 100 }"
269
+ >
270
+ {{ "素材2" }}
271
+ </div>
272
+ <div
273
+ class="text"
274
+ :style="{ top: 460, left: 600, width: 210, height: 100 }"
275
+ >
276
+ {{ "素材3" }}
277
+ </div>
278
+ <div
279
+ class="text"
280
+ :style="{ top: 40, left: 900, width: 210, height: 100 }"
281
+ >
282
+ {{ "素材4" }}
283
+ </div>
284
+ <div
285
+ class="text"
286
+ :style="{ top: 200, left: 900, width: 210, height: 100 }"
287
+ >
288
+ {{ "素材5" }}
289
+ </div>
290
+ <div
291
+ class="text"
292
+ :style="{ top: 360, left: 900, width: 210, height: 100 }"
293
+ >
294
+ {{ "素材6" }}
295
+ </div>
296
+ <div
297
+ class="text"
298
+ :style="{ top: 520, left: 900, width: 210, height: 100 }"
299
+ >
300
+ {{ "素材7" }}
301
+ </div>
128
302
  </div>
129
303
  <!-- 翻页提示 -->
130
304
  <div
@@ -138,22 +312,27 @@
138
312
  </template>
139
313
 
140
314
  <script setup>
141
- import { JsvSpriteAnim } from "jsview";
142
315
  import { shallowRef } from "vue";
143
- import LeadWire from "./LeadWire.vue";
144
- import Couplets from "./images/Couplets.png";
145
- import scrollPng from "./Sprite/scroll.png";
146
- import scrollJson from "./Sprite/scroll.json";
147
- import { _formatInfo } from "./Common/SpriteDeal";
148
- import scroll from "./images/scroll1.png";
149
- import Salvo from "./Salvo.vue";
150
- let sprite_info = shallowRef(_formatInfo(scrollJson));
151
-
152
- const view_size = {
153
- w: sprite_info.value.maxW,
154
- h: sprite_info.value.maxH,
155
- };
156
-
316
+ import Couplets from "./widget/images/Couplets.png";
317
+ import scrollPng from "./widget/Sprite/scroll.png";
318
+ import { _formatInfo } from "./widget/Common/SpriteDeal";
319
+ import scroll from "./widget/images/scroll1.png";
320
+ import MyCouplets from "./widget/Couplets/Couplets.vue";
321
+ import Fireworks from "./widget/Fireworks/Fireworks.vue";
322
+ import Banger from "./widget/Banger/Banger.vue";
323
+ import GoldenCoin1 from "./widget/images/goldencoin1.png";
324
+ import GoldenCoin2 from "./widget/images/goldencoin2.png";
325
+ import star1 from "./widget/images/star1.png";
326
+ import star2 from "./widget/images/star2.png";
327
+ import star3 from "./widget/images/star3.png";
328
+ import star4 from "./widget/images/star4.png";
329
+ import fireworksPng from "./widget/Sprite/fireworks.png";
330
+ import redStar from "./widget/images/redStar.png";
331
+ import yellowStar from "./widget/images/yellowStar.png";
332
+ import purpleStar from "./widget/images/purpleStar.png";
333
+ import firecrackerPng from "./widget/Sprite/firecracker.png";
334
+ import leadWire from "./widget/images/leadWire.png";
335
+ import sparkPng from "./widget/Sprite/spark.png";
157
336
  //页码
158
337
  let myIndex = shallowRef(1);
159
338
 
@@ -184,24 +363,6 @@ const onKeyDown = (ev) => {
184
363
  height: 720;
185
364
  background-color: #007788;
186
365
  }
187
- @keyframes recovery-clip {
188
- 0% {
189
- transform: translate3d(0, -500, 0);
190
- }
191
-
192
- 100% {
193
- transform: translate3d(0, 0, 0);
194
- }
195
- }
196
- @keyframes recovery-img {
197
- 0% {
198
- transform: translate3d(0, 500, 0);
199
- }
200
-
201
- 100% {
202
- transform: translate3d(0, 0, 0);
203
- }
204
- }
205
366
  .text {
206
367
  font-size: 24;
207
368
  color: #ffffff;
@@ -0,0 +1,249 @@
1
+ <!--
2
+ * 【模块 export 内容】
3
+ * Banger:鞭炮组件
4
+ * props说明:
5
+ * left {Number} 组件顶端中心Left位置
6
+ * top {Number} 组件顶端中心Top位置
7
+ * num {Number} 鞭炮个数(个数决定长度)
8
+ * leadWireTime {Number} 引线燃烧时间
9
+ * width {Number} 整个组件的宽度
10
+ -->
11
+ <template>
12
+ <!-- 预加载 -->
13
+ <JsvPreload
14
+ :preloadList="preload_info"
15
+ :onPreloadDone="loadDone"
16
+ ></JsvPreload>
17
+ <div
18
+ v-show="myShow"
19
+ :style="{
20
+ left: props.left - widgetWidth / 2,
21
+ top: props.top,
22
+ width: widgetWidth,
23
+ height: leadWireHeight,
24
+ transform: `scale3d(${props.width / widgetWidth},${
25
+ props.width / widgetWidth
26
+ },1)`,
27
+ transformOrigin: 'center top',
28
+ }"
29
+ >
30
+ <div
31
+ :style="{
32
+ top: -leadWireHeight,
33
+ left: 0,
34
+ width: 80,
35
+ height: leadWireHeight,
36
+ overflow: 'hidden',
37
+ animation: aniName1,
38
+ }"
39
+ >
40
+ <div
41
+ :style="{
42
+ top: leadWireHeight,
43
+ left: 0,
44
+ width: 80,
45
+ height: leadWireHeight,
46
+ backgroundImage: leadWire,
47
+ animation: aniName2,
48
+ }"
49
+ ></div>
50
+ </div>
51
+ <!-- 燃烧特效 -->
52
+ <div
53
+ v-if="isSpark"
54
+ :style="{
55
+ top: -10,
56
+ left: 31,
57
+ animation: aniName1,
58
+ }"
59
+ @animationend="closeSpark"
60
+ >
61
+ <JsvSpriteLoader
62
+ :imageUrl="sparkPng"
63
+ :configUrl="sparkJson"
64
+ :onConfigReady="preloadCallback"
65
+ :noNeedResource="false"
66
+ >
67
+ <div
68
+ :style="{
69
+ transform: `scale3d(${20 / view_size.w},${20 / view_size.h},1)`,
70
+ }"
71
+ >
72
+ <JsvSpriteAnim
73
+ :spriteInfo="sprite_info.info"
74
+ :loop="'infinite'"
75
+ :duration="0.1"
76
+ :imageUrl="sparkPng"
77
+ ref="controllerAnim"
78
+ autoStart="true"
79
+ >
80
+ </JsvSpriteAnim>
81
+ </div>
82
+ </JsvSpriteLoader>
83
+ </div>
84
+
85
+ <MaroonLoader>
86
+ <Maroon
87
+ v-for="(item, index) in spriteArray"
88
+ :top="leadWireHeight - 40 - index * 16"
89
+ :left="10"
90
+ :deg="index % 2 == 0 ? 30 : -30"
91
+ :ref="(el) => (RefArray[index] = el)"
92
+ :myRef="spriteArray[index]"
93
+ ></Maroon>
94
+ </MaroonLoader>
95
+ </div>
96
+ </template>
97
+
98
+ <script setup>
99
+ import Maroon from "./Maroon.vue";
100
+ import MaroonLoader from "./MaroonLoader.vue";
101
+ import { shallowRef, onBeforeUnmount, watch, provide } from "vue";
102
+ import {
103
+ JsvSpriteAnim,
104
+ getKeyFramesGroup,
105
+ JsvSpriteLoader,
106
+ JsvPreload,
107
+ buildPreloadInfo,
108
+ } from "jsview";
109
+ import { _formatInfo } from "../Common/SpriteDeal";
110
+
111
+ const leadWire =
112
+ "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/leadWire.png";
113
+ const sparkPng =
114
+ "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/spark.png";
115
+ const sparkJson =
116
+ "https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/spark.json";
117
+
118
+ //预加载
119
+ const preload_info = [buildPreloadInfo(leadWire), buildPreloadInfo(sparkPng)];
120
+ //定义ref
121
+ let controllerAnim = shallowRef(null);
122
+ //设定变量控制动画的播放
123
+ let readyNum = shallowRef(0);
124
+ const loadDone = (a) => {
125
+ readyNum.value++;
126
+ myShow.value = true;
127
+ };
128
+ let myShow = shallowRef(false);
129
+ const props = defineProps({
130
+ top: { type: Number, default: 0 },
131
+ left: { type: Number, default: 0 },
132
+ num: { type: Number, default: 12 },
133
+ width: { type: Number, require: true },
134
+ leadWireTime: { type: Number, require: true },
135
+ });
136
+ // 组件宽度
137
+ const widgetWidth = 80;
138
+ let sprite_info = shallowRef(null);
139
+ let view_size = shallowRef(null);
140
+ //计算引线长度
141
+ let leadWireHeight = (props.num - 1) * 16 + 20;
142
+ //插入动画
143
+ const idRandom = Math.floor(Math.random() * 1000000);
144
+ let styleShell = getKeyFramesGroup();
145
+ let name1 = "animLw1-" + idRandom;
146
+ let name2 = "animLw2-" + idRandom;
147
+ let animLw1 = `@keyframes ${name1} {
148
+ from {
149
+ transform: translate3d(0,${leadWireHeight}, 0);
150
+ }
151
+ to {
152
+ transform: translate3d(0, 0, 0);
153
+ }
154
+ }`;
155
+ styleShell.insertRule(animLw1);
156
+ let animLw2 = `@keyframes ${name2} {
157
+ from {
158
+ transform: translate3d(0,${-leadWireHeight}, 0);
159
+ }
160
+ to {
161
+ transform: translate3d(0, 0, 0);
162
+ }
163
+ }`;
164
+ styleShell.insertRule(animLw2);
165
+
166
+ //预加载
167
+ const preloadCallback = (config_json, resolve_set) => {
168
+ sprite_info.value = _formatInfo(config_json);
169
+ view_size.value = {
170
+ w: sprite_info.value.maxW,
171
+ h: sprite_info.value.maxH,
172
+ };
173
+ resolve_set(); // 通知loader数组设置完成
174
+ readyNum.value++;
175
+ };
176
+ //子组件加载完毕的flag
177
+ let sonFlag = shallowRef(false);
178
+ provide("sonFlag", sonFlag);
179
+ //动画名字
180
+ let aniName1 = shallowRef(null);
181
+ let aniName2 = shallowRef(null);
182
+ //控制燃烧特效
183
+ let isSpark = shallowRef(true);
184
+ const closeSpark = () => {
185
+ isSpark.value = false;
186
+ };
187
+ //ref数组
188
+ const spriteArray = new Array(props.num);
189
+ let RefArray = shallowRef([]);
190
+ for (let i = 0; i < spriteArray.length; i++) {
191
+ spriteArray[i] = shallowRef(null);
192
+ }
193
+
194
+ const callFireMethod = (index) => {
195
+ // 检查索引是否超出范围,如果超出则停止递归
196
+ if (index >= spriteArray.length) {
197
+ return;
198
+ }
199
+
200
+ // 获取当前索引对应的Maroon组件的ref
201
+ const currentMaroonRef = RefArray.value[index];
202
+ // 调用当前Maroon组件的fire方法
203
+ if (currentMaroonRef) {
204
+ currentMaroonRef.fire();
205
+ }
206
+ // 延迟1秒后递归调用下一个Maroon组件的fire方法
207
+ timer.id2 = setTimeout(() => {
208
+ callFireMethod(index + 1);
209
+ }, (props.leadWireTime * 1000) / (props.num - 1));
210
+ };
211
+
212
+ //延时器
213
+ let timer = { id: -1, id2: -1 };
214
+ watch(readyNum, (n, o) => {
215
+ if (o != 3 && n == 3) {
216
+ timer.id = setTimeout(() => {
217
+ controllerAnim.value.start();
218
+ callFireMethod(0);
219
+ aniName1.value = `${name1} ${props.leadWireTime}s linear`;
220
+ aniName2.value = `${name2} ${props.leadWireTime}s linear`;
221
+ }, 0);
222
+ }
223
+ });
224
+
225
+ watch(sonFlag, (n) => {
226
+ if (n == true) {
227
+ readyNum.value++;
228
+ }
229
+ });
230
+
231
+ onBeforeUnmount(() => {
232
+ styleShell.removeRule(name1);
233
+ styleShell.removeRule(name2);
234
+ clearTimeout(timer.id);
235
+ clearTimeout(timer.id2);
236
+ timer.id = -1;
237
+ timer.id2 = -1;
238
+ });
239
+ </script>
240
+
241
+ <style scoped>
242
+ .text {
243
+ font-size: 24;
244
+ color: #ffffff;
245
+ font-weight: bold;
246
+ text-align: center;
247
+ line-height: 32;
248
+ }
249
+ </style>