@shijiu/jsview-vue-samples 2.2.373 → 2.3.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/BakeViewDemo/AnimatePic.vue +1 -1
- package/Basic/components/text/TextDirection.vue +7 -2
- package/BasicFocusControl/components/BaseBlock.vue +65 -18
- package/BreakRender/assets/imageList.json +235 -235
- package/ColorSpace/App.vue +4 -4
- package/CoupletsTest/App.vue +1 -1
- package/CoupletsTest/widget/Banger/Banger.vue +3 -3
- package/CoupletsTest/widget/Banger/MaroonLoader.vue +5 -5
- package/CoupletsTest/widget/Couplets/Couplets.vue +4 -4
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +13 -13
- package/CssPreprocessor/Stylus/components/stylus-group1/StylusOperations.vue +0 -1
- package/CssPreprocessor/utils/ContentBlock.vue +3 -3
- package/CssPreprocessor/utils/{FontStyle.css → FontConfig.css} +3 -3
- package/CssPreprocessor/utils/TitleBar.vue +2 -2
- package/CustomShader/App.vue +6 -6
- package/CustomShader/gaussianBlur.glsl +1 -1
- package/DashPath/App.vue +79 -0
- package/DashPath/AppForOperator.vue +35 -0
- package/DashPath/DashPath.vue +118 -0
- package/DemoForOperator/AnimPic/AnimPic.vue +47 -0
- package/DemoForOperator/AnimPic/App.vue +28 -0
- package/DemoForOperator/Banger/App.vue +26 -0
- package/DemoForOperator/Banger/Banger/Banger.vue +252 -0
- package/DemoForOperator/Banger/Banger/Maroon.vue +123 -0
- package/DemoForOperator/Banger/Banger/MaroonLoader.vue +78 -0
- package/DemoForOperator/Banger/Banger/SpriteDeal.js +30 -0
- package/DemoForOperator/Bounce/App.vue +43 -0
- package/DemoForOperator/Bounce/Bounce.vue +49 -0
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +139 -0
- package/DemoForOperator/ChunLian/App.vue +47 -0
- package/DemoForOperator/ChunLian/Couplets.vue +248 -0
- package/DemoForOperator/EpisodeList/App.vue +80 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +113 -0
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +176 -0
- package/DemoForOperator/EpisodeList/GroupItem.vue +65 -0
- package/DemoForOperator/EpisodeList/ListItem.vue +48 -0
- package/DemoForOperator/Firework1/App.vue +25 -0
- package/DemoForOperator/Firework1/Fireworks.vue +358 -0
- package/DemoForOperator/Firework1/SpriteDeal.js +30 -0
- package/DemoForOperator/FlipPage/App.vue +75 -0
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +150 -0
- package/DemoForOperator/FlipPage/FlipPage/flipIn.glsl +41 -0
- package/DemoForOperator/FlipPage/FlipPage/flipOut.glsl +41 -0
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +70 -0
- package/DemoForOperator/Focus/Alpha/AlphaPage.vue +40 -0
- package/DemoForOperator/Focus/Alpha/Item.vue +64 -0
- package/DemoForOperator/Focus/App.vue +124 -0
- package/DemoForOperator/Focus/CommonPageSetting.js +30 -0
- package/DemoForOperator/Focus/Item.vue +46 -0
- package/DemoForOperator/Focus/Light/Item.vue +67 -0
- package/DemoForOperator/Focus/Light/LightFocusBox.vue +46 -0
- package/DemoForOperator/Focus/Light/LightPage.vue +43 -0
- package/DemoForOperator/Focus/Light/utils/FrameCanvasStore.ts +68 -0
- package/DemoForOperator/Focus/Light/utils/RotateFrame.vue +146 -0
- package/DemoForOperator/Focus/Light/utils/circleHaloMask.png +0 -0
- package/DemoForOperator/Focus/Normal/Item.vue +64 -0
- package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +53 -0
- package/DemoForOperator/Focus/Normal/NormalPage.vue +41 -0
- package/DemoForOperator/Focus/SwipeLight/Item.vue +73 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightBox.vue +62 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightPage.vue +44 -0
- package/DemoForOperator/FullscreenIn/App.vue +105 -0
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +41 -0
- package/DemoForOperator/FullscreenIn/Item.vue +50 -0
- package/DemoForOperator/Genie/App.vue +78 -0
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +699 -0
- package/DemoForOperator/Genie/geniePakcer/genieBottom.glsl +49 -0
- package/DemoForOperator/Genie/geniePakcer/genieLeft.glsl +50 -0
- package/DemoForOperator/Genie/geniePakcer/genieRight.glsl +57 -0
- package/DemoForOperator/Genie/geniePakcer/genieTop.glsl +50 -0
- package/DemoForOperator/GrayFilter/App.vue +51 -0
- package/DemoForOperator/GrayFilter/GrayFilter.vue +38 -0
- package/DemoForOperator/Jigsaw/App.vue +45 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +100 -0
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +86 -0
- package/DemoForOperator/Particle/App.vue +69 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +176 -0
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +99 -0
- package/DemoForOperator/PosterAnim/App.vue +125 -0
- package/DemoForOperator/PosterAnim/Bounce/BouncePage.vue +54 -0
- package/DemoForOperator/PosterAnim/Bounce/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Breath/BreathPage.vue +47 -0
- package/DemoForOperator/PosterAnim/Breath/Item.vue +58 -0
- package/DemoForOperator/PosterAnim/CommonPageSetting.js +30 -0
- package/DemoForOperator/PosterAnim/Item.vue +46 -0
- package/DemoForOperator/PosterAnim/PosterAnim.js +58 -0
- package/DemoForOperator/PosterAnim/Scale/Item.vue +72 -0
- package/DemoForOperator/PosterAnim/Scale/ScalePage.vue +48 -0
- package/DemoForOperator/PosterAnim/Shake/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Shake/ShakePage.vue +53 -0
- package/DemoForOperator/PosterOverflow/App.vue +116 -0
- package/DemoForOperator/PosterOverflow/Item.vue +67 -0
- package/DemoForOperator/PosterOverflow/PosterOverflow.vue +23 -0
- package/DemoForOperator/Ripple/App.vue +54 -0
- package/DemoForOperator/Ripple/Ripple.vue +50 -0
- package/DemoForOperator/ScalePoster/App.vue +4 -0
- package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
- package/DemoForOperator/Sprite/App.vue +33 -0
- package/DemoForOperator/Sprite/Sprite.vue +90 -0
- package/DemoForOperator/Stretch/App.vue +103 -0
- package/DemoForOperator/Stretch/Stretch/Item.vue +192 -0
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +168 -0
- package/DemoForOperator/TabContent/App.vue +89 -0
- package/DemoForOperator/TabContent/ContentPage.vue +66 -0
- package/DemoForOperator/TabContent/Item.vue +85 -0
- package/DemoForOperator/TabContent/PageItem.vue +40 -0
- package/DemoForOperator/TabContent/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContent/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContent/TabContent/TabContent.vue +146 -0
- package/DemoForOperator/TabContent/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContent/TabContent/TabWidget.vue +243 -0
- package/DemoForOperator/TabContent/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContent/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContent/testData.js +241 -0
- package/DemoForOperator/Vortex/App.vue +78 -0
- package/DemoForOperator/Vortex/Vortex/Vortex.vue +154 -0
- package/DemoForOperator/Vortex/Vortex/vortexIn.glsl +38 -0
- package/DemoForOperator/Vortex/Vortex/vortexOut.glsl +38 -0
- package/DemoForOperator/index.js +6 -0
- package/DemoForOperator/routeList.js +142 -0
- package/DemoHomepage/App.vue +50 -30
- package/DemoHomepage/components/Dialog.vue +1 -0
- package/DemoHomepage/components/TabFrame.vue +7 -0
- package/DemoHomepage/router.js +104 -81
- package/DemoHomepage/views/Homepage.vue +7 -6
- package/DivMetroPerformance/components/ContentItem.vue +0 -1
- package/DivMetroPerformance/data.js +3 -3
- package/DriftScopeTest/App.vue +1 -1
- package/FilterDemo/AnimatePic.vue +1 -1
- package/FilterDemo/VideoLayer.vue +2 -2
- package/FlexCellDemo/TestFrame1.vue +0 -4
- package/FullScreenFlex/TestFrame2.vue +1 -1
- package/GiftRain/App.vue +12 -15
- package/HashParams/App.vue +0 -1
- package/JsvPreDownloader/App.vue +4 -6
- package/Marquee/App.vue +2 -2
- package/MediaDemo/components/frames/AudioFrame.vue +1 -1
- package/MediaDemo/components/frames/VideoFrame.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/ContentItem.vue +1 -2
- package/MetroWidgetDemos/MassiveItems/data.js +1 -1
- package/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +0 -1
- package/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +18 -17
- package/MetroWidgetDemos/PerformanceTest/data.js +3 -3
- package/MetroWidgetDemos/RefreshDemo/assets/imageList.json +235 -235
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +235 -235
- package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +3 -1
- package/MetroWidgetDemos/routeList.js +17 -17
- package/Poster3d/App.vue +69 -0
- package/Poster3d/Poster3d.vue +92 -0
- package/PosterPacker/App.vue +5 -5
- package/PosterPacker/tools/geniePakcer/Genie.vue +2 -2
- package/PosterPacker/tools/vortexPacker/Vortex.vue +15 -15
- package/QrcodeDemo/App.vue +1 -1
- package/Ripple/App.vue +1 -1
- package/ScaleDownNeon/App.vue +13 -10
- package/SceneTransition/App.vue +7 -6
- package/SceneTransition/maskConfig/config2.js +12 -12
- package/SceneTransition/maskConfig/config3.js +14 -14
- package/SprayView/App.vue +96 -51
- package/SpringFestival/App.vue +73 -0
- package/SpringFestival/SpringFestivalScene/ChunLian.vue +211 -0
- package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +139 -0
- package/SpringFestival/SpringFestivalScene/LanternAnim.js +60 -0
- package/SpringFestival/SpringFestivalScene/Rain.vue +137 -0
- package/SpringFestival/SpringFestivalScene/Scene.vue +218 -0
- package/SpringFestival/SpringFestivalScene/imageConfig.js +87 -0
- package/SpringFestival/SpringFestivalScene/index.js +1 -0
- package/Swiper/App.vue +28 -29
- package/Swiper/Item.vue +19 -0
- package/SwiperTest/App.vue +9 -9
- package/TestNativeSharedView/AckEventDefine.ts +82 -0
- package/TestNativeSharedView/App.vue +4 -6
- package/TestNativeSharedView/JsvDemoTester.js +131 -0
- package/TextureAnimation/App3.vue +100 -0
- package/TextureAnimation/utils/FrameCanvasStore.ts +68 -0
- package/TextureAnimation/utils/RotateFrame.vue +146 -0
- package/TextureAnimation/utils/circleHaloMask.png +0 -0
- package/TextureSize/App.vue +5 -6
- package/TombSweepingDayTest/Raining/RainScene.vue +4 -4
- package/ViewOpacity/App.vue +6 -7
- package/package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
const SQRT2VAL = Math.sqrt(2)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// 获取原地起跳抛物的处理
|
|
5
|
+
function getParabola(
|
|
6
|
+
cmds,
|
|
7
|
+
condGroupId, // 后续改为specName
|
|
8
|
+
xSpeed,
|
|
9
|
+
ySpeed,
|
|
10
|
+
gravity,
|
|
11
|
+
times,
|
|
12
|
+
onLandCmds
|
|
13
|
+
) {
|
|
14
|
+
let actCmds;
|
|
15
|
+
if (times > 0) {
|
|
16
|
+
actCmds = getParabola(
|
|
17
|
+
cmds,
|
|
18
|
+
condGroupId,
|
|
19
|
+
xSpeed,
|
|
20
|
+
ySpeed / SQRT2VAL,
|
|
21
|
+
gravity,
|
|
22
|
+
times - 1,
|
|
23
|
+
onLandCmds
|
|
24
|
+
);
|
|
25
|
+
} else {
|
|
26
|
+
actCmds = onLandCmds;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
cmds.state().removeConditionByName(sFloorConditionName),
|
|
31
|
+
// (state: any) => {
|
|
32
|
+
// console.log(`State on t=${Date.now()} land y=${ySpeed} setStartOffsetPos times=${times}`,
|
|
33
|
+
// JSON.stringify(state))
|
|
34
|
+
// },
|
|
35
|
+
cmds.state().setStartPos(undefined, -1), // 离开接触点
|
|
36
|
+
cmds.action().setSpdAndAccel(xSpeed, ySpeed, 0, gravity),
|
|
37
|
+
|
|
38
|
+
// 下一帧再重启condition,避免当前帧的判断循环中仍然激活condition
|
|
39
|
+
cmds
|
|
40
|
+
.condition(condGroupId)
|
|
41
|
+
.onNextTick()
|
|
42
|
+
.then([
|
|
43
|
+
cmds
|
|
44
|
+
.condition(condGroupId, false, sFloorConditionName)
|
|
45
|
+
.reachPosition(undefined, 0)
|
|
46
|
+
.then([
|
|
47
|
+
...actCmds,
|
|
48
|
+
]),
|
|
49
|
+
]),
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const sFloorConditionName = "floorCond";
|
|
54
|
+
const sWallConditionName = "wallCond";
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
弹跳处理
|
|
58
|
+
*/
|
|
59
|
+
export function buildBounce(
|
|
60
|
+
cmds,// FreeMove的cmds句柄
|
|
61
|
+
condGroupId,
|
|
62
|
+
startX, // 起始位置和目标位置的偏差, 单位px
|
|
63
|
+
startY, // 起始位置和目标位置的偏差, 单位px
|
|
64
|
+
times, // 整数,落点数(弹起次数-1)
|
|
65
|
+
gravity, // y轴的加速度, 建议设置成0.8
|
|
66
|
+
onEnd,
|
|
67
|
+
) {
|
|
68
|
+
let xDistance = startX - 0;
|
|
69
|
+
let yDistance = startY - 0;
|
|
70
|
+
|
|
71
|
+
if (times < 1) {
|
|
72
|
+
times = 1;
|
|
73
|
+
console.log("at least 1 times");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 每个碰撞点之间的x的距离为
|
|
77
|
+
// sx * (1 + 1/sqrt(2) + 1/sqrt(2)^2 + ...) (=次数的数列)
|
|
78
|
+
// sx 为第一次下落过程x轴走过的距离
|
|
79
|
+
let sqrt2 = 1 / SQRT2VAL;
|
|
80
|
+
let sxSubBase = 2;
|
|
81
|
+
let sxSub = sxSubBase / 2;
|
|
82
|
+
for (let i = 0; i < times - 1; i++) {
|
|
83
|
+
sxSubBase = sxSubBase * sqrt2;
|
|
84
|
+
sxSub += sxSubBase;
|
|
85
|
+
}
|
|
86
|
+
let sx = -(xDistance / sxSub);
|
|
87
|
+
|
|
88
|
+
// 求首次下落使用的时间, 按照 s = 1/2*a*t^2的公式求解
|
|
89
|
+
let t1st = Math.sqrt(Math.abs(yDistance) * 2 / gravity);
|
|
90
|
+
|
|
91
|
+
// 求x的速度
|
|
92
|
+
let vx = sx / t1st;
|
|
93
|
+
|
|
94
|
+
// 求第一次落点的y速度
|
|
95
|
+
let vy1st = gravity * t1st;
|
|
96
|
+
|
|
97
|
+
let onLandCmds = [
|
|
98
|
+
cmds.action().teleportTo(0, 0),
|
|
99
|
+
// cmds.action().stopMoving(true),
|
|
100
|
+
cmds.state().removeConditionByGroup(condGroupId),
|
|
101
|
+
(...args) => {
|
|
102
|
+
onEnd?.(...args);
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
let parabolaCmds;
|
|
107
|
+
if (times > 1) {
|
|
108
|
+
// 递归创建所有运动处理
|
|
109
|
+
parabolaCmds = getParabola(cmds, condGroupId, vx, -vy1st / SQRT2VAL, gravity, times - 2, onLandCmds);
|
|
110
|
+
} else {
|
|
111
|
+
parabolaCmds = onLandCmds;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let wallname = xDistance > 0 ? "left" : "right";
|
|
115
|
+
|
|
116
|
+
let cmdsArray = [
|
|
117
|
+
// 清理掉所有condition,除了group的外,还有wallposition
|
|
118
|
+
// 但后续specName的bug修正后,可以用specName来控制动画,只清理group即可
|
|
119
|
+
cmds.state().removeConditionByGroup(condGroupId),
|
|
120
|
+
|
|
121
|
+
// wallPosition用于规避运动路程计算超出(times越大超出越多)时,解决动画结尾的回弹问题
|
|
122
|
+
cmds.condition(condGroupId, true, sWallConditionName).wallPosition(wallname, 0, undefined).then([
|
|
123
|
+
cmds.action().teleportTo(0, undefined),
|
|
124
|
+
cmds.action().setSpdAndAccel(0, undefined, undefined, undefined),
|
|
125
|
+
]),
|
|
126
|
+
|
|
127
|
+
// 启动从起始点的抛物下落动画
|
|
128
|
+
cmds.state().setStartPos(startX, startY),
|
|
129
|
+
cmds.action().setSpdAndAccel(vx, 0, 0, gravity),
|
|
130
|
+
cmds
|
|
131
|
+
.condition(condGroupId, false, sFloorConditionName)
|
|
132
|
+
.reachPosition(undefined, 0)
|
|
133
|
+
.then([
|
|
134
|
+
...parabolaCmds
|
|
135
|
+
])
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
return cmdsArray;
|
|
139
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getKeyFramesGroup } from "jsview";
|
|
2
|
+
|
|
3
|
+
export const LANTERN_LEFT_ANIM = "FestivalScene_left_shake"
|
|
4
|
+
export const LANTERN_RIGHT_ANIM = "FestivalScene_right_shake"
|
|
5
|
+
|
|
6
|
+
const cStyleShell = getKeyFramesGroup();
|
|
7
|
+
|
|
8
|
+
/* 传值样例:
|
|
9
|
+
buildZRotate("Claw_moveLeftShake", 2000, "center top", [
|
|
10
|
+
{ deg: 0, timeStamp: 0 },
|
|
11
|
+
{ deg: 14, timeStamp: 300 },
|
|
12
|
+
{ deg: 15, timeStamp: 1600 },
|
|
13
|
+
{ deg: -7, timeStamp: 1800 },
|
|
14
|
+
{ deg: 3, timeStamp: 1900 },
|
|
15
|
+
{ deg: 0, timeStamp: 2000 },
|
|
16
|
+
])
|
|
17
|
+
总时长2000为2s, center top:前为横向,后为纵向
|
|
18
|
+
*/
|
|
19
|
+
function buildZRotate(name, totalTime, origin, frameList) {
|
|
20
|
+
let frameDefines = [];
|
|
21
|
+
for (let i = 0; i < frameList.length; i++) {
|
|
22
|
+
let frameItem = frameList[i];
|
|
23
|
+
frameDefines.push(
|
|
24
|
+
`${Math.floor((frameItem.timeStamp / totalTime) * 10000) / 100
|
|
25
|
+
}%{transform:rotate3d(0,0,1,${frameItem.deg
|
|
26
|
+
}deg);transform-origin:${origin}}`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
let finalStr = `@keyframes ${name} {`;
|
|
30
|
+
for (let i = 0; i < frameDefines.length; i++) {
|
|
31
|
+
finalStr += frameDefines[i];
|
|
32
|
+
}
|
|
33
|
+
console.log("buildShake=" + finalStr);
|
|
34
|
+
return finalStr;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function initLanternAnim() {
|
|
38
|
+
cStyleShell.insertRule(
|
|
39
|
+
buildZRotate(LANTERN_LEFT_ANIM, 3400, "center top", [
|
|
40
|
+
{ deg: 0, timeStamp: 0 },
|
|
41
|
+
{ deg: 12, timeStamp: 1200 },
|
|
42
|
+
{ deg: -5, timeStamp: 2900 },
|
|
43
|
+
{ deg: 0, timeStamp: 3400 },
|
|
44
|
+
])
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
cStyleShell.insertRule(
|
|
48
|
+
buildZRotate(LANTERN_RIGHT_ANIM, 3400, "center top", [
|
|
49
|
+
{ deg: 0, timeStamp: 0 },
|
|
50
|
+
{ deg: -12, timeStamp: 1200 },
|
|
51
|
+
{ deg: 5, timeStamp: 2900 },
|
|
52
|
+
{ deg: 0, timeStamp: 3400 },
|
|
53
|
+
])
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function releaseLanternAnim() {
|
|
58
|
+
cStyleShell.removeRule(LANTERN_LEFT_ANIM);
|
|
59
|
+
cStyleShell.removeRule(LANTERN_RIGHT_ANIM);
|
|
60
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { JsvSpray } from "jsview";
|
|
3
|
+
import { ref, onBeforeUnmount, onMounted } from "vue";
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
urlList: {
|
|
7
|
+
type: Array,
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
autoStart: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
//获取一个随机顺序
|
|
17
|
+
function getRandomOrder(numbers) {
|
|
18
|
+
let currentIndex = numbers.length,
|
|
19
|
+
temporaryValue,
|
|
20
|
+
randomIndex;
|
|
21
|
+
// 从数组的最后一个元素开始,向前遍历
|
|
22
|
+
while (currentIndex !== 0) {
|
|
23
|
+
// 选取一个随机索引
|
|
24
|
+
randomIndex = Math.floor(Math.random() * currentIndex);
|
|
25
|
+
currentIndex -= 1;
|
|
26
|
+
|
|
27
|
+
// 交换当前索引和随机索引处的元素
|
|
28
|
+
temporaryValue = numbers[currentIndex];
|
|
29
|
+
numbers[currentIndex] = numbers[randomIndex];
|
|
30
|
+
numbers[randomIndex] = temporaryValue;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return numbers;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//目前版本的粒子生成有问题, 会在一开始就集中出现, 所以要随机拉开几个JsvSpray的位置
|
|
37
|
+
const positionRange = [-50, -100];
|
|
38
|
+
const step = (positionRange[1] - positionRange[0]) / props.urlList.length;
|
|
39
|
+
const urls = getRandomOrder(props.urlList);
|
|
40
|
+
const sprayInfos = [];
|
|
41
|
+
for (let i = 0; i < urls.length; ++i) {
|
|
42
|
+
sprayInfos.push({
|
|
43
|
+
url: urls[i],
|
|
44
|
+
pos: positionRange[0] + step * i,
|
|
45
|
+
config: {
|
|
46
|
+
type: 1,
|
|
47
|
+
particleNum: 2,
|
|
48
|
+
deltaAngle: 0,
|
|
49
|
+
deltaWidth: 100,
|
|
50
|
+
deltaHeight: 1,
|
|
51
|
+
pointSizeMin: 90,
|
|
52
|
+
pointSizeMax: 120,
|
|
53
|
+
speedMin: -5,
|
|
54
|
+
speedMax: -10,
|
|
55
|
+
lifeMin: 3500 + i * 200,
|
|
56
|
+
lifeMax: 4000 + i * 200,
|
|
57
|
+
accelerateX: 0,
|
|
58
|
+
accelerateY: 0,
|
|
59
|
+
addNumSpeed: 0.0001,
|
|
60
|
+
angularVelocityMin: 10,
|
|
61
|
+
angularVelocityMax: 15,
|
|
62
|
+
enableFade: false,
|
|
63
|
+
enableShrink: false,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//粒子数量少的时候, 添加有bug, 为了规避此处分成三拨开始
|
|
69
|
+
let showSceond = ref(false);
|
|
70
|
+
let showThird = ref(false);
|
|
71
|
+
|
|
72
|
+
let list1 = sprayInfos.slice(0, 1);
|
|
73
|
+
let list2 = sprayInfos.slice(1, 3);
|
|
74
|
+
let list3 = sprayInfos.slice(3);
|
|
75
|
+
|
|
76
|
+
let show = ref(false);
|
|
77
|
+
let timeoutHandler = -1;
|
|
78
|
+
function start() {
|
|
79
|
+
show.value = true;
|
|
80
|
+
timeoutHandler = setTimeout(() => {
|
|
81
|
+
showSceond.value = true;
|
|
82
|
+
timeoutHandler = setTimeout(() => {
|
|
83
|
+
showThird.value = true;
|
|
84
|
+
}, 700);
|
|
85
|
+
}, 700);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onMounted(() => {
|
|
89
|
+
if (props.autoStart) {
|
|
90
|
+
start();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
onBeforeUnmount(() => {
|
|
95
|
+
clearTimeout(timeoutHandler);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
defineExpose({
|
|
99
|
+
start,
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<div v-if="show">
|
|
105
|
+
<div
|
|
106
|
+
v-for="(item, index) in list1"
|
|
107
|
+
:key="`item_${index}`"
|
|
108
|
+
:style="{
|
|
109
|
+
top: item.pos,
|
|
110
|
+
}"
|
|
111
|
+
>
|
|
112
|
+
<jsv-spray :pointRes="`url(${item.url})`" :sprayStyle="item.config" />
|
|
113
|
+
</div>
|
|
114
|
+
<div v-if="showSceond">
|
|
115
|
+
<div
|
|
116
|
+
v-for="(item, index) in list2"
|
|
117
|
+
:key="`item_${index}`"
|
|
118
|
+
:style="{
|
|
119
|
+
top: item.pos,
|
|
120
|
+
}"
|
|
121
|
+
>
|
|
122
|
+
<jsv-spray :pointRes="`url(${item.url})`" :sprayStyle="item.config" />
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
<div v-if="showThird">
|
|
126
|
+
<div
|
|
127
|
+
v-for="(item, index) in list3"
|
|
128
|
+
:key="`item_${index}`"
|
|
129
|
+
:style="{
|
|
130
|
+
top: item.pos,
|
|
131
|
+
}"
|
|
132
|
+
>
|
|
133
|
+
<jsv-spray :pointRes="`url(${item.url})`" :sprayStyle="item.config" />
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</template>
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { sourceMap } from "./imageConfig";
|
|
3
|
+
|
|
4
|
+
import ChunLian, {
|
|
5
|
+
initChunLianAnim,
|
|
6
|
+
releaseChunLianAnim,
|
|
7
|
+
} from "./ChunLian.vue";
|
|
8
|
+
import Rain from "./Rain.vue";
|
|
9
|
+
import {
|
|
10
|
+
LANTERN_LEFT_ANIM,
|
|
11
|
+
LANTERN_RIGHT_ANIM,
|
|
12
|
+
initLanternAnim,
|
|
13
|
+
releaseLanternAnim,
|
|
14
|
+
} from "./LanternAnim";
|
|
15
|
+
import { buildBounce } from "./FreeMoveBuilder";
|
|
16
|
+
|
|
17
|
+
import { ref, shallowRef, onMounted, onBeforeUnmount } from "vue";
|
|
18
|
+
|
|
19
|
+
import { JsvPreload, buildPreloadInfo, JsvFreeMoveActor } from "jsview";
|
|
20
|
+
|
|
21
|
+
const sprayImageList = [
|
|
22
|
+
sourceMap.particleCoin1,
|
|
23
|
+
sourceMap.particleCoin2,
|
|
24
|
+
sourceMap.particleCoin3,
|
|
25
|
+
sourceMap.particleRedBag1,
|
|
26
|
+
sourceMap.particleRedBag2,
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const scrollImage = [sourceMap.scrollTop, sourceMap.scrollBottom];
|
|
30
|
+
|
|
31
|
+
const chunLianLeftRef = shallowRef();
|
|
32
|
+
const chunLianRightRef = shallowRef();
|
|
33
|
+
const rain1 = shallowRef();
|
|
34
|
+
const rain2 = shallowRef();
|
|
35
|
+
|
|
36
|
+
//初始化动画
|
|
37
|
+
initChunLianAnim();
|
|
38
|
+
initLanternAnim();
|
|
39
|
+
|
|
40
|
+
function chunLianOnAnimEnd() {
|
|
41
|
+
startSnakeAnim();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//preload 逻辑
|
|
45
|
+
const keyPreloadInfo = [
|
|
46
|
+
buildPreloadInfo(sourceMap.background),
|
|
47
|
+
buildPreloadInfo(sourceMap.scrollTop),
|
|
48
|
+
buildPreloadInfo(sourceMap.scrollBottom),
|
|
49
|
+
buildPreloadInfo(sourceMap.textLeft),
|
|
50
|
+
buildPreloadInfo(sourceMap.textRight),
|
|
51
|
+
];
|
|
52
|
+
let keyResourceLoaded = ref(false);
|
|
53
|
+
function onKeyPreloadDone() {
|
|
54
|
+
keyResourceLoaded.value = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const rainPreloadInfo = [];
|
|
58
|
+
sprayImageList.forEach((item) => {
|
|
59
|
+
rainPreloadInfo.push(buildPreloadInfo(item));
|
|
60
|
+
});
|
|
61
|
+
let rainLoaded = ref(false);
|
|
62
|
+
function onRainPreloadDone() {
|
|
63
|
+
rainLoaded.value = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const showSnake = ref(false);
|
|
67
|
+
let rLeftSnakeRef = shallowRef(null);
|
|
68
|
+
let rRightSnakeRef = shallowRef(null);
|
|
69
|
+
let vLeftSnakeControl = null;
|
|
70
|
+
let vRightSnakeControl = null;
|
|
71
|
+
function startSnakeAnim() {
|
|
72
|
+
showSnake.value = true;
|
|
73
|
+
vLeftSnakeControl = rLeftSnakeRef.value.control;
|
|
74
|
+
vLeftSnakeControl.run((cmds) => [
|
|
75
|
+
...buildBounce(cmds, 1, -400, -400, 7, 2.0, (state) => {}),
|
|
76
|
+
]);
|
|
77
|
+
vRightSnakeControl = rRightSnakeRef.value.control;
|
|
78
|
+
vRightSnakeControl.run((cmds) => [
|
|
79
|
+
...buildBounce(cmds, 1, 400, -400, 7, 2.0, (state) => {}),
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
onMounted(() => {});
|
|
83
|
+
|
|
84
|
+
onBeforeUnmount(() => {
|
|
85
|
+
releaseChunLianAnim();
|
|
86
|
+
releaseLanternAnim();
|
|
87
|
+
});
|
|
88
|
+
</script>
|
|
89
|
+
<template>
|
|
90
|
+
<jsv-preload
|
|
91
|
+
:preloadList="keyPreloadInfo"
|
|
92
|
+
:onPreloadDone="onKeyPreloadDone"
|
|
93
|
+
></jsv-preload>
|
|
94
|
+
<jsv-preload
|
|
95
|
+
v-if="keyResourceLoaded"
|
|
96
|
+
:preloadList="rainPreloadInfo"
|
|
97
|
+
:onPreloadDone="onRainPreloadDone"
|
|
98
|
+
></jsv-preload>
|
|
99
|
+
|
|
100
|
+
<div
|
|
101
|
+
:style="{
|
|
102
|
+
width: 1920,
|
|
103
|
+
height: 1080,
|
|
104
|
+
backgroundImage: `url(${sourceMap.background})`,
|
|
105
|
+
}"
|
|
106
|
+
></div>
|
|
107
|
+
|
|
108
|
+
<div v-if="rainLoaded">
|
|
109
|
+
<rain ref="rain1" :url-list="sprayImageList" />
|
|
110
|
+
<div
|
|
111
|
+
:style="{
|
|
112
|
+
left: 1740,
|
|
113
|
+
}"
|
|
114
|
+
>
|
|
115
|
+
<rain ref="rain2" :url-list="sprayImageList" />
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<div v-if="keyResourceLoaded">
|
|
120
|
+
<div
|
|
121
|
+
:style="{
|
|
122
|
+
left: 180,
|
|
123
|
+
top: 50,
|
|
124
|
+
}"
|
|
125
|
+
>
|
|
126
|
+
<chun-lian
|
|
127
|
+
ref="chunLianLeftRef"
|
|
128
|
+
:is-left="true"
|
|
129
|
+
:content-image="`url(${sourceMap.textLeft})`"
|
|
130
|
+
:scroll-image="scrollImage"
|
|
131
|
+
:onAnimEnd="chunLianOnAnimEnd"
|
|
132
|
+
/>
|
|
133
|
+
<img
|
|
134
|
+
:style="{
|
|
135
|
+
left: 150,
|
|
136
|
+
top: -30,
|
|
137
|
+
}"
|
|
138
|
+
:src="`url(${sourceMap.iconRedBag})`"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
<div
|
|
142
|
+
:style="{
|
|
143
|
+
left: 1475,
|
|
144
|
+
top: 50,
|
|
145
|
+
}"
|
|
146
|
+
>
|
|
147
|
+
<chun-lian
|
|
148
|
+
ref="chunLianRightRef"
|
|
149
|
+
:is-left="false"
|
|
150
|
+
:content-image="`url(${sourceMap.textRight})`"
|
|
151
|
+
:scroll-image="scrollImage"
|
|
152
|
+
/>
|
|
153
|
+
<img
|
|
154
|
+
:style="{
|
|
155
|
+
left: 25,
|
|
156
|
+
top: -10,
|
|
157
|
+
}"
|
|
158
|
+
:src="`url(${sourceMap.iconYuanBao})`"
|
|
159
|
+
/>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div v-if="keyResourceLoaded">
|
|
164
|
+
<img
|
|
165
|
+
:src="sourceMap.lanternLeft"
|
|
166
|
+
:style="{
|
|
167
|
+
top: 0,
|
|
168
|
+
left: 0,
|
|
169
|
+
width: 320,
|
|
170
|
+
height: 320,
|
|
171
|
+
animation: `${LANTERN_LEFT_ANIM} 12s infinite`,
|
|
172
|
+
}"
|
|
173
|
+
/>
|
|
174
|
+
<img
|
|
175
|
+
:src="sourceMap.lanternRight"
|
|
176
|
+
:style="{
|
|
177
|
+
top: 0,
|
|
178
|
+
left: 1650,
|
|
179
|
+
width: 320,
|
|
180
|
+
height: 320,
|
|
181
|
+
animation: `${LANTERN_RIGHT_ANIM} 12s infinite`,
|
|
182
|
+
}"
|
|
183
|
+
/>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<div v-show="showSnake">
|
|
187
|
+
<JsvFreeMoveActor
|
|
188
|
+
:top="690"
|
|
189
|
+
:left="145"
|
|
190
|
+
:width="320"
|
|
191
|
+
:height="320"
|
|
192
|
+
ref="rLeftSnakeRef"
|
|
193
|
+
>
|
|
194
|
+
<img
|
|
195
|
+
:src="sourceMap.snakeLeft"
|
|
196
|
+
:style="{
|
|
197
|
+
width: 320,
|
|
198
|
+
height: 320,
|
|
199
|
+
}"
|
|
200
|
+
/>
|
|
201
|
+
</JsvFreeMoveActor>
|
|
202
|
+
<JsvFreeMoveActor
|
|
203
|
+
:top="690"
|
|
204
|
+
:left="1447"
|
|
205
|
+
:width="320"
|
|
206
|
+
:height="320"
|
|
207
|
+
ref="rRightSnakeRef"
|
|
208
|
+
>
|
|
209
|
+
<img
|
|
210
|
+
:src="sourceMap.snakeRight"
|
|
211
|
+
:style="{
|
|
212
|
+
width: 320,
|
|
213
|
+
height: 320,
|
|
214
|
+
}"
|
|
215
|
+
/>
|
|
216
|
+
</JsvFreeMoveActor>
|
|
217
|
+
</div>
|
|
218
|
+
</template>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// import background from "./assets/background.png";
|
|
2
|
+
// import hongBao from "./assets/hong_bao.png";
|
|
3
|
+
// import yuanBao from "./assets/yuan_bao.png";
|
|
4
|
+
|
|
5
|
+
// import coin1 from "./assets/coin1.png";
|
|
6
|
+
// import coin2 from "./assets/coin2.png";
|
|
7
|
+
// import coin3 from "./assets/coin3.png";
|
|
8
|
+
// import redBag1 from "./assets/redBag1.png";
|
|
9
|
+
// import redBag2 from "./assets/redBag2.png";
|
|
10
|
+
|
|
11
|
+
// import juanZhou1 from "./assets/juan_zhou_1.png";
|
|
12
|
+
// import juanZhou2 from "./assets/juan_zhou_2.png";
|
|
13
|
+
// import chunLianLeft from "./assets/chun_lian_left.png";
|
|
14
|
+
// import chunLianRight from "./assets/chun_lian_right.png";
|
|
15
|
+
|
|
16
|
+
// import iLeftLantern from "./assets/left_lantern.png";
|
|
17
|
+
// import iRightLantern from "./assets/right_lantern.png";
|
|
18
|
+
|
|
19
|
+
// import iLeftSnake from "./assets/snake_left.png";
|
|
20
|
+
// import iRightSnake from "./assets/snake_right.png";
|
|
21
|
+
|
|
22
|
+
//建议1920x1080
|
|
23
|
+
let background = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/background.png?md5=68b77fa35ed6d287c724d875bc00b545";
|
|
24
|
+
|
|
25
|
+
// 左右栏目的下落内容
|
|
26
|
+
//建议50x50
|
|
27
|
+
let coin1 = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/coin1.png?md5=14450466887cdf486a17e133501a70b3";
|
|
28
|
+
let coin2 = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/coin2.png?md5=df6b542c577e07a574fe64a1761755a2";
|
|
29
|
+
let coin3 = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/coin3.png?md5=4da163a113e51295f223e66e6f14d7a0";
|
|
30
|
+
let redBag1 = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/redBag1.png?md5=6a9be61b6919dd4f1a791a67b24c9b9a";
|
|
31
|
+
let redBag2 = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/redBag2.png?md5=38d4750b2dbbe6d1a5de173bd6481229";
|
|
32
|
+
|
|
33
|
+
//建议265x55
|
|
34
|
+
let juanZhou1 = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/juan_zhou_1.png?md5=5129c12099fb3703972cfe5a35057385";
|
|
35
|
+
let juanZhou2 = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/juan_zhou_2.png?md5=4db0cd5ceadbfcbacfdf1a214a5e8a1e";
|
|
36
|
+
|
|
37
|
+
//建议209x874
|
|
38
|
+
let chunLianLeft = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/chun_lian_left.png?md5=10cf29941d3c66355f3e28133a641921";
|
|
39
|
+
let chunLianRight = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/chun_lian_right.png?md5=b2e5f07c271d0dd3e6c57fa713dc814a";
|
|
40
|
+
|
|
41
|
+
// 建议320x320
|
|
42
|
+
let iLeftLantern = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/left_lantern.png?md5=10990059f7a98bfac1945407cf323c7d";
|
|
43
|
+
let iRightLantern = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/right_lantern.png?md5=616378f545f0e1c93e3e0c226a4976a1";
|
|
44
|
+
|
|
45
|
+
// 建议320x320
|
|
46
|
+
let iLeftSnake = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/snake_left.png?md5=e0310d4ba1c74899899ca365a8b16385";
|
|
47
|
+
let iRightSnake = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/snake_right.png?md5=70ca45f762bbc29b912abd010f02fb0c";
|
|
48
|
+
|
|
49
|
+
// 春联顶栏的装饰
|
|
50
|
+
//88x106
|
|
51
|
+
let hongBao = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/hong_bao.png?md5=03a9ccf8f47af7d907b55be333a614f8";
|
|
52
|
+
//99x71
|
|
53
|
+
let yuanBao = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/SpringFestival/SpringFestivalScene/imageConfig/yuan_bao.png?md5=33e38f8003113db016292345e4dbfcbe";
|
|
54
|
+
|
|
55
|
+
//注意, 图片的尺寸要按注释的大小给
|
|
56
|
+
export const sourceMap = {
|
|
57
|
+
//1920x1080
|
|
58
|
+
background: background,
|
|
59
|
+
|
|
60
|
+
//100x100
|
|
61
|
+
particleCoin1: coin1,
|
|
62
|
+
particleCoin2: coin2,
|
|
63
|
+
particleCoin3: coin3,
|
|
64
|
+
particleRedBag1: redBag1,
|
|
65
|
+
particleRedBag2: redBag2,
|
|
66
|
+
|
|
67
|
+
//265x55
|
|
68
|
+
scrollTop: juanZhou1,
|
|
69
|
+
scrollBottom: juanZhou2,
|
|
70
|
+
|
|
71
|
+
//209x874
|
|
72
|
+
textLeft: chunLianLeft,
|
|
73
|
+
textRight: chunLianRight,
|
|
74
|
+
|
|
75
|
+
//320x320
|
|
76
|
+
snakeLeft: iLeftSnake,
|
|
77
|
+
snakeRight: iRightSnake,
|
|
78
|
+
|
|
79
|
+
//320x320
|
|
80
|
+
lanternLeft: iLeftLantern,
|
|
81
|
+
lanternRight: iRightLantern,
|
|
82
|
+
|
|
83
|
+
//88x106
|
|
84
|
+
iconRedBag: hongBao,
|
|
85
|
+
//99x71
|
|
86
|
+
iconYuanBao: yuanBao
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SprFestivalScene } from "./Scene.vue"
|