@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.
- package/CoupletsTest/App.vue +254 -93
- package/CoupletsTest/widget/Banger/Banger.vue +249 -0
- package/CoupletsTest/widget/Banger/Maroon.vue +130 -0
- package/CoupletsTest/widget/Banger/MaroonLoader.vue +81 -0
- package/CoupletsTest/widget/Couplets/Couplets.vue +194 -0
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +234 -0
- package/DemoHomepage/views/Homepage.vue +1 -1
- package/package.json +1 -1
- package/CoupletsTest/LeadWire.vue +0 -221
- package/CoupletsTest/Maroon.vue +0 -112
- package/CoupletsTest/Salvo.vue +0 -251
- /package/CoupletsTest/{Common → widget/Common}/SpriteDeal.js +0 -0
- /package/CoupletsTest/{Sprite → widget/Sprite}/firecracker.json +0 -0
- /package/CoupletsTest/{Sprite → widget/Sprite}/firecracker.png +0 -0
- /package/CoupletsTest/{Sprite → widget/Sprite}/fireworks.json +0 -0
- /package/CoupletsTest/{Sprite → widget/Sprite}/fireworks.png +0 -0
- /package/CoupletsTest/{Sprite → widget/Sprite}/scroll.json +0 -0
- /package/CoupletsTest/{Sprite → widget/Sprite}/scroll.png +0 -0
- /package/CoupletsTest/{Sprite → widget/Sprite}/spark.json +0 -0
- /package/CoupletsTest/{Sprite → widget/Sprite}/spark.png +0 -0
- /package/CoupletsTest/{images → widget/images}/Couplets.png +0 -0
- /package/CoupletsTest/{images → widget/images}/goldencoin1.png +0 -0
- /package/CoupletsTest/{images → widget/images}/goldencoin2.png +0 -0
- /package/CoupletsTest/{images → widget/images}/leadWire.png +0 -0
- /package/CoupletsTest/{images → widget/images}/line.png +0 -0
- /package/CoupletsTest/{images → widget/images}/purpleStar.png +0 -0
- /package/CoupletsTest/{images → widget/images}/redStar.png +0 -0
- /package/CoupletsTest/{images → widget/images}/scroll1.png +0 -0
- /package/CoupletsTest/{images → widget/images}/star1.png +0 -0
- /package/CoupletsTest/{images → widget/images}/star2.png +0 -0
- /package/CoupletsTest/{images → widget/images}/star3.png +0 -0
- /package/CoupletsTest/{images → widget/images}/star4.png +0 -0
- /package/CoupletsTest/{images → widget/images}/yellowStar.png +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<jsv-free-move-actor
|
|
3
|
+
:top="props.top"
|
|
4
|
+
:left="props.left"
|
|
5
|
+
:width="30"
|
|
6
|
+
:height="60"
|
|
7
|
+
ref="actorRef"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
:style="{
|
|
11
|
+
width: 30,
|
|
12
|
+
height: 60,
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
<div
|
|
16
|
+
:style="{
|
|
17
|
+
width: 30,
|
|
18
|
+
height: 40,
|
|
19
|
+
transform: `rotate3d(0,0,1,${deg}deg) scale3d(${40 / view_size.w},${
|
|
20
|
+
40 / view_size.w
|
|
21
|
+
},1)`,
|
|
22
|
+
transformOrigin: 'center center',
|
|
23
|
+
}"
|
|
24
|
+
>
|
|
25
|
+
<!-- 炮仗图 -->
|
|
26
|
+
<JsvSpriteAnim
|
|
27
|
+
:spriteInfo="maroonResource.firecrackerSet.info.value"
|
|
28
|
+
:loop="1"
|
|
29
|
+
:duration="0.8"
|
|
30
|
+
:imageUrl="maroonResource.firecrackerPng"
|
|
31
|
+
:onAnimEnd="onAnimEnd"
|
|
32
|
+
:ref="props.myRef"
|
|
33
|
+
>
|
|
34
|
+
</JsvSpriteAnim>
|
|
35
|
+
<!-- 喷射粒子 -->
|
|
36
|
+
<div
|
|
37
|
+
v-if="isSpray"
|
|
38
|
+
:style="{
|
|
39
|
+
top: view_size.h / 2,
|
|
40
|
+
left: view_size.w / 2,
|
|
41
|
+
width: view_size.w,
|
|
42
|
+
height: view_size.h,
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
<jsv-spray
|
|
46
|
+
v-for="item in ImgData"
|
|
47
|
+
:pointRes="`url(${item})`"
|
|
48
|
+
:sprayStyle="sprayOk"
|
|
49
|
+
:ignoreClip="true"
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</jsv-free-move-actor>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script setup>
|
|
58
|
+
import { shallowRef, watch, inject, onMounted } from "vue";
|
|
59
|
+
import { JsvSpriteAnim, JsvSpray, JsvFreeMoveActor } from "jsview";
|
|
60
|
+
import { _formatInfo } from "../Common/SpriteDeal";
|
|
61
|
+
const props = defineProps({
|
|
62
|
+
top: Number,
|
|
63
|
+
left: Number,
|
|
64
|
+
deg: Number,
|
|
65
|
+
controller: Object,
|
|
66
|
+
myRef: Object,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
let maroonResource = inject("maroonResource");
|
|
70
|
+
|
|
71
|
+
let view_size = maroonResource.firecrackerSet.viewSize;
|
|
72
|
+
|
|
73
|
+
//FreeMove
|
|
74
|
+
let actorRef = shallowRef(null);
|
|
75
|
+
let actorControl;
|
|
76
|
+
|
|
77
|
+
let isShow = shallowRef(true);
|
|
78
|
+
let isSpray = shallowRef(false);
|
|
79
|
+
let deg = shallowRef(props.deg);
|
|
80
|
+
|
|
81
|
+
//动画处理
|
|
82
|
+
const fire = () => {
|
|
83
|
+
props.myRef.value.start();
|
|
84
|
+
actorControl.run([
|
|
85
|
+
actorControl
|
|
86
|
+
.action()
|
|
87
|
+
.setSpdAndAccel(undefined, 0, undefined, 0.15, null, null),
|
|
88
|
+
actorControl
|
|
89
|
+
.condition()
|
|
90
|
+
.reachPosition(undefined, 280)
|
|
91
|
+
.then([actorControl.action().stopMoving()]),
|
|
92
|
+
]);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
//粒子效果
|
|
96
|
+
const ImgData = [
|
|
97
|
+
maroonResource.star1,
|
|
98
|
+
maroonResource.star2,
|
|
99
|
+
maroonResource.star3,
|
|
100
|
+
];
|
|
101
|
+
const sprayOk = {
|
|
102
|
+
type: 0,
|
|
103
|
+
particleNum: 100,
|
|
104
|
+
deltaAngle: 360,
|
|
105
|
+
deltaWidth: 20,
|
|
106
|
+
deltaHeight: 20,
|
|
107
|
+
pointSizeMin: 20,
|
|
108
|
+
pointSizeMax: 30,
|
|
109
|
+
speedMin: 1,
|
|
110
|
+
speedMax: 7,
|
|
111
|
+
lifeMin: 1000,
|
|
112
|
+
lifeMax: 2000,
|
|
113
|
+
accelerateX: 0,
|
|
114
|
+
accelerateY: 0,
|
|
115
|
+
addNumSpeed: 0.001,
|
|
116
|
+
enableFade: true,
|
|
117
|
+
enableShrink: true,
|
|
118
|
+
};
|
|
119
|
+
//动画结束播放粒子效果
|
|
120
|
+
const onAnimEnd = () => {
|
|
121
|
+
isShow.value = false;
|
|
122
|
+
isSpray.value = true;
|
|
123
|
+
};
|
|
124
|
+
onMounted(() => {
|
|
125
|
+
actorControl = actorRef.value.control;
|
|
126
|
+
});
|
|
127
|
+
defineExpose({ fire });
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<style scoped></style>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<JsvPreload
|
|
3
|
+
:preloadList="preload_info"
|
|
4
|
+
:onPreloadDone="loadDone"
|
|
5
|
+
></JsvPreload>
|
|
6
|
+
<JsvSpriteLoader
|
|
7
|
+
:imageUrl="maroonResource.firecrackerPng"
|
|
8
|
+
:configUrl="maroonResource.firecrackerJson"
|
|
9
|
+
:onConfigReady="preloadCallback"
|
|
10
|
+
:noNeedResource="false"
|
|
11
|
+
>
|
|
12
|
+
<slot v-if="sonFlag" />
|
|
13
|
+
</JsvSpriteLoader>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { shallowRef, watch, inject, provide } from "vue";
|
|
18
|
+
import { JsvPreload, buildPreloadInfo, JsvSpriteLoader } from "jsview";
|
|
19
|
+
import { _formatInfo } from "../Common/SpriteDeal";
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
top: Number,
|
|
22
|
+
left: Number,
|
|
23
|
+
deg: Number,
|
|
24
|
+
controller: Object,
|
|
25
|
+
myRef: Object,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const maroonResource = {
|
|
29
|
+
star1:
|
|
30
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/redStar.png",
|
|
31
|
+
star2:
|
|
32
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/yellowStar.png",
|
|
33
|
+
star3:
|
|
34
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/purpleStar.png",
|
|
35
|
+
firecrackerPng:
|
|
36
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/firecracker.png",
|
|
37
|
+
firecrackerJson:
|
|
38
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/firecracker.json",
|
|
39
|
+
firecrackerSet: {
|
|
40
|
+
info: shallowRef(null),
|
|
41
|
+
viewSize: shallowRef(null),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//预加载
|
|
46
|
+
const preload_info = [
|
|
47
|
+
buildPreloadInfo(maroonResource.start1),
|
|
48
|
+
buildPreloadInfo(maroonResource.start2),
|
|
49
|
+
buildPreloadInfo(maroonResource.start3),
|
|
50
|
+
buildPreloadInfo(maroonResource.firecrackerPng),
|
|
51
|
+
];
|
|
52
|
+
let sonFlag = inject("sonFlag");
|
|
53
|
+
|
|
54
|
+
provide("maroonResource", maroonResource);
|
|
55
|
+
|
|
56
|
+
let readyNum = shallowRef(0);
|
|
57
|
+
|
|
58
|
+
const loadDone = (a) => {
|
|
59
|
+
readyNum.value++;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const preloadCallback = (config_json, resolve_set) => {
|
|
63
|
+
let sprite_info = _formatInfo(config_json);
|
|
64
|
+
maroonResource.firecrackerSet.info.value = sprite_info.info;
|
|
65
|
+
maroonResource.firecrackerSet.viewSize.value = {
|
|
66
|
+
w: sprite_info.maxW,
|
|
67
|
+
h: sprite_info.maxH,
|
|
68
|
+
};
|
|
69
|
+
resolve_set(); // 通知loader数组设置完成
|
|
70
|
+
readyNum.value++;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
//ref
|
|
74
|
+
watch(readyNum, (n, o) => {
|
|
75
|
+
if (o != 2 && n == 2) {
|
|
76
|
+
sonFlag.value = true;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style scoped></style>
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* 【模块 export 内容】
|
|
3
|
+
* JsvCouplets:春联组件
|
|
4
|
+
* props说明:
|
|
5
|
+
* width {Number} 春联宽度
|
|
6
|
+
* animTime {Number} 春联滚动时间
|
|
7
|
+
* left {Number} 春联Left位置
|
|
8
|
+
* top {Number} 春联Top位置
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
<template>
|
|
12
|
+
<JsvPreload
|
|
13
|
+
:preloadList="preload_info"
|
|
14
|
+
:onPreloadDone="loadDone"
|
|
15
|
+
></JsvPreload>
|
|
16
|
+
<div
|
|
17
|
+
v-show="myShow"
|
|
18
|
+
:style="{
|
|
19
|
+
width: 180,
|
|
20
|
+
height: adaptedHeight,
|
|
21
|
+
top: props.top,
|
|
22
|
+
left: props.left,
|
|
23
|
+
transform: `scale3d(${props.width / 180},${props.width / 180},1)`,
|
|
24
|
+
transformOrigin: 'left top',
|
|
25
|
+
}"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
:style="{
|
|
29
|
+
top: 0,
|
|
30
|
+
left: 0,
|
|
31
|
+
width: 180,
|
|
32
|
+
height: adaptedHeight,
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
animation: aniName1,
|
|
35
|
+
}"
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
:style="{
|
|
39
|
+
top: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
width: 180,
|
|
42
|
+
height: adaptedHeight,
|
|
43
|
+
backgroundImage: Couplets,
|
|
44
|
+
animation: aniName2,
|
|
45
|
+
}"
|
|
46
|
+
></div>
|
|
47
|
+
</div>
|
|
48
|
+
<!-- 滚轴动画 -->
|
|
49
|
+
<JsvSpriteLoader
|
|
50
|
+
:imageUrl="scrollPng"
|
|
51
|
+
:configUrl="scrollJson"
|
|
52
|
+
:onConfigReady="preloadCallback"
|
|
53
|
+
:noNeedResource="false"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
:style="{
|
|
57
|
+
left: -30,
|
|
58
|
+
top: adaptedHeight,
|
|
59
|
+
transform: `scale3d(${(180 + 60) / view_size.w},1,1)`,
|
|
60
|
+
}"
|
|
61
|
+
>
|
|
62
|
+
<div
|
|
63
|
+
:style="{
|
|
64
|
+
width: view_size.w,
|
|
65
|
+
height: view_size.h,
|
|
66
|
+
animation: aniName1,
|
|
67
|
+
}"
|
|
68
|
+
>
|
|
69
|
+
<JsvSpriteAnim
|
|
70
|
+
:spriteInfo="sprite_info.info"
|
|
71
|
+
:loop="4"
|
|
72
|
+
:duration="props.animTime / 4"
|
|
73
|
+
:imageUrl="scrollPng"
|
|
74
|
+
ref="myRef"
|
|
75
|
+
>
|
|
76
|
+
</JsvSpriteAnim>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</JsvSpriteLoader>
|
|
80
|
+
<!-- 滚轴图片 -->
|
|
81
|
+
<div
|
|
82
|
+
:style="{
|
|
83
|
+
top: -30,
|
|
84
|
+
left: -30,
|
|
85
|
+
width: 180 + 60,
|
|
86
|
+
height: 30,
|
|
87
|
+
backgroundImage: scroll,
|
|
88
|
+
}"
|
|
89
|
+
></div>
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script setup>
|
|
94
|
+
import {
|
|
95
|
+
JsvSpriteAnim,
|
|
96
|
+
getKeyFramesGroup,
|
|
97
|
+
JsvSpriteLoader,
|
|
98
|
+
JsvPreload,
|
|
99
|
+
} from "jsview";
|
|
100
|
+
import { shallowRef, onBeforeUnmount, watch } from "vue";
|
|
101
|
+
import { _formatInfo } from "../Common/SpriteDeal";
|
|
102
|
+
import { buildPreloadInfo } from "../../../../jsview-vue/utils";
|
|
103
|
+
const props = defineProps({
|
|
104
|
+
width: { type: Number, require: true },
|
|
105
|
+
height: { type: Number, require: true },
|
|
106
|
+
animTime: { type: Number, require: true },
|
|
107
|
+
left: { type: Number, default: 0 },
|
|
108
|
+
top: { type: Number, default: 0 },
|
|
109
|
+
});
|
|
110
|
+
let myShow = shallowRef(false);
|
|
111
|
+
const Couplets =
|
|
112
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/Couplets.png";
|
|
113
|
+
const scrollPng =
|
|
114
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/scroll.png";
|
|
115
|
+
const scrollJson =
|
|
116
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/scroll.json";
|
|
117
|
+
const scroll =
|
|
118
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/scroll1.png";
|
|
119
|
+
|
|
120
|
+
//预加载
|
|
121
|
+
const preload_info = [
|
|
122
|
+
buildPreloadInfo(Couplets),
|
|
123
|
+
buildPreloadInfo(scrollPng),
|
|
124
|
+
buildPreloadInfo(scroll),
|
|
125
|
+
];
|
|
126
|
+
//春联高度(可修改适配)
|
|
127
|
+
let adaptedHeight = 500;
|
|
128
|
+
|
|
129
|
+
let readyNum = shallowRef(0);
|
|
130
|
+
const loadDone = (a) => {
|
|
131
|
+
readyNum.value++;
|
|
132
|
+
};
|
|
133
|
+
let sprite_info = shallowRef(null);
|
|
134
|
+
const view_size = shallowRef(null);
|
|
135
|
+
const preloadCallback = (config_json, resolve_set) => {
|
|
136
|
+
sprite_info.value = _formatInfo(config_json);
|
|
137
|
+
view_size.value = {
|
|
138
|
+
w: sprite_info.value.maxW,
|
|
139
|
+
h: sprite_info.value.maxH,
|
|
140
|
+
};
|
|
141
|
+
resolve_set(); // 通知loader数组设置完成
|
|
142
|
+
readyNum.value++;
|
|
143
|
+
};
|
|
144
|
+
//动画名字
|
|
145
|
+
let aniName1 = shallowRef(null);
|
|
146
|
+
let aniName2 = shallowRef(null);
|
|
147
|
+
|
|
148
|
+
//插入动画
|
|
149
|
+
const idRandom = Math.floor(Math.random() * 1000000);
|
|
150
|
+
let name1 = "anim1-" + idRandom;
|
|
151
|
+
let name2 = "anim2-" + idRandom;
|
|
152
|
+
let styleShell = getKeyFramesGroup();
|
|
153
|
+
let anim1 = `@keyframes ${name1} {
|
|
154
|
+
from {
|
|
155
|
+
transform: translate3d(0,${-adaptedHeight}, 0);
|
|
156
|
+
}
|
|
157
|
+
to {
|
|
158
|
+
transform: translate3d(0, 0, 0);
|
|
159
|
+
}
|
|
160
|
+
}`;
|
|
161
|
+
styleShell.insertRule(anim1);
|
|
162
|
+
let anim2 = `@keyframes ${name2} {
|
|
163
|
+
from {
|
|
164
|
+
transform: translate3d(0,${adaptedHeight}, 0);
|
|
165
|
+
}
|
|
166
|
+
to {
|
|
167
|
+
transform: translate3d(0, 0, 0);
|
|
168
|
+
}
|
|
169
|
+
}`;
|
|
170
|
+
styleShell.insertRule(anim2);
|
|
171
|
+
|
|
172
|
+
let timer = { id: -1 };
|
|
173
|
+
//ref
|
|
174
|
+
let myRef = shallowRef(null);
|
|
175
|
+
watch(readyNum, (n, o) => {
|
|
176
|
+
if (o != 2 && n == 2) {
|
|
177
|
+
timer.id = setTimeout(() => {
|
|
178
|
+
myShow.value = true;
|
|
179
|
+
myRef.value.start();
|
|
180
|
+
aniName1.value = `${name1} ${props.animTime}s linear`;
|
|
181
|
+
aniName2.value = `${name2} ${props.animTime}s linear`;
|
|
182
|
+
}, 0);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
onBeforeUnmount(() => {
|
|
187
|
+
styleShell.removeRule(name1);
|
|
188
|
+
styleShell.removeRule(name2);
|
|
189
|
+
clearTimeout(timer.id);
|
|
190
|
+
timer.id = -1;
|
|
191
|
+
});
|
|
192
|
+
</script>
|
|
193
|
+
|
|
194
|
+
<style scoped></style>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* 【模块 export 内容】
|
|
3
|
+
* Fireworks:放烟花组件
|
|
4
|
+
* props说明:
|
|
5
|
+
* left {Number} 烟花Left位置
|
|
6
|
+
* top {Number} 烟花Top位置
|
|
7
|
+
*
|
|
8
|
+
-->
|
|
9
|
+
<template>
|
|
10
|
+
<JsvPreload
|
|
11
|
+
:preloadList="preload_info"
|
|
12
|
+
:onPreloadDone="loadDone"
|
|
13
|
+
></JsvPreload>
|
|
14
|
+
|
|
15
|
+
<JsvSpriteLoader
|
|
16
|
+
:imageUrl="fireworksPng"
|
|
17
|
+
:configUrl="fireworksJson"
|
|
18
|
+
:onConfigReady="preloadCallback"
|
|
19
|
+
:noNeedResource="false"
|
|
20
|
+
>
|
|
21
|
+
<div
|
|
22
|
+
v-show="myShow"
|
|
23
|
+
:style="{
|
|
24
|
+
top: props.top,
|
|
25
|
+
left: props.left,
|
|
26
|
+
transform: `scale3d(${80 / view_size.w},${160 / view_size.h},1)`,
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
:style="{
|
|
31
|
+
top: -170,
|
|
32
|
+
left: -45,
|
|
33
|
+
}"
|
|
34
|
+
>
|
|
35
|
+
<JsvSpriteAnim
|
|
36
|
+
:spriteInfo="sprite_info.info"
|
|
37
|
+
:loop="1"
|
|
38
|
+
:duration="1"
|
|
39
|
+
:imageUrl="fireworksPng"
|
|
40
|
+
ref="myRef"
|
|
41
|
+
>
|
|
42
|
+
</JsvSpriteAnim>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</JsvSpriteLoader>
|
|
46
|
+
<!-- FreeMove -->
|
|
47
|
+
<jsv-free-move-actor
|
|
48
|
+
v-if="isShow"
|
|
49
|
+
:top="props.top + 40"
|
|
50
|
+
:left="props.left + 15"
|
|
51
|
+
ref="actorRef"
|
|
52
|
+
:width="10"
|
|
53
|
+
:height="10"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
:style="{
|
|
57
|
+
width: 8,
|
|
58
|
+
height: 8,
|
|
59
|
+
backgroundImage: star2,
|
|
60
|
+
}"
|
|
61
|
+
></div>
|
|
62
|
+
</jsv-free-move-actor>
|
|
63
|
+
<!-- 粒子效果 -->
|
|
64
|
+
<div
|
|
65
|
+
v-if="isSpray"
|
|
66
|
+
:style="{
|
|
67
|
+
top: props.top - 400 + 20,
|
|
68
|
+
left: props.left,
|
|
69
|
+
width: 50,
|
|
70
|
+
height: 50,
|
|
71
|
+
}"
|
|
72
|
+
>
|
|
73
|
+
<jsv-spray
|
|
74
|
+
v-for="item in ImgData"
|
|
75
|
+
:pointRes="`url(${item})`"
|
|
76
|
+
:sprayStyle="sprayOk"
|
|
77
|
+
:ignoreClip="true"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
<div
|
|
81
|
+
v-if="isSpray2"
|
|
82
|
+
:style="{
|
|
83
|
+
top: props.top - 400 + 20,
|
|
84
|
+
left: props.left,
|
|
85
|
+
width: 50,
|
|
86
|
+
height: 50,
|
|
87
|
+
}"
|
|
88
|
+
>
|
|
89
|
+
<jsv-spray
|
|
90
|
+
v-for="item in ImgData"
|
|
91
|
+
:pointRes="`url(${item})`"
|
|
92
|
+
:sprayStyle="sprayOk"
|
|
93
|
+
:ignoreClip="true"
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<script setup>
|
|
99
|
+
import {
|
|
100
|
+
JsvFreeMoveActor,
|
|
101
|
+
JsvSpriteAnim,
|
|
102
|
+
JsvSpray,
|
|
103
|
+
JsvPreload,
|
|
104
|
+
buildPreloadInfo,
|
|
105
|
+
JsvSpriteLoader,
|
|
106
|
+
} from "jsview";
|
|
107
|
+
import { _formatInfo } from "../Common/SpriteDeal";
|
|
108
|
+
import { shallowRef, onMounted, onBeforeUnmount, watch } from "vue";
|
|
109
|
+
const props = defineProps({
|
|
110
|
+
top: { type: Number, require: true },
|
|
111
|
+
left: { type: Number, require: true },
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const star1 =
|
|
115
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/star1.png";
|
|
116
|
+
const star2 =
|
|
117
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/star2.png";
|
|
118
|
+
const star3 =
|
|
119
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/star3.png";
|
|
120
|
+
const star4 =
|
|
121
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/star4.png";
|
|
122
|
+
const GoldenCoin1 =
|
|
123
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/goldencoin1.png";
|
|
124
|
+
const GoldenCoin2 =
|
|
125
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/goldencoin2.png";
|
|
126
|
+
|
|
127
|
+
const fireworksPng =
|
|
128
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/fireworks.png";
|
|
129
|
+
const fireworksJson =
|
|
130
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/fireworks.json";
|
|
131
|
+
|
|
132
|
+
let sprite_info = shallowRef(null);
|
|
133
|
+
let view_size = shallowRef(null);
|
|
134
|
+
let isSpray = shallowRef(false);
|
|
135
|
+
let isSpray2 = shallowRef(false);
|
|
136
|
+
let isShow = shallowRef(true);
|
|
137
|
+
let actorRef = shallowRef(null);
|
|
138
|
+
let myShow=shallowRef(false)
|
|
139
|
+
let actorControl;
|
|
140
|
+
|
|
141
|
+
//预加载
|
|
142
|
+
const preload_info = [
|
|
143
|
+
buildPreloadInfo(star1),
|
|
144
|
+
buildPreloadInfo(star2),
|
|
145
|
+
buildPreloadInfo(star3),
|
|
146
|
+
buildPreloadInfo(star4),
|
|
147
|
+
buildPreloadInfo(GoldenCoin1),
|
|
148
|
+
buildPreloadInfo(GoldenCoin2),
|
|
149
|
+
buildPreloadInfo(fireworksPng),
|
|
150
|
+
];
|
|
151
|
+
let readyNum = shallowRef(0);
|
|
152
|
+
const loadDone = (a) => {
|
|
153
|
+
readyNum.value++;
|
|
154
|
+
};
|
|
155
|
+
const preloadCallback = (config_json, resolve_set) => {
|
|
156
|
+
sprite_info.value = _formatInfo(config_json);
|
|
157
|
+
console.log(sprite_info.value);
|
|
158
|
+
view_size.value = {
|
|
159
|
+
w: sprite_info.value.maxW,
|
|
160
|
+
h: sprite_info.value.maxH,
|
|
161
|
+
};
|
|
162
|
+
console.log("view_size: " + view_size.value);
|
|
163
|
+
resolve_set(); // 通知loader数组设置完成
|
|
164
|
+
readyNum.value++;
|
|
165
|
+
};
|
|
166
|
+
//定时器
|
|
167
|
+
let timer = { id: -1, id2: -1 };
|
|
168
|
+
//ref
|
|
169
|
+
let myRef = shallowRef(null);
|
|
170
|
+
const ImgData = [GoldenCoin1, GoldenCoin2, star1, star2, star3, star4];
|
|
171
|
+
// 建议:做粒子效果的图的像素尽量不超过 40 * 40
|
|
172
|
+
const sprayOk = {
|
|
173
|
+
type: 0,
|
|
174
|
+
particleNum: 60,
|
|
175
|
+
deltaAngle: 360,
|
|
176
|
+
deltaWidth: 20,
|
|
177
|
+
deltaHeight: 20,
|
|
178
|
+
pointSizeMin: 30,
|
|
179
|
+
pointSizeMax: 50,
|
|
180
|
+
speedMin: 1,
|
|
181
|
+
speedMax: 7,
|
|
182
|
+
lifeMin: 1000,
|
|
183
|
+
lifeMax: 2000,
|
|
184
|
+
accelerateX: 0,
|
|
185
|
+
accelerateY: 0,
|
|
186
|
+
addNumSpeed: 0.001,
|
|
187
|
+
enableFade: true,
|
|
188
|
+
enableShrink: true,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
watch(readyNum, (n, o) => {
|
|
192
|
+
if (o != 2 && n == 2) {
|
|
193
|
+
myShow.value=true
|
|
194
|
+
timer.id2 = setTimeout(() => {
|
|
195
|
+
myRef.value.start();
|
|
196
|
+
|
|
197
|
+
actorControl.run([
|
|
198
|
+
actorControl
|
|
199
|
+
.condition()
|
|
200
|
+
.onNextTick(2)
|
|
201
|
+
.then([
|
|
202
|
+
actorControl.action().setSpeed(undefined, -12),
|
|
203
|
+
actorControl.action(3).setAccel(undefined, 0.13),
|
|
204
|
+
]),
|
|
205
|
+
actorControl
|
|
206
|
+
.condition()
|
|
207
|
+
.reachPosition(undefined, -400)
|
|
208
|
+
.then([
|
|
209
|
+
actorControl.action().stopMoving(),
|
|
210
|
+
() => {
|
|
211
|
+
isSpray.value = true;
|
|
212
|
+
isShow.value = false;
|
|
213
|
+
timer.id = setTimeout(() => {
|
|
214
|
+
isSpray2.value = true;
|
|
215
|
+
}, 500);
|
|
216
|
+
},
|
|
217
|
+
]),
|
|
218
|
+
]);
|
|
219
|
+
}, 0);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
onMounted(() => {
|
|
224
|
+
actorControl = actorRef.value.control;
|
|
225
|
+
});
|
|
226
|
+
onBeforeUnmount(() => {
|
|
227
|
+
clearTimeout(timer.id);
|
|
228
|
+
timer.id = -1;
|
|
229
|
+
clearTimeout(timer.id2);
|
|
230
|
+
timer.id2 = -1;
|
|
231
|
+
});
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<style scoped></style>
|
|
@@ -141,7 +141,7 @@ onDeactivated(() => {
|
|
|
141
141
|
<div class="address">
|
|
142
142
|
{{ address }}
|
|
143
143
|
</div>
|
|
144
|
-
<div class="logo">{{ 'JsView-Vue3 (
|
|
144
|
+
<div class="logo">{{ 'JsView-Vue3 (Vite3) [' + (isDevelopment ? 'Debug' : 'Release') + ']' }}</div>
|
|
145
145
|
|
|
146
146
|
<jsv-focus-block
|
|
147
147
|
autoFocus
|