@shijiu/jsview-vue-samples 2.2.35 → 2.2.201
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/BakeViewDemo/AnimatePic.vue +93 -0
- package/BakeViewDemo/App.vue +109 -0
- package/ClickDivDemo/App.vue +150 -0
- package/CoupletsTest/widget/Banger/Maroon.vue +4 -6
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +52 -42
- package/CustomShader/App.vue +157 -0
- package/CustomShader/gaussianBlur.glsl +27 -0
- package/CustomShader/pageFlip.glsl +40 -0
- package/CustomShader/sdf.glsl +22 -0
- package/CustomShader/test.glsl +8 -0
- package/CustomShader/vortex.glsl +38 -0
- package/DemoHomepage/App.vue +36 -27
- package/DemoHomepage/components/Dialog.vue +37 -11
- package/DemoHomepage/components/TabFrame.vue +8 -1
- package/DemoHomepage/router.js +71 -26
- package/DemoHomepage/views/Homepage.vue +30 -13
- package/DriftScopeTest/App.vue +128 -0
- package/FocusMoveStyle/App.vue +21 -4
- package/FocusMoveStyle/FoldableItem.vue +39 -12
- package/FreeMove/App.vue +62 -64
- package/FreeMoveChildAttract/App.vue +105 -0
- package/FreeMoveLink/App.vue +55 -0
- package/FreeMoveResize/App.vue +102 -0
- package/ImpactStop/App.vue +45 -45
- package/LongImage/App.vue +1 -2
- package/LongText/App.vue +3 -5
- package/LongText/LongTextScroll.vue +83 -38
- package/LongText/Scroll.vue +28 -9
- package/LongTextLatex/App.vue +93 -0
- package/LongTextLatex/Button.vue +50 -0
- package/LongTextLatex/ButtonItem.vue +44 -0
- package/LongTextLatex/LongTextScroll.vue +189 -0
- package/LongTextLatex/Scroll.vue +14 -0
- package/MetroWidgetDemos/MassiveItems/App.vue +87 -0
- package/MetroWidgetDemos/MassiveItems/ContentItem.vue +388 -0
- package/MetroWidgetDemos/MassiveItems/Item.vue +203 -0
- package/MetroWidgetDemos/MassiveItems/WidgetItem.vue +101 -0
- package/MetroWidgetDemos/MassiveItems/data.js +17 -0
- package/MetroWidgetDemos/PingPong/AppPage.vue +19 -9
- package/MetroWidgetDemos/RefreshDemo/App.vue +172 -56
- package/MetroWidgetDemos/RefreshDemo/ControlItem.vue +45 -0
- package/MetroWidgetDemos/RefreshDemo/Item.vue +20 -4
- package/MetroWidgetDemos/routeList.js +6 -0
- package/SceneTransition/JsvSceneTransition.vue +30 -42
- package/ScrollBoxTest/App.vue +109 -0
- package/ScrollBoxTest/ClipBar.vue +153 -0
- package/ScrollBoxTest/DrawCircle.ts +25 -0
- package/ScrollBoxTest/NinePatchBar.vue +187 -0
- package/ScrollBoxTest/NoBackgroundBar.vue +125 -0
- package/ScrollBoxTest/SizeDivBar.vue +138 -0
- package/TestNativeSharedView/App.vue +166 -73
- package/TextureAnimation/App2.vue +17 -6
- package/TombSweepingDayTest/Raining/Rain.vue +8 -8
- package/TombSweepingDayTest/Raining/RainScene.vue +36 -24
- package/package.json +1 -1
- package/MetroWidgetDemos/RefreshDemo/data.js +0 -16
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted, onUnmounted, shallowRef } from "vue";
|
|
3
|
+
import { getDataUrl } from "../CommonUtils/ResourceData";
|
|
4
|
+
//无网络环境下使用
|
|
5
|
+
const DemoResourceBase = getDataUrl();
|
|
6
|
+
const item_url = DemoResourceBase
|
|
7
|
+
? `${DemoResourceBase}/27bda620942566673ab449a3ef765321.png`
|
|
8
|
+
: "http://oss.image.qcast.cn/homepage/20210209/27bda620942566673ab449a3ef765321.png";
|
|
9
|
+
|
|
10
|
+
const staticLeftPos = shallowRef(0);
|
|
11
|
+
let moveLeftTimer = -1;
|
|
12
|
+
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
moveLeftTimer = setInterval(() => {
|
|
15
|
+
if (staticLeftPos.value > 200) {
|
|
16
|
+
staticLeftPos.value = 0;
|
|
17
|
+
} else {
|
|
18
|
+
staticLeftPos.value = staticLeftPos.value + 10;
|
|
19
|
+
}
|
|
20
|
+
}, 800);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
onUnmounted(() => {
|
|
24
|
+
if (moveLeftTimer != -1) {
|
|
25
|
+
clearInterval(moveLeftTimer);
|
|
26
|
+
moveLeftTimer = -1;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div>
|
|
33
|
+
<div
|
|
34
|
+
:style="{
|
|
35
|
+
left: staticLeftPos,
|
|
36
|
+
width: 50,
|
|
37
|
+
height: 50,
|
|
38
|
+
backgroundImage: `url(${item_url})`,
|
|
39
|
+
}"
|
|
40
|
+
/>
|
|
41
|
+
<div
|
|
42
|
+
className="blockStyle"
|
|
43
|
+
:style="{
|
|
44
|
+
backgroundColor: '#0000FF',
|
|
45
|
+
animation: 'opacityDemo_CompositeNoOpacity 3s infinite',
|
|
46
|
+
}"
|
|
47
|
+
/>
|
|
48
|
+
<img
|
|
49
|
+
className="blockStyle"
|
|
50
|
+
:style="{
|
|
51
|
+
objectFit: 'contain',
|
|
52
|
+
animation: 'opacityDemo_CompositeOpacity 3s infinite',
|
|
53
|
+
}"
|
|
54
|
+
:src="item_url"
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<style scoped>
|
|
60
|
+
.blockStyle {
|
|
61
|
+
top: 50;
|
|
62
|
+
left: 50;
|
|
63
|
+
width: 150;
|
|
64
|
+
height: 150;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.picTitleTextClass {
|
|
68
|
+
font-size: 25;
|
|
69
|
+
height: 68;
|
|
70
|
+
line-height: 34;
|
|
71
|
+
color: #000000;
|
|
72
|
+
text-align: "center";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@keyframes opacityDemo_CompositeOpacity {
|
|
76
|
+
from {
|
|
77
|
+
transform: translate3d(50%, 30, 0) scale3d(1.5, 1.5, 1)
|
|
78
|
+
rotate3d(1.5, 1, 0, 90deg) skew(30deg, 45deg);
|
|
79
|
+
opacity: 0.1;
|
|
80
|
+
}
|
|
81
|
+
to {
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@keyframes opacityDemo_CompositeNoOpacity {
|
|
86
|
+
from {
|
|
87
|
+
transform: translate3d(50%, 30, 0) scale3d(1.5, 1.5, 1)
|
|
88
|
+
rotate3d(1.5, 1, 0, 90deg) skew(30deg, 45deg);
|
|
89
|
+
}
|
|
90
|
+
to {
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</style>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-04-20 21:05:26
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-08 11:16:52
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { onMounted, onUnmounted, shallowRef } from "vue";
|
|
10
|
+
import { useRouter } from "vue-router";
|
|
11
|
+
import AnimatePic from "./AnimatePic.vue";
|
|
12
|
+
import { jJsvRuntimeBridge, JsvTextureStoreApi, JsvFilterView } from "jsview";
|
|
13
|
+
|
|
14
|
+
const router = useRouter();
|
|
15
|
+
|
|
16
|
+
const vCapturedTexture = shallowRef(null);
|
|
17
|
+
// const vCapturedTexture = shallowRef("123");
|
|
18
|
+
const vToCapture = shallowRef(null);
|
|
19
|
+
|
|
20
|
+
window.MyCapture = vToCapture;
|
|
21
|
+
|
|
22
|
+
const _onKeyDown = (ev) => {
|
|
23
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
24
|
+
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let loopCaptureTimer = -1;
|
|
30
|
+
|
|
31
|
+
onMounted(() => {
|
|
32
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
33
|
+
|
|
34
|
+
loopCaptureTimer = setInterval(() => {
|
|
35
|
+
JsvTextureStoreApi.capture2Texture(
|
|
36
|
+
vToCapture.value,
|
|
37
|
+
(textureName, autoRecycle, w, h) => {
|
|
38
|
+
vCapturedTexture.value = textureName;
|
|
39
|
+
console.log(`capture done id=${textureName} w=${w} h=${h}`);
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}, 2200);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
onUnmounted(() => {
|
|
46
|
+
if (loopCaptureTimer != -1) {
|
|
47
|
+
clearInterval(loopCaptureTimer);
|
|
48
|
+
loopCaptureTimer = -1;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<jsv-focus-block
|
|
55
|
+
autoFocus
|
|
56
|
+
:onAction="{
|
|
57
|
+
onKeyDown: _onKeyDown,
|
|
58
|
+
}"
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
:style="{
|
|
62
|
+
textAlign: 'center',
|
|
63
|
+
fontSize: 30,
|
|
64
|
+
lineHeight: 50,
|
|
65
|
+
color: '#ffffff',
|
|
66
|
+
left: 140,
|
|
67
|
+
top: 20,
|
|
68
|
+
width: 1000,
|
|
69
|
+
height: 50,
|
|
70
|
+
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
71
|
+
}"
|
|
72
|
+
>
|
|
73
|
+
左边的div会被制成快照(每2秒)显示在右图
|
|
74
|
+
</div>
|
|
75
|
+
<div
|
|
76
|
+
ref="vToCapture"
|
|
77
|
+
:style="{
|
|
78
|
+
left: 140,
|
|
79
|
+
top: 200,
|
|
80
|
+
width: 300, // 截屏区域的宽
|
|
81
|
+
height: 300, // 截屏区域的高
|
|
82
|
+
}"
|
|
83
|
+
>
|
|
84
|
+
<jsv-filter-view :width="300" :height="300">
|
|
85
|
+
<div
|
|
86
|
+
:style="{
|
|
87
|
+
width: 300,
|
|
88
|
+
height: 300,
|
|
89
|
+
backgroundColor: 'rgb(128, 128, 0)',
|
|
90
|
+
}"
|
|
91
|
+
/>
|
|
92
|
+
<animate-pic />
|
|
93
|
+
</jsv-filter-view>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<div
|
|
97
|
+
v-if="vCapturedTexture != null"
|
|
98
|
+
:style="{
|
|
99
|
+
top: 200,
|
|
100
|
+
left: 650,
|
|
101
|
+
width: 150,
|
|
102
|
+
height: 150,
|
|
103
|
+
backgroundImage: `jsvtexturestore://${vCapturedTexture}`,
|
|
104
|
+
}"
|
|
105
|
+
/>
|
|
106
|
+
</jsv-focus-block>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<style scoped></style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-08-30 10:58:38
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-08-30 14:20:46
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { shallowRef, onMounted } from "vue";
|
|
10
|
+
import { useRouter } from "vue-router";
|
|
11
|
+
|
|
12
|
+
const router = useRouter();
|
|
13
|
+
|
|
14
|
+
const onKeyDown = (ev) => {
|
|
15
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
16
|
+
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// @click处理项目的响应处理
|
|
22
|
+
const clickItemColor = shallowRef("#c3aa20");
|
|
23
|
+
const onClickItemClick = () => {
|
|
24
|
+
clickItemColor.value = "#ba69af";
|
|
25
|
+
// 点击后改变背景颜色来提示
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
clickItemColor.value = "#c3aa20";
|
|
28
|
+
}, 150);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// TapListener处理项目的响应处理
|
|
32
|
+
const tapItemColor = shallowRef("#c3aa20");
|
|
33
|
+
const tapDivRef = shallowRef(null);
|
|
34
|
+
const registerTap = () => {
|
|
35
|
+
tapDivRef.value.jsvSetTapListener({
|
|
36
|
+
// 长按响应,以变色来回应
|
|
37
|
+
onLongPress: () => {
|
|
38
|
+
tapItemColor.value = "#25ac47";
|
|
39
|
+
console.log("Long pressed");
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// 长按响应结束,以颜色还原来回应
|
|
43
|
+
onLongPressRelease: () => {
|
|
44
|
+
tapItemColor.value = "#c3aa20";
|
|
45
|
+
console.log("Long pressed release");
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
// 长按响应取消,通过长按 + 不放手时移动阿里激活,以颜色还原来回应
|
|
49
|
+
onCancel: () => {
|
|
50
|
+
tapItemColor.value = "#c3aa20";
|
|
51
|
+
console.log("canceled");
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// 同样的click处理,以blink来回应
|
|
55
|
+
onClick: () => {
|
|
56
|
+
console.log("onClicked");
|
|
57
|
+
tapItemColor.value = "#ba69af";
|
|
58
|
+
// 点击后改变背景颜色来提示
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
tapItemColor.value = "#c3aa20";
|
|
61
|
+
}, 150);
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
onMounted(() => {
|
|
67
|
+
registerTap();
|
|
68
|
+
});
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<jsv-focus-block
|
|
73
|
+
autoFocus
|
|
74
|
+
:style="{
|
|
75
|
+
width: 1920,
|
|
76
|
+
height: 1080,
|
|
77
|
+
backgroundColor: '#007788',
|
|
78
|
+
}"
|
|
79
|
+
:onAction="{
|
|
80
|
+
onKeyDown: onKeyDown,
|
|
81
|
+
}"
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
class="baseTextSet"
|
|
85
|
+
:style="{
|
|
86
|
+
lineHeight: 50,
|
|
87
|
+
left: 140,
|
|
88
|
+
top: 20,
|
|
89
|
+
width: 1000,
|
|
90
|
+
height: 50,
|
|
91
|
+
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
92
|
+
}"
|
|
93
|
+
>
|
|
94
|
+
展示两种接受点击事件div的写法
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div
|
|
98
|
+
class="baseTextSet clickItem"
|
|
99
|
+
:style="{
|
|
100
|
+
left: 300,
|
|
101
|
+
top: 230,
|
|
102
|
+
backgroundColor: clickItemColor,
|
|
103
|
+
}"
|
|
104
|
+
@click="onClickItemClick"
|
|
105
|
+
>
|
|
106
|
+
{{ "@click" }}
|
|
107
|
+
</div>
|
|
108
|
+
<div
|
|
109
|
+
class="baseTextSet"
|
|
110
|
+
:style="{ left: 174, top: 350, width: 400, height: 50, lineHeight: 50 }"
|
|
111
|
+
>
|
|
112
|
+
{{ "点击会闪紫色" }}
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div
|
|
116
|
+
class="baseTextSet clickItem"
|
|
117
|
+
ref="tapDivRef"
|
|
118
|
+
:style="{
|
|
119
|
+
left: 600,
|
|
120
|
+
top: 230,
|
|
121
|
+
backgroundColor: tapItemColor,
|
|
122
|
+
width: 320,
|
|
123
|
+
lineHeight: 50,
|
|
124
|
+
}"
|
|
125
|
+
>
|
|
126
|
+
{{ "TapListener\n支持Click/LongPress" }}
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div
|
|
130
|
+
class="baseTextSet"
|
|
131
|
+
:style="{ left: 550, top: 350, width: 400, height: 100, lineHeight: 50 }"
|
|
132
|
+
>
|
|
133
|
+
{{ "点击会闪紫色\n长按会出现绿色" }}
|
|
134
|
+
</div>
|
|
135
|
+
</jsv-focus-block>
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<style scoped>
|
|
139
|
+
.baseTextSet {
|
|
140
|
+
text-align: center;
|
|
141
|
+
font-size: 30;
|
|
142
|
+
color: #ffffff;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.clickItem {
|
|
146
|
+
width: 150;
|
|
147
|
+
height: 100;
|
|
148
|
+
line-height: 100;
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
@@ -81,14 +81,12 @@ let deg = shallowRef(props.deg);
|
|
|
81
81
|
//动画处理
|
|
82
82
|
const fire = () => {
|
|
83
83
|
props.myRef.value.start();
|
|
84
|
-
actorControl.run([
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.setSpdAndAccel(undefined, 0, undefined, 0.15, null, null),
|
|
88
|
-
actorControl
|
|
84
|
+
actorControl.run((cmds) => [
|
|
85
|
+
cmds.action().setSpdAndAccel(undefined, 0, undefined, 0.15, null, null),
|
|
86
|
+
cmds
|
|
89
87
|
.condition()
|
|
90
88
|
.reachPosition(undefined, 280)
|
|
91
|
-
.then([
|
|
89
|
+
.then([cmds.action().stopMoving()]),
|
|
92
90
|
]);
|
|
93
91
|
};
|
|
94
92
|
|
|
@@ -160,16 +160,26 @@ const props = defineProps({
|
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
//火花图片素材
|
|
163
|
-
const group1_1 =
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
163
|
+
const group1_1 =
|
|
164
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/1/group1_1.png";
|
|
165
|
+
const group1_2 =
|
|
166
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/1/group1_2.png";
|
|
167
|
+
const group2_1 =
|
|
168
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/2/group2_1.png";
|
|
169
|
+
const group2_2 =
|
|
170
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/2/group2_2.png";
|
|
171
|
+
const group3_1 =
|
|
172
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/3/group3_1.png";
|
|
173
|
+
const group3_2 =
|
|
174
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/3/group3_2.png";
|
|
175
|
+
const group4_1 =
|
|
176
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/4/group4_1.png";
|
|
177
|
+
const group4_2 =
|
|
178
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/4/group4_2.png";
|
|
179
|
+
const group5_1 =
|
|
180
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/5/group5_1.png";
|
|
181
|
+
const group5_2 =
|
|
182
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Fireworks/images/5/group5_2.png";
|
|
173
183
|
//弹药图片素材(请按需修改)
|
|
174
184
|
const ammo =
|
|
175
185
|
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/images/star2.png";
|
|
@@ -180,7 +190,7 @@ const fireworksJson =
|
|
|
180
190
|
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/SpringFestivalTest_2024/Sprite/fireworks.json";
|
|
181
191
|
|
|
182
192
|
//运动距离
|
|
183
|
-
let moveDistance = 260
|
|
193
|
+
let moveDistance = 260;
|
|
184
194
|
let sprite_info = shallowRef(null);
|
|
185
195
|
let view_size = shallowRef(null);
|
|
186
196
|
let isSpray = shallowRef(false);
|
|
@@ -195,7 +205,7 @@ let actorRef = shallowRef(null);
|
|
|
195
205
|
let myShow = shallowRef(false);
|
|
196
206
|
let actorControl;
|
|
197
207
|
//随机顺序绽放函数
|
|
198
|
-
const spray=()=> {
|
|
208
|
+
const spray = () => {
|
|
199
209
|
timer.id2 = setTimeout(() => {
|
|
200
210
|
let randomIndex = Math.floor(Math.random() * sprayArray.length);
|
|
201
211
|
sprayArray[randomIndex].value = true;
|
|
@@ -210,7 +220,7 @@ const spray=()=> {
|
|
|
210
220
|
}
|
|
211
221
|
}, 100);
|
|
212
222
|
}, 500);
|
|
213
|
-
}
|
|
223
|
+
};
|
|
214
224
|
|
|
215
225
|
//预加载
|
|
216
226
|
const preload_info = [
|
|
@@ -295,50 +305,50 @@ let ImgData4;
|
|
|
295
305
|
let ImgData5;
|
|
296
306
|
const allGroup = [group1, group2, group3, group4, group5];
|
|
297
307
|
//随机烟花颜色设定
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
remainingGroups.splice(randomIndex, 1);
|
|
308
|
+
const remainingGroups = [...allGroup];
|
|
309
|
+
for (let i = 1; i <= 5; i++) {
|
|
310
|
+
const randomIndex = Math.floor(Math.random() * remainingGroups.length);
|
|
311
|
+
const selectedGroup = remainingGroups[randomIndex];
|
|
312
|
+
switch (i) {
|
|
313
|
+
case 1:
|
|
314
|
+
ImgData1 = selectedGroup;
|
|
315
|
+
break;
|
|
316
|
+
case 2:
|
|
317
|
+
ImgData2 = selectedGroup;
|
|
318
|
+
break;
|
|
319
|
+
case 3:
|
|
320
|
+
ImgData3 = selectedGroup;
|
|
321
|
+
break;
|
|
322
|
+
case 4:
|
|
323
|
+
ImgData4 = selectedGroup;
|
|
324
|
+
break;
|
|
325
|
+
case 5:
|
|
326
|
+
ImgData5 = selectedGroup;
|
|
327
|
+
break;
|
|
321
328
|
}
|
|
322
329
|
|
|
330
|
+
remainingGroups.splice(randomIndex, 1);
|
|
331
|
+
}
|
|
332
|
+
|
|
323
333
|
watch(readyNum, (n, o) => {
|
|
324
334
|
if (o != 2 && n == 2) {
|
|
325
335
|
myShow.value = true;
|
|
326
336
|
timer.id2 = setTimeout(() => {
|
|
327
337
|
myRef.value.start();
|
|
328
338
|
|
|
329
|
-
actorControl.run([
|
|
330
|
-
|
|
339
|
+
actorControl.run((cmds) => [
|
|
340
|
+
cmds
|
|
331
341
|
.condition()
|
|
332
342
|
.onNextTick(2)
|
|
333
343
|
.then([
|
|
334
|
-
|
|
335
|
-
|
|
344
|
+
cmds.action().setSpeed(undefined, -9),
|
|
345
|
+
cmds.action(3).setAccel(undefined, 0.13),
|
|
336
346
|
]),
|
|
337
|
-
|
|
347
|
+
cmds
|
|
338
348
|
.condition()
|
|
339
349
|
.reachPosition(undefined, -moveDistance)
|
|
340
350
|
.then([
|
|
341
|
-
|
|
351
|
+
cmds.action().stopMoving(),
|
|
342
352
|
() => {
|
|
343
353
|
isSpray.value = true;
|
|
344
354
|
isShow.value = false;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { onMounted, onUnmounted, ref, computed } from "vue";
|
|
3
|
+
import { JsvFragShaderView } from "jsview";
|
|
4
|
+
import vortexShader from "./vortex.glsl?raw";
|
|
5
|
+
import pageFlipShader from "./pageFlip.glsl?raw";
|
|
6
|
+
import sdfShader from "./sdf.glsl?raw";
|
|
7
|
+
import gaussianBlurShader from "./gaussianBlur.glsl?raw";
|
|
8
|
+
// import testShader from "./test.glsl?raw";
|
|
9
|
+
|
|
10
|
+
const ImageChinChilla =
|
|
11
|
+
"https://qcast-image.oss-cn-qingdao.aliyuncs.com/JsViewVideo/ImageTestSample/BackgroundLongmao.jpg";
|
|
12
|
+
const ImageLandscape = "https://oss.image.qcast.cn/ai-draw/landscape.jpeg";
|
|
13
|
+
const ImagePanda = "https://oss.image.qcast.cn/ai-draw/panda.jpeg";
|
|
14
|
+
const ImageOwl = "https://oss.image.qcast.cn/ai-draw/owl.jpeg";
|
|
15
|
+
|
|
16
|
+
const cShaderSettings = [
|
|
17
|
+
{
|
|
18
|
+
name: "vortex",
|
|
19
|
+
shader: vortexShader,
|
|
20
|
+
uniforms: [],
|
|
21
|
+
textures: [
|
|
22
|
+
{
|
|
23
|
+
name: "iChannel0",
|
|
24
|
+
resource: ImageOwl,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "pageFlip",
|
|
30
|
+
shader: pageFlipShader,
|
|
31
|
+
uniforms: [],
|
|
32
|
+
textures: [
|
|
33
|
+
{
|
|
34
|
+
name: "iChannel0",
|
|
35
|
+
resource: ImageOwl,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "sdf",
|
|
41
|
+
shader: sdfShader,
|
|
42
|
+
uniforms: [],
|
|
43
|
+
textures: [
|
|
44
|
+
{
|
|
45
|
+
name: "iChannel0",
|
|
46
|
+
resource: ImageOwl,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "gaussianBlur",
|
|
52
|
+
shader: gaussianBlurShader,
|
|
53
|
+
uniforms: [],
|
|
54
|
+
textures: [
|
|
55
|
+
{
|
|
56
|
+
name: "iChannel0",
|
|
57
|
+
resource: ImageOwl,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const rKeyCount = ref(0);
|
|
64
|
+
const rShaderInfo = computed(() => {
|
|
65
|
+
return cShaderSettings[rKeyCount.value];
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const rAutoplay = computed(() => {
|
|
69
|
+
return rKeyCount.value != 3;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const rWidgetRef = ref();
|
|
73
|
+
const onKeyDown = (ev) => {
|
|
74
|
+
switch (ev.keyCode) {
|
|
75
|
+
case 37: {
|
|
76
|
+
rKeyCount.value =
|
|
77
|
+
rKeyCount.value > 0 ? rKeyCount.value - 1 : rKeyCount.value;
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
case 39: {
|
|
81
|
+
rKeyCount.value =
|
|
82
|
+
rKeyCount.value < cShaderSettings.length - 1
|
|
83
|
+
? rKeyCount.value + 1
|
|
84
|
+
: rKeyCount.value;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
case 13: {
|
|
88
|
+
if (rKeyCount.value != 3) {
|
|
89
|
+
rWidgetRef.value?.startAnim();
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
onMounted(() => {
|
|
99
|
+
window.JsView?.enableFpsDisplay(true);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
onUnmounted(() => {
|
|
103
|
+
window.JsView?.enableFpsDisplay(false);
|
|
104
|
+
});
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<template>
|
|
108
|
+
<jsv-focus-block
|
|
109
|
+
autoFocus
|
|
110
|
+
:onAction="{
|
|
111
|
+
onKeyDown,
|
|
112
|
+
}"
|
|
113
|
+
:style="{
|
|
114
|
+
width: 1920,
|
|
115
|
+
height: 1080,
|
|
116
|
+
backgroundImage: `url(${ImageChinChilla})`,
|
|
117
|
+
}"
|
|
118
|
+
></jsv-focus-block>
|
|
119
|
+
|
|
120
|
+
<jsv-frag-shader-view
|
|
121
|
+
:key="rKeyCount"
|
|
122
|
+
ref="rWidgetRef"
|
|
123
|
+
:style="{ left: 0, top: 0, width: 1920, height: 1080 }"
|
|
124
|
+
:duration="100000"
|
|
125
|
+
:shaderStr="rShaderInfo.shader"
|
|
126
|
+
:autoplay="rAutoplay"
|
|
127
|
+
:textures="rShaderInfo.textures"
|
|
128
|
+
></jsv-frag-shader-view>
|
|
129
|
+
<div
|
|
130
|
+
:key="rKeyCount"
|
|
131
|
+
:style="{
|
|
132
|
+
top: 20,
|
|
133
|
+
left: 500,
|
|
134
|
+
width: 500,
|
|
135
|
+
height: 50,
|
|
136
|
+
fontSize: 30,
|
|
137
|
+
textAlign: 'center',
|
|
138
|
+
backgroundColor: '#00000055',
|
|
139
|
+
color: '#ffffff',
|
|
140
|
+
}"
|
|
141
|
+
>
|
|
142
|
+
{{ rShaderInfo.name }}
|
|
143
|
+
</div>
|
|
144
|
+
<div
|
|
145
|
+
:style="{
|
|
146
|
+
top: 20,
|
|
147
|
+
left: 1400,
|
|
148
|
+
width: 500,
|
|
149
|
+
height: 50,
|
|
150
|
+
fontSize: 30,
|
|
151
|
+
backgroundColor: '#00000055',
|
|
152
|
+
color: '#ffffff',
|
|
153
|
+
}"
|
|
154
|
+
>
|
|
155
|
+
左右键切换效果, OK键重新播放
|
|
156
|
+
</div>
|
|
157
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const int samples = 35, LOD = 2, // gaussian done on MIPmap at scale LOD
|
|
2
|
+
sLOD = 4; // tile size = 2^LOD
|
|
3
|
+
const float sigma = float(samples) * .25;
|
|
4
|
+
|
|
5
|
+
float gaussian(vec2 i) {
|
|
6
|
+
return exp(-.5 * dot(i /= sigma, i)) / (6.28 * sigma * sigma);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
int myMod(int a, int b) {
|
|
10
|
+
return a - b * int(floor(float(a) / float(b)));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
vec4 blur(sampler2D sp, vec2 U, vec2 scale) {
|
|
14
|
+
vec4 O = vec4(0);
|
|
15
|
+
int s = samples / sLOD;
|
|
16
|
+
|
|
17
|
+
for(int i = 0; i < s * s; i++) {
|
|
18
|
+
vec2 d = vec2(myMod(i, s), i / s) * float(sLOD) - float(samples) / 2.;
|
|
19
|
+
O += gaussian(d) * jsvTexture2D(sp, U + scale * d);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return O / O.a;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
void mainImage(out vec4 O, vec2 U) {
|
|
26
|
+
O = blur(iChannel0, U / iResolution.xy, 1. / iResolution.xy);
|
|
27
|
+
}
|