@shijiu/jsview-vue-samples 2.1.341-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
@@ -1,221 +0,0 @@
1
- <template>
2
- <div
3
- :style="{
4
- top: props.top,
5
- left: props.left,
6
- width: 300,
7
- height: 600,
8
- overflow: 'hidden',
9
- animation: 'recovery-clip 5s linear',
10
- }"
11
- >
12
- <div
13
- :style="{
14
- top: 600,
15
- left: 0,
16
- width: 80,
17
- height: 600,
18
- backgroundImage: leadWire,
19
- animation: 'recovery-img 5s linear',
20
- }"
21
- ></div>
22
- </div>
23
- <!-- 燃烧特效 -->
24
- <div
25
- v-if="isSpark"
26
- :style="{
27
- top: props.top + 590,
28
- left: props.left + 31,
29
- animation: 'recovery-clip 5s linear',
30
- }"
31
- @animationend="closeSpark"
32
- >
33
- <div :style="{
34
- transform: `scale3d(${20 / view_size.w},${20 / view_size.h},1)`,}">
35
- <JsvSpriteAnim
36
- :spriteInfo="sprite_info.info"
37
- :loop="'infinite'"
38
- autostart="true"
39
- :duration="0.1"
40
- :imageUrl="sparkPng"
41
- >
42
- </JsvSpriteAnim>
43
- </div>
44
-
45
- </div>
46
- <Maroon
47
- v-for="(item, index) in spriteArray"
48
- :top="index == spriteArray.length - 1 ? -10 : props.top + 1100 - index * 50"
49
- :left="props.left + 10"
50
- :deg="index % 2 == 0 ? 30 : -30"
51
- :ref="(el) => (RefArray[index] = el)"
52
- :myRef="spriteArray[index]"
53
- ></Maroon>
54
- <!-- 素材展示 -->
55
- <!-- 素材1 火花精灵图-->
56
- <div
57
- :style="{
58
- top: 100,
59
- left: 600,
60
- width: 210,
61
- height: 120,
62
- backgroundImage: sparkPng,
63
- }"
64
- ></div>
65
- <!-- 素材2 炮仗精灵图 -->
66
- <div
67
- :style="{
68
- top: 300,
69
- left: 600,
70
- width: 210,
71
- height: 120,
72
- backgroundImage: firecrackerPng,
73
- }"
74
- ></div>
75
- <!-- 素材3 引线图 -->
76
- <div
77
- :style="{
78
- top: 520,
79
- left: 650,
80
- width: 100,
81
- height: 150,
82
- backgroundImage: leadWire,
83
- }"
84
- ></div>
85
- <!-- 素材4 红色星星 -->
86
- <div
87
- :style="{
88
- top: 100,
89
- left: 900,
90
- width: 210,
91
- height: 120,
92
- backgroundImage: redStar,
93
- }"
94
- ></div>
95
- <!-- 素材5 黄色星星 -->
96
- <div
97
- :style="{
98
- top: 300,
99
- left: 900,
100
- width: 210,
101
- height: 120,
102
- backgroundImage: yellowStar,
103
- }"
104
- ></div>
105
- <!-- 素材6 紫色星星 -->
106
- <div
107
- :style="{
108
- top: 520,
109
- left: 900,
110
- width: 210,
111
- height: 120,
112
- backgroundImage: purpleStar,
113
- }"
114
- ></div>
115
- <!-- 说明 -->
116
- <div class="text" :style="{ top: 40, left: 600, width: 210, height: 100 }">
117
- {{ "素材1" }}
118
- </div>
119
- <div class="text" :style="{ top: 240, left: 600, width: 210, height: 100 }">
120
- {{ "素材2" }}
121
- </div>
122
- <div class="text" :style="{ top: 460, left: 600, width: 210, height: 100 }">
123
- {{ "素材3" }}
124
- </div>
125
- <div class="text" :style="{ top: 40, left: 900, width: 210, height: 100 }">
126
- {{ "素材4" }}
127
- </div>
128
- <div class="text" :style="{ top: 240, left: 900, width: 210, height: 100 }">
129
- {{ "素材5" }}
130
- </div>
131
- <div class="text" :style="{ top: 460, left: 900, width: 210, height: 100 }">
132
- {{ "素材6" }}
133
- </div>
134
- </template>
135
-
136
- <script setup>
137
- import Maroon from "./Maroon.vue";
138
- import { shallowRef, onMounted } from "vue";
139
- import leadWire from "./images/leadWire.png";
140
- import { JsvSpriteAnim } from "jsview";
141
- import { _formatInfo } from "./Common/SpriteDeal";
142
- import sparkPng from "./Sprite/spark.png";
143
- import sparkJson from "./Sprite/spark.json";
144
- import firecrackerPng from "./Sprite/firecracker.png";
145
- import redStar from "./images/redStar.png";
146
- import yellowStar from "./images/yellowStar.png";
147
- import purpleStar from "./images/purpleStar.png";
148
- const props = defineProps({
149
- top: Number,
150
- left: Number,
151
- });
152
- let sprite_info = shallowRef(_formatInfo(sparkJson));
153
- const view_size = {
154
- w: sprite_info.value.maxW,
155
- h: sprite_info.value.maxH,
156
- };
157
- //控制燃烧特效
158
- let isSpark = shallowRef(true);
159
- const closeSpark = () => {
160
- isSpark.value = false;
161
- };
162
- //ref数组
163
- const spriteArray = new Array(12);
164
- let RefArray = shallowRef([]);
165
- for (let i = 0; i < spriteArray.length; i++) {
166
- spriteArray[i] = shallowRef(null);
167
- }
168
-
169
- const callFireMethod = (index) => {
170
- // 检查索引是否超出范围,如果超出则停止递归
171
- if (index >= spriteArray.length) {
172
- return;
173
- }
174
-
175
- // 获取当前索引对应的Maroon组件的ref
176
- const currentMaroonRef = RefArray.value[index];
177
- // 调用当前Maroon组件的fire方法
178
- if (currentMaroonRef) {
179
- currentMaroonRef.fire();
180
- }
181
- // 延迟1秒后递归调用下一个Maroon组件的fire方法
182
- setTimeout(() => {
183
- callFireMethod(index + 1);
184
- }, 400);
185
- };
186
-
187
- onMounted(() => {
188
- setTimeout(() => {
189
- // 调用递归函数,传入初始索引0
190
- callFireMethod(0);
191
- }, 500);
192
- });
193
- </script>
194
-
195
- <style scoped>
196
- @keyframes recovery-clip {
197
- 0% {
198
- transform: translate3d(0, 600, 0);
199
- }
200
-
201
- 100% {
202
- transform: translate3d(0, 0, 0);
203
- }
204
- }
205
- @keyframes recovery-img {
206
- 0% {
207
- transform: translate3d(0, -600, 0);
208
- }
209
-
210
- 100% {
211
- transform: translate3d(0, 0, 0);
212
- }
213
- }
214
- .text {
215
- font-size: 24;
216
- color: #ffffff;
217
- font-weight: bold;
218
- text-align: center;
219
- line-height: 32;
220
- }
221
- </style>
@@ -1,112 +0,0 @@
1
- <template>
2
- <div
3
- :style="{
4
- top: myTop,
5
- left: props.left,
6
- width: 30,
7
- height: 60,
8
- transition: 'top 1.5s',
9
- }"
10
- @transitionend="myTransitionEnd"
11
- >
12
- <div
13
- :style="{
14
- width: 30,
15
- height: 60,
16
- transform: `rotate3d(0,0,1,${deg}deg) scale3d(${40 / view_size.w},${
17
- 40 / view_size.w
18
- },1)`,
19
- transformOrigin:'center center',
20
- }"
21
- >
22
- <!-- 炮仗图 -->
23
- <JsvSpriteAnim
24
- :spriteInfo="sprite_info.info"
25
- :loop="1"
26
- :duration="0.8"
27
- :imageUrl="firecrackerPng"
28
- :controller="props.controller"
29
- :onAnimEnd="onAnimEnd"
30
- :ref="props.myRef"
31
- >
32
- </JsvSpriteAnim>
33
- <!-- 喷射粒子 -->
34
- <div
35
- v-if="isSpray"
36
- :style="{
37
- top: view_size.h/2,
38
- left: view_size.w/2,
39
- width:view_size.w,
40
- height:view_size.h,
41
- }"
42
- >
43
- <jsv-spray
44
- v-for="item in ImgData"
45
- :pointRes="`url(${item})`"
46
- :sprayStyle="sprayOk"
47
- :ignoreClip="true"
48
- />
49
- </div>
50
- </div>
51
- </div>
52
- </template>
53
-
54
- <script setup>
55
- import { shallowRef } from "vue";
56
- import { JsvSpriteAnim, JsvSpray } from "jsview";
57
- import firecrackerJson from "./Sprite/firecracker.json";
58
- import firecrackerPng from "./Sprite/firecracker.png";
59
- import { _formatInfo } from "./Common/SpriteDeal";
60
- import redStar from "./images/redStar.png";
61
- import yellowStar from "./images/yellowStar.png";
62
- import purpleStar from "./images/purpleStar.png";
63
- const props = defineProps({
64
- top: Number,
65
- left: Number,
66
- deg: Number,
67
- controller: Object,
68
- myRef: Object,
69
- });
70
- let myTop = shallowRef(props.top);
71
- let sprite_info = shallowRef(_formatInfo(firecrackerJson));
72
- const view_size = {
73
- w: sprite_info.value.maxW,
74
- h: sprite_info.value.maxH,
75
- };
76
- let isShow = shallowRef(true);
77
- let isSpray = shallowRef(false);
78
- let deg = shallowRef(props.deg);
79
- //动画处理
80
- const fire = () => {
81
- myTop.value += 300;
82
- props.myRef.value.start();
83
- };
84
- //粒子效果
85
- const ImgData = [redStar, yellowStar, purpleStar];
86
- const sprayOk = {
87
- type: 0,
88
- particleNum: 100,
89
- deltaAngle: 360,
90
- deltaWidth: 20,
91
- deltaHeight: 20,
92
- pointSizeMin: 20,
93
- pointSizeMax: 30,
94
- speedMin: 1,
95
- speedMax: 7,
96
- lifeMin: 1000,
97
- lifeMax: 2000,
98
- accelerateX: 0,
99
- accelerateY: 0,
100
- addNumSpeed: 0.001,
101
- enableFade: true,
102
- enableShrink: true,
103
- };
104
- //动画结束播放粒子效果
105
- const onAnimEnd = () => {
106
- isShow.value = false;
107
- isSpray.value = true;
108
- };
109
- defineExpose({ fire });
110
- </script>
111
-
112
- <style scoped></style>
@@ -1,251 +0,0 @@
1
- <template>
2
- <div
3
- :style="{
4
- top: 500,
5
- left: 200,
6
- transform: `scale3d(${80 / view_size.w},${160 / view_size.h},1)`,
7
- }"
8
- >
9
- <JsvSpriteAnim
10
- :spriteInfo="sprite_info.info"
11
- :loop="1"
12
- autostart="true"
13
- :duration="1"
14
- :imageUrl="fireworksPng"
15
- >
16
- </JsvSpriteAnim>
17
- </div>
18
- <!-- FreeMove -->
19
- <jsv-free-move-actor
20
- v-if="isShow"
21
- :top="508 + 100"
22
- :left="236"
23
- ref="actorRef"
24
- :width="10"
25
- :height="10"
26
- >
27
- <div
28
- :style="{
29
- width: 8,
30
- height: 8,
31
- borderRadius: 4,
32
- backgroundColor: '#FF1213',
33
- }"
34
- ></div>
35
- </jsv-free-move-actor>
36
- <!-- 粒子效果 -->
37
- <div
38
- v-if="isSpray"
39
- :style="{
40
- top: 188,
41
- left: 220,
42
- width: 50,
43
- height: 50,
44
- }"
45
- >
46
- <jsv-spray
47
- v-for="item in ImgData"
48
- :pointRes="`url(${item})`"
49
- :sprayStyle="sprayOk"
50
- :ignoreClip="true"
51
- />
52
- </div>
53
- <div
54
- v-if="isSpray2"
55
- :style="{
56
- top: 188,
57
- left: 220,
58
- width: 50,
59
- height: 50,
60
- }"
61
- >
62
- <jsv-spray
63
- v-for="item in ImgData"
64
- :pointRes="`url(${item})`"
65
- :sprayStyle="sprayOk"
66
- :ignoreClip="true"
67
- />
68
- </div>
69
- <!-- 素材1 精灵图-->
70
- <div
71
- :style="{
72
- top: 100,
73
- left: 600,
74
- width: 210,
75
- height: 120,
76
- backgroundImage: fireworksPng,
77
- }"
78
- ></div>
79
- <!-- 素材2 金币图1 -->
80
- <div
81
- :style="{
82
- top: 340,
83
- left: 670,
84
- width: 50,
85
- height: 50,
86
- backgroundImage: GoldenCoin1,
87
- }"
88
- ></div>
89
- <!-- 素材3 金币图2 -->
90
- <div
91
- :style="{
92
- top: 550,
93
- left: 670,
94
- width: 50,
95
- height: 50,
96
- backgroundImage: GoldenCoin2,
97
- }"
98
- ></div>
99
- <!-- 素材4 星星1 -->
100
- <div
101
- :style="{
102
- top: 100,
103
- left: 980,
104
- width: 50,
105
- height: 50,
106
- backgroundImage: star1,
107
- }"
108
- ></div>
109
- <!-- 素材5 星星2 -->
110
- <div
111
- :style="{
112
- top: 260,
113
- left: 980,
114
- width: 50,
115
- height: 50,
116
- backgroundImage: star2,
117
- }"
118
- ></div>
119
- <!-- 素材6 星星3 -->
120
- <div
121
- :style="{
122
- top: 420,
123
- left: 980,
124
- width: 50,
125
- height: 50,
126
- backgroundImage: star3,
127
- }"
128
- ></div>
129
- <!-- 素材7 星星4 -->
130
- <div
131
- :style="{
132
- top: 580,
133
- left: 980,
134
- width: 50,
135
- height: 50,
136
- backgroundImage: star4,
137
- }"
138
- ></div>
139
- <!-- 文字说明 -->
140
- <div class="text" :style="{ top: 40, left: 600, width: 210, height: 100 }">
141
- {{ "素材1" }}
142
- </div>
143
- <div class="text" :style="{ top: 240, left: 600, width: 210, height: 100 }">
144
- {{ "素材2" }}
145
- </div>
146
- <div class="text" :style="{ top: 460, left: 600, width: 210, height: 100 }">
147
- {{ "素材3" }}
148
- </div>
149
- <div class="text" :style="{ top: 40, left: 900, width: 210, height: 100 }">
150
- {{ "素材4" }}
151
- </div>
152
- <div class="text" :style="{ top: 200, left: 900, width: 210, height: 100 }">
153
- {{ "素材5" }}
154
- </div>
155
- <div class="text" :style="{ top: 360, left: 900, width: 210, height: 100 }">
156
- {{ "素材6" }}
157
- </div>
158
- <div class="text" :style="{ top: 520, left: 900, width: 210, height: 100 }">
159
- {{ "素材7" }}
160
- </div>
161
- </template>
162
-
163
- <script setup>
164
- import {
165
- JsvFreeMoveActor,
166
- JsvSpriteAnim,
167
- JsvSpray,
168
- } from "jsview";
169
- import fireworksPng from "./Sprite/fireworks.png";
170
- import fireworksJson from "./Sprite/fireworks.json";
171
- import { _formatInfo } from "./Common/SpriteDeal";
172
- import GoldenCoin1 from "./images/goldencoin1.png";
173
- import GoldenCoin2 from "./images/goldencoin2.png";
174
- import star1 from "./images/star1.png";
175
- import star2 from "./images/star2.png";
176
- import star3 from "./images/star3.png";
177
- import star4 from "./images/star4.png";
178
- import { shallowRef, onMounted, onBeforeUnmount } from "vue";
179
- let sprite_info = shallowRef(_formatInfo(fireworksJson));
180
- const view_size = {
181
- w: sprite_info.value.maxW,
182
- h: sprite_info.value.maxH,
183
- };
184
- let isSpray = shallowRef(false);
185
- let isSpray2 = shallowRef(false);
186
- let isShow = shallowRef(true);
187
- let actorRef = shallowRef(null);
188
-
189
- let actorControl;
190
- //定时器
191
- let timer = { id: -1 };
192
- const ImgData = [GoldenCoin1, GoldenCoin2, star1, star2, star3, star4];
193
- // 建议:做粒子效果的图的像素尽量不超过 40 * 40
194
- const sprayOk = {
195
- type: 0,
196
- particleNum: 60,
197
- deltaAngle: 360,
198
- deltaWidth: 20,
199
- deltaHeight: 20,
200
- pointSizeMin: 30,
201
- pointSizeMax: 50,
202
- speedMin: 1,
203
- speedMax: 7,
204
- lifeMin: 1000,
205
- lifeMax: 2000,
206
- accelerateX: 0,
207
- accelerateY: 0,
208
- addNumSpeed: 0.001,
209
- enableFade: true,
210
- enableShrink: true,
211
- };
212
- onMounted(() => {
213
- actorControl = actorRef.value.control;
214
- actorControl.run([
215
- actorControl
216
- .condition()
217
- .onNextTick(2)
218
- .then([
219
- actorControl.action().setSpeed(undefined, -12),
220
- actorControl.action(3).setAccel(undefined, 0.13),
221
- ]),
222
- actorControl
223
- .condition()
224
- .reachPosition(undefined, -400)
225
- .then([
226
- actorControl.action().stopMoving(),
227
- () => {
228
- isSpray.value = true;
229
- isShow.value = false;
230
- timer.id = setTimeout(() => {
231
- isSpray2.value = true;
232
- }, 400);
233
- },
234
- ]),
235
- ]);
236
- });
237
- onBeforeUnmount(() => {
238
- clearTimeout(timer.id);
239
- timer.id = -1;
240
- });
241
- </script>
242
-
243
- <style scoped>
244
- .text {
245
- font-size: 24;
246
- color: #ffffff;
247
- font-weight: bold;
248
- text-align: center;
249
- line-height: 32;
250
- }
251
- </style>
File without changes