@shijiu/jsview-vue-samples 2.3.0 → 2.3.728-alpha.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/ABImageAlt/App.vue +114 -0
- package/ABImageAlt/Item.vue +133 -0
- package/{MetroWidgetDemos/SkeletonDiagram/assets/imageList.json → ABImageAlt/assets/imageList.js} +9 -1
- package/ABImageAlt/data.js +17 -0
- package/AI_Check_Rules.txt +5 -0
- package/AnimPicture/App.vue +20 -10
- package/ApicSwitch/App.vue +90 -0
- package/ApicSwitch/TabItem.vue +65 -0
- package/ApicSwitch/WebpShow.vue +24 -0
- package/ApicSwitch/data.js +50 -0
- package/Basic/AI_skills_update.md +1 -0
- package/Basic/components/div/ColorFormatTest.vue +93 -0
- package/Basic/components/div/DivRadius.vue +97 -15
- package/Basic/components/div/DivTag3Group.vue +30 -0
- package/Basic/components/img/ImageType.vue +65 -0
- package/Basic/components/panel/Panel2.vue +13 -1
- package/Basic/components/text/TextAlign.vue +7 -1
- package/BlobLoadTest/App.vue +201 -0
- package/BreakLinesApi/App.vue +82 -0
- package/CanvasDrawChart/App.vue +11 -0
- package/CanvasDrawChart/Graph1.vue +104 -0
- package/CanvasDrawChart/Graph2.vue +115 -0
- package/DashPath/App.vue +17 -16
- package/DashPath/AppForOperator.vue +2 -4
- package/DemoForOperator/AnimPic/AnimPic.vue +24 -2
- package/DemoForOperator/Banger/Banger/Banger.vue +73 -9
- package/DemoForOperator/Blur/Blur.vue +146 -0
- package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +184 -0
- package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
- package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +249 -0
- package/DemoForOperator/BookFlip/App.vue +115 -0
- package/DemoForOperator/BookFlip/BookPage.vue +82 -0
- package/DemoForOperator/Bounce/Bounce.vue +33 -1
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +1 -1
- package/DemoForOperator/ChunLian/Couplets.vue +44 -1
- package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
- package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
- package/DemoForOperator/DominantColor/App.vue +187 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +0 -3
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +76 -2
- package/DemoForOperator/Firework1/App.vue +13 -2
- package/DemoForOperator/Firework1/Fireworks.vue +68 -11
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +30 -1
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +27 -2
- package/DemoForOperator/Focus/Alpha/Item.vue +1 -0
- package/DemoForOperator/Focus/Light/Item.vue +1 -0
- package/DemoForOperator/Focus/Light/LightFocusBox.vue +42 -1
- package/DemoForOperator/Focus/Normal/Item.vue +1 -0
- package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +12 -0
- package/DemoForOperator/FrameShadow/App.vue +193 -0
- package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
- package/DemoForOperator/FullscreenIn/App.vue +1 -1
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +18 -3
- package/DemoForOperator/Genie/App.vue +20 -6
- package/DemoForOperator/Genie/App2.vue +61 -0
- package/DemoForOperator/Genie/geniePakcer/GenieImage.vue +298 -0
- package/DemoForOperator/Genie/geniePakcer/GenieSlot.vue +292 -0
- package/DemoForOperator/Genie/geniePakcer/GenieTools.ts +463 -0
- package/DemoForOperator/GrayFilter/GrayFilter.vue +21 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +58 -11
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +47 -9
- package/DemoForOperator/LongChatBox/App.vue +36 -0
- package/DemoForOperator/LongChatBox/Bubble.vue +116 -0
- package/DemoForOperator/LongChatBox/LongChat.vue +204 -0
- package/DemoForOperator/LongChatBox/testData.js +14 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +33 -1
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +23 -2
- package/DemoForOperator/PosterAnim/PosterAnim.js +21 -0
- package/DemoForOperator/PosterOverflow/PosterOverflow.vue +16 -0
- package/DemoForOperator/Resize/App.vue +157 -0
- package/DemoForOperator/Resize/Resize/Item.vue +234 -0
- package/DemoForOperator/Resize/Resize/Resize.vue +96 -0
- package/DemoForOperator/Ripple/Ripple.vue +16 -1
- package/DemoForOperator/ScreenShootScale/App.vue +96 -0
- package/DemoForOperator/ScreenShootScale/Back.vue +86 -0
- package/DemoForOperator/ScreenShootScale/Front.vue +133 -0
- package/DemoForOperator/ScreenShootScale/Item.vue +62 -0
- package/DemoForOperator/ScreenShootScale/ScreenShootScale.vue +109 -0
- package/DemoForOperator/SmoothSwiper/App.vue +50 -0
- package/DemoForOperator/Sound/Bounce/App.vue +56 -0
- package/DemoForOperator/Sound/Bounce/Bounce.vue +87 -0
- package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +146 -0
- package/DemoForOperator/Sound/Bounce/bgmusic.mp3 +0 -0
- package/DemoForOperator/Sound/Bounce/coin.mp3 +0 -0
- package/DemoForOperator/Sound/FocusMove/App.vue +134 -0
- package/DemoForOperator/Sound/FocusMove/Item.vue +43 -0
- package/DemoForOperator/Sound/FocusMove/move.mp3 +0 -0
- package/DemoForOperator/Sound/Rain/App.vue +11 -0
- package/DemoForOperator/Sound/Rain/Raining/Rain.vue +69 -0
- package/DemoForOperator/Sound/Rain/Raining/RainScene.vue +118 -0
- package/DemoForOperator/Sound/Sound/Sound.vue +24 -0
- package/DemoForOperator/Sound/Sound/index.js +4 -0
- package/DemoForOperator/Sound/Sound/useSound.js +112 -0
- package/DemoForOperator/Sprite/Sprite.vue +62 -5
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +52 -2
- package/DemoForOperator/Swiper/App.vue +101 -0
- package/DemoForOperator/Swiper/Item.vue +56 -0
- package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -0
- package/DemoForOperator/TabContent/TabContent/TabContent.vue +39 -1
- package/DemoForOperator/TabContentVertical/App.vue +104 -0
- package/DemoForOperator/TabContentVertical/ContentPage.vue +67 -0
- package/DemoForOperator/TabContentVertical/Item.vue +94 -0
- package/DemoForOperator/TabContentVertical/PageItem.vue +40 -0
- package/DemoForOperator/TabContentVertical/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContentVertical/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabContent.vue +184 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabWidget.vue +259 -0
- package/DemoForOperator/TabContentVertical/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContentVertical/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContentVertical/assets/children_science.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/documentary.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/free.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/game.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/home_selected.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/movie_ticket.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/my_account.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/opera.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/sports.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/tv_drama.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/variety_show.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/vip.png +0 -0
- package/DemoForOperator/TabContentVertical/testData.js +76 -0
- package/DemoForOperator/Vortex/Vortex/Vortex.vue +26 -0
- package/DemoForOperator/routeList.js +125 -2
- package/DemoHomepage/App.vue +74 -1
- package/DemoHomepage/components/BodyFrame.vue +5 -0
- package/DemoHomepage/components/Item.vue +11 -0
- package/DemoHomepage/components/TabFrame.vue +1 -1
- package/DemoHomepage/router.js +798 -140
- package/DemoHomepage/views/Homepage.vue +60 -2
- package/DemoHomepage/watchTest.vue +50 -0
- package/DomRenderer/App.vue +133 -0
- package/FilterDemo/AnimatePic.vue +63 -17
- package/FilterDemo/App.vue +3 -3
- package/FlexCellDemo/AI_skills_update.md +4 -0
- package/FlexCellDemo/TestFrame1.vue +12 -2
- package/FlexCellDemo/TestFrame2.vue +10 -1
- package/FlexCellDemo/TestFrame3.vue +114 -59
- package/FpsLimit/App.vue +102 -0
- package/FreeMove/App.vue +24 -279
- package/FreeMove/TestScene1.vue +260 -0
- package/FreeMove/TestScene3.vue +431 -0
- package/FreeMoveChildAttract/App.vue +18 -8
- package/FreeMoveLink/App.vue +51 -22
- package/GiftRain/components/SpriteTranslate.vue +68 -48
- package/HashHistory/App.vue +2 -2
- package/HashHistory/router.js +1 -1
- package/Hover/App.vue +144 -0
- package/HttpRequestSSE/SSEReader.js +200 -0
- package/ImpactStop/App.vue +2 -2
- package/Input/FullKeyboard.vue +3 -3
- package/Input/InputPanel.vue +63 -3
- package/JsvLine/App.vue +53 -38
- package/LatexDemo/App.vue +3 -1
- package/LatexFormula/App.vue +196 -0
- package/LongImage/App.vue +1 -1
- package/LongImage/LongImageScroll.vue +111 -46
- package/LongImage/Scroll.vue +28 -9
- package/LongText/LongTextScroll.vue +14 -1
- package/Markdown/App.vue +36 -0
- package/Markdown/Bubble.vue +109 -0
- package/Markdown/LongChat.vue +216 -0
- package/Markdown/data.js +633 -0
- package/MetroWidgetDemos/AI_skills_update.md +2 -0
- package/MetroWidgetDemos/EpgFlowListType/App.vue +206 -0
- package/MetroWidgetDemos/EpgFlowListType/components/ContentCard.vue +105 -0
- package/MetroWidgetDemos/EpgFlowListType/components/FloorSection.vue +131 -0
- package/MetroWidgetDemos/EpgFlowListType/components/LeftTabItem.vue +41 -0
- package/MetroWidgetDemos/EpgFlowListType/data.js +78 -0
- package/MetroWidgetDemos/ListExpand/ChildItem.vue +130 -0
- package/MetroWidgetDemos/ListExpand/ExpandItem.vue +375 -0
- package/MetroWidgetDemos/ListExpand/ExpandItem1.vue +403 -0
- package/MetroWidgetDemos/ListExpand/assets/arrow-down.png +0 -0
- package/MetroWidgetDemos/ListExpand/assets/up-arrow.png +0 -0
- package/MetroWidgetDemos/ListExpand/components/WidgetListHandler.vue +150 -0
- package/MetroWidgetDemos/ListExpand/index.vue +88 -0
- package/MetroWidgetDemos/ListExpand/list.js +2421 -0
- package/MetroWidgetDemos/RefreshDemo/App.vue +14 -1
- package/MetroWidgetDemos/RenderAccelerate/App.vue +142 -0
- package/MetroWidgetDemos/RenderAccelerate/AppPage.vue +78 -0
- package/MetroWidgetDemos/RenderAccelerate/AppTab.vue +62 -0
- package/MetroWidgetDemos/RenderAccelerate/ContentItem.vue +409 -0
- package/MetroWidgetDemos/{TripleWidget → RenderAccelerate}/Item.vue +6 -3
- package/MetroWidgetDemos/RenderAccelerate/TabItem.vue +100 -0
- package/MetroWidgetDemos/RenderAccelerate/ViewSwiper.vue +215 -0
- package/MetroWidgetDemos/RenderAccelerate/WidgetItem.vue +107 -0
- package/MetroWidgetDemos/SkeletonDiagram/App.vue +35 -8
- package/MetroWidgetDemos/SkeletonDiagram/Item.vue +11 -2
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.js +245 -0
- package/MetroWidgetDemos/SkeletonDiagram/data.js +3 -3
- package/MetroWidgetDemos/SpatialNav/App.vue +177 -0
- package/MetroWidgetDemos/SpatialNav/Buttons.vue +83 -0
- package/MetroWidgetDemos/SpatialNav/CustomFocus.vue +57 -0
- package/MetroWidgetDemos/SpatialNav/Item.vue +71 -0
- package/MetroWidgetDemos/SpatialNav/SimpleFloor.vue +86 -0
- package/MetroWidgetDemos/SpatialNav/StepMw.vue +113 -0
- package/MetroWidgetDemos/SpatialNav/TabContent/TabContent.vue +185 -0
- package/MetroWidgetDemos/SpatialNav/TripleSection/TripleSection.vue +69 -0
- package/MetroWidgetDemos/SpatialNav/TripleSection/WidgetItem.vue +100 -0
- package/MetroWidgetDemos/SpatialNav/TvSection/List.vue +75 -0
- package/MetroWidgetDemos/SpatialNav/TvSection/TvSection.vue +91 -0
- package/MetroWidgetDemos/basic2/App.vue +407 -0
- package/MetroWidgetDemos/basic2/Item.vue +68 -0
- package/MetroWidgetDemos/direction/App.vue +22 -0
- package/MetroWidgetDemos/gazeFocusDiff/App.vue +126 -0
- package/MetroWidgetDemos/gazeFocusDiff/Item.vue +87 -0
- package/MetroWidgetDemos/minimalUsage/App.vue +66 -0
- package/MetroWidgetDemos/minimalUsage/Item.vue +54 -0
- package/MetroWidgetDemos/ninePatchFocusPage/App.vue +23 -7
- package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +7 -5
- package/MetroWidgetDemos/ninePatchFocusPage/focusConstants.js +2 -0
- package/MetroWidgetDemos/routeList.js +229 -8
- package/MetroWidgetDemos/slideSetting/App.vue +288 -99
- package/MetroWidgetDemos/zIndex/App.vue +117 -0
- package/MetroWidgetDemos/zIndex/Item.vue +61 -0
- package/NinePatchTester/App.vue +24 -31
- package/PosterPacker/App.vue +2 -2
- package/PreDecode/App.vue +140 -0
- package/ReactiveTest/App.vue +115 -0
- package/ReactiveTest/Item.vue +92 -0
- package/ReactiveTest/assets/imageList.js +245 -0
- package/ReactiveTest/component/TestSmartDiv.vue +50 -0
- package/ReactiveTest/component/TestSmartDivSrcList.vue +74 -0
- package/ReactiveTest/component/TestSmartImage.vue +46 -0
- package/ReactiveTest/component/TestSmartImageSrcList.vue +90 -0
- package/ReactiveTest/component/TestSmartImageStyle.vue +41 -0
- package/ReactiveTest/data.js +49 -0
- package/ScreenToBlob/App.vue +250 -0
- package/ScrollBoxTest/App.vue +52 -28
- package/ScrollBoxTest/ClipBar.vue +64 -2
- package/ScrollBoxTest/NinePatchBar.vue +64 -2
- package/ScrollBoxTest/SizeDivBar.vue +64 -2
- package/SecTorTest/App.vue +9 -3
- package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +3 -3
- package/SyncDecode/App.vue +137 -0
- package/TextSizeLimit/App.vue +211 -0
- package/TextureAnimation/App3.vue +11 -1
- package/TouchWidget/App.vue +90 -5
- package/TouchWidget/WidgetItem.vue +1 -0
- package/TransitPage/App.vue +2 -0
- package/ViewOpacity/App.vue +19 -0
- package/assets/logo.png +0 -0
- package/package.json +1 -1
- package/DashPath/DashPath.vue +0 -118
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +0 -699
- package/DemoForOperator/ScalePoster/App.vue +0 -4
- package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
- package/DivMetroPerformance/App.vue +0 -157
- package/DivMetroPerformance/Item.vue +0 -58
- package/DivMetroPerformance/assets/bg.jpg +0 -0
- package/DivMetroPerformance/assets/coupon_content.png +0 -0
- package/DivMetroPerformance/assets/coupon_left.png +0 -0
- package/DivMetroPerformance/assets/coupon_mid.png +0 -0
- package/DivMetroPerformance/assets/coupon_right.png +0 -0
- package/DivMetroPerformance/assets/focus_border.png +0 -0
- package/DivMetroPerformance/assets/holder_logo.png +0 -0
- package/DivMetroPerformance/assets/jrbm.png +0 -0
- package/DivMetroPerformance/assets/line_left.png +0 -0
- package/DivMetroPerformance/assets/line_mid.png +0 -0
- package/DivMetroPerformance/assets/line_right.png +0 -0
- package/DivMetroPerformance/assets/loading.png +0 -0
- package/DivMetroPerformance/assets/logo.png +0 -0
- package/DivMetroPerformance/assets/mcjx.png +0 -0
- package/DivMetroPerformance/assets/tao.png +0 -0
- package/DivMetroPerformance/assets/tmall.png +0 -0
- package/DivMetroPerformance/border.png +0 -0
- package/DivMetroPerformance/components/ContentItem.vue +0 -384
- package/DivMetroPerformance/components/MyTab.vue +0 -129
- package/DivMetroPerformance/data.js +0 -124
- package/DivMetroPerformance/utils/GridItem.vue +0 -28
- package/DivMetroPerformance/utils/GridPlate.vue +0 -85
- package/MediaDemo/App.vue +0 -127
- package/MediaDemo/assets/audio-poster.png +0 -0
- package/MediaDemo/components/Button.vue +0 -69
- package/MediaDemo/components/Controllor.vue +0 -286
- package/MediaDemo/components/StatusBar.vue +0 -100
- package/MediaDemo/components/frames/AudioFrame.vue +0 -39
- package/MediaDemo/components/frames/AudioPoster.vue +0 -48
- package/MediaDemo/components/frames/MediaFrame.vue +0 -153
- package/MediaDemo/components/frames/VideoFrame.vue +0 -39
- package/MetroWidgetDemos/TripleWidget/App.vue +0 -81
- package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +0 -93
- package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +0 -111
- package/Parkour/App.vue +0 -13
- package/Parkour/Common/Context.js +0 -21
- package/Parkour/Common/MatchmanInfo.js +0 -62
- package/Parkour/Common/Random.js +0 -61
- package/Parkour/Common/Sound.js +0 -50
- package/Parkour/appConfig/HOW_TO_CONFIG.md +0 -20
- package/Parkour/appConfig/app.config.mjs +0 -5
- package/Parkour/appConfig/app_sign_private_key_sample.crt +0 -28
- package/Parkour/appConfig/app_sign_public_key_sample.pem +0 -9
- package/Parkour/appConfig/jsview.config.mjs +0 -39
- package/Parkour/assets/Bgimages/bg1.png +0 -0
- package/Parkour/assets/Bgimages/bg2.png +0 -0
- package/Parkour/assets/Bgimages/bg3.png +0 -0
- package/Parkour/assets/Bgimages/bg4.png +0 -0
- package/Parkour/assets/Bgimages/bg5.png +0 -0
- package/Parkour/assets/audio/jump.mp3 +0 -0
- package/Parkour/assets/audio/lose.mp3 +0 -0
- package/Parkour/assets/role_skin1/fail.json +0 -44
- package/Parkour/assets/role_skin1/fail.png +0 -0
- package/Parkour/assets/role_skin1/jump_down.json +0 -20
- package/Parkour/assets/role_skin1/jump_down.png +0 -0
- package/Parkour/assets/role_skin1/jump_up.json +0 -44
- package/Parkour/assets/role_skin1/jump_up.png +0 -0
- package/Parkour/assets/role_skin1/roll.json +0 -44
- package/Parkour/assets/role_skin1/roll.png +0 -0
- package/Parkour/assets/role_skin1/run.json +0 -52
- package/Parkour/assets/role_skin1/run.png +0 -0
- package/Parkour/components/Backdrop.vue +0 -61
- package/Parkour/components/GameSence.vue +0 -602
- package/Parkour/components/Matchman.vue +0 -85
- package/TextureAnimation/utils/FrameCanvasStore.ts +0 -68
- package/TextureAnimation/utils/RotateFrame.vue +0 -146
- package/TextureAnimation/utils/circleHaloMask.png +0 -0
- package/ThrowMoveDemo/AccelerateDemo.vue +0 -85
- package/ThrowMoveDemo/App.vue +0 -104
- package/ThrowMoveDemo/LRParabolicDemo.vue +0 -101
- package/ThrowMoveDemo/TargetDemo.vue +0 -87
- package/ThrowMoveDemo/UDParabolicDemo.vue +0 -92
- /package/{AnimPicture/assets → assets}/animated_webp.webp +0 -0
- /package/{AnimPicture/assets → assets}/ball_3.webp +0 -0
- /package/{AnimPicture/assets → assets}/girl_run.gif +0 -0
- /package/{AnimPicture/assets → assets}/quan.webp +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:08
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { MetroWidget, VERTICAL, useFocusHub, SeamlessSlide } from "jsview";
|
|
8
|
+
import Item from "./Item.vue";
|
|
9
|
+
import { onMounted, shallowRef } from "vue";
|
|
10
|
+
import { useSound, Sound } from "../Sound";
|
|
11
|
+
import moveSound from "./move.mp3";
|
|
12
|
+
|
|
13
|
+
const TAG = "MetroWidgetDemo";
|
|
14
|
+
|
|
15
|
+
const focusHub = useFocusHub();
|
|
16
|
+
|
|
17
|
+
const randomColor = () => {
|
|
18
|
+
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
19
|
+
return (
|
|
20
|
+
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const provideData = () => {
|
|
25
|
+
const data = [];
|
|
26
|
+
|
|
27
|
+
for (let i = 0; i < 200; i++) {
|
|
28
|
+
data.push({
|
|
29
|
+
width: 180,
|
|
30
|
+
height: 270,
|
|
31
|
+
marginRight: 10,
|
|
32
|
+
marginBottom: 10,
|
|
33
|
+
color: randomColor(),
|
|
34
|
+
content: i,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return data;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const measures = (data) => {
|
|
41
|
+
return {
|
|
42
|
+
width: data.width,
|
|
43
|
+
height: data.height,
|
|
44
|
+
marginRight: data.marginRight,
|
|
45
|
+
marginBottom: data.marginBottom,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// callbacks
|
|
50
|
+
const onEdge = (edgeInfo) => {
|
|
51
|
+
console.log(TAG, "onEdge", edgeInfo);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const onFocus = () => {
|
|
55
|
+
console.log(TAG, "onFocus");
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const onBlur = () => {
|
|
59
|
+
console.log(TAG, "onBlur");
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const onScroll = (start, range, totalSize) => {
|
|
63
|
+
console.log(TAG, "onScroll", start, range, totalSize);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const widgetLayout = {
|
|
67
|
+
left: 50,
|
|
68
|
+
top: 50,
|
|
69
|
+
width: 1000,
|
|
70
|
+
height: 600,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
onMounted(() => {
|
|
74
|
+
//组件mount后设置焦点
|
|
75
|
+
focusHub.setFocus("mainMw");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const { playSfx } = useSound(
|
|
79
|
+
null,
|
|
80
|
+
{
|
|
81
|
+
move: moveSound,
|
|
82
|
+
},
|
|
83
|
+
true
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const onDispatchKeyDown = (ev) => {
|
|
87
|
+
if (
|
|
88
|
+
ev.keyCode == 37 ||
|
|
89
|
+
ev.keyCode == 39 ||
|
|
90
|
+
ev.keyCode == 38 ||
|
|
91
|
+
ev.keyCode == 40
|
|
92
|
+
) {
|
|
93
|
+
playSfx("move");
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const slideSetting = new SeamlessSlide({
|
|
99
|
+
// easing: "cubic-bezier(.42,.11,.43,.91)",
|
|
100
|
+
easing: "jsv-ease(0.2, 0.6, 1.5)",
|
|
101
|
+
speed: 0.85,
|
|
102
|
+
});
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<template>
|
|
106
|
+
<div
|
|
107
|
+
:style="{
|
|
108
|
+
width: 1920,
|
|
109
|
+
height: 1080,
|
|
110
|
+
backgroundColor: '#007788',
|
|
111
|
+
}"
|
|
112
|
+
/>
|
|
113
|
+
<jsv-focus-block :onAction="{ onDispatchKeyDown }">
|
|
114
|
+
<metro-widget
|
|
115
|
+
name="mainMw"
|
|
116
|
+
:left="widgetLayout.left"
|
|
117
|
+
:top="widgetLayout.top"
|
|
118
|
+
:width="widgetLayout.width"
|
|
119
|
+
:height="widgetLayout.height"
|
|
120
|
+
:provideData="provideData"
|
|
121
|
+
:direction="VERTICAL"
|
|
122
|
+
:measures="measures"
|
|
123
|
+
:onEdge="onEdge"
|
|
124
|
+
:onFocus="onFocus"
|
|
125
|
+
:onBlur="onBlur"
|
|
126
|
+
:onScroll="onScroll"
|
|
127
|
+
:slideSetting="slideSetting"
|
|
128
|
+
>
|
|
129
|
+
<template #renderItem="{ data, onAction }">
|
|
130
|
+
<item :data="data" :onAction="onAction" />
|
|
131
|
+
</template>
|
|
132
|
+
</metro-widget>
|
|
133
|
+
</jsv-focus-block>
|
|
134
|
+
</template>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:17
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { ref } from "vue";
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
data: Object,
|
|
11
|
+
onAction: Object,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const focused = ref(false);
|
|
15
|
+
|
|
16
|
+
// 注册回调
|
|
17
|
+
const onFocus = () => {
|
|
18
|
+
focused.value = true;
|
|
19
|
+
};
|
|
20
|
+
const onBlur = () => {
|
|
21
|
+
focused.value = false;
|
|
22
|
+
};
|
|
23
|
+
const onClick = () => {
|
|
24
|
+
console.log("item onclick ", props.data);
|
|
25
|
+
};
|
|
26
|
+
props.onAction.register("onFocus", onFocus);
|
|
27
|
+
props.onAction.register("onBlur", onBlur);
|
|
28
|
+
props.onAction.register("onClick", onClick);
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<div
|
|
33
|
+
:style="{
|
|
34
|
+
width: data.width,
|
|
35
|
+
height: data.height,
|
|
36
|
+
fontSize: 30,
|
|
37
|
+
color: focused ? '#FF0000' : '#FFFFFF',
|
|
38
|
+
backgroundColor: data.color,
|
|
39
|
+
}"
|
|
40
|
+
>
|
|
41
|
+
{{ data.content }}
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
Binary file
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<JsvFreeMoveActor
|
|
3
|
+
:top="-myHeight"
|
|
4
|
+
:left="myLeft"
|
|
5
|
+
:width="2"
|
|
6
|
+
:height="myHeight"
|
|
7
|
+
ref="myRef"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
:style="{
|
|
11
|
+
width: 2,
|
|
12
|
+
height: myHeight,
|
|
13
|
+
backgroundImage: `jsvtexturestore://${sourceId}`,
|
|
14
|
+
}"
|
|
15
|
+
></div>
|
|
16
|
+
</JsvFreeMoveActor>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup>
|
|
20
|
+
import { shallowRef, onBeforeUnmount, onMounted } from "vue";
|
|
21
|
+
import { JsvTextureStoreApi, JsvFreeMoveActor } from "jsview";
|
|
22
|
+
let canvasRef;
|
|
23
|
+
let sourceId = shallowRef("");
|
|
24
|
+
const canvasTexture = JsvTextureStoreApi.canvasTexture(10, 200);
|
|
25
|
+
canvasTexture.drawLine(0, 0, 0, 200, 10, "rgba(255, 255, 255, 0.5)");
|
|
26
|
+
canvasRef = canvasTexture.commit();
|
|
27
|
+
sourceId.value = canvasRef;
|
|
28
|
+
//随机长度函数(限制在80-160)
|
|
29
|
+
const randomHeight = () => {
|
|
30
|
+
return Math.floor(Math.random() * 80) + 80;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//随机left值
|
|
34
|
+
const randomLeft = () => {
|
|
35
|
+
return Math.floor(Math.random() * 1280);
|
|
36
|
+
};
|
|
37
|
+
const myHeight = randomHeight();
|
|
38
|
+
const myLeft = randomLeft();
|
|
39
|
+
|
|
40
|
+
let myRef = shallowRef(null);
|
|
41
|
+
let myControl;
|
|
42
|
+
let randomInteger = Math.floor(Math.random() * 200) + 1;
|
|
43
|
+
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
myControl = myRef.value.control;
|
|
46
|
+
myControl.run((cmds) => [
|
|
47
|
+
cmds
|
|
48
|
+
.condition()
|
|
49
|
+
.onNextTick(randomInteger)
|
|
50
|
+
.then([
|
|
51
|
+
cmds.action().setSpeed(undefined, 9),
|
|
52
|
+
cmds.action(3).setAccel(undefined, 0.13),
|
|
53
|
+
]),
|
|
54
|
+
cmds
|
|
55
|
+
.condition(undefined, true)
|
|
56
|
+
.reachPosition(undefined, 620)
|
|
57
|
+
.then([
|
|
58
|
+
cmds.action().teleportTo(undefined, -580 - myHeight),
|
|
59
|
+
cmds.action().setSpeed(undefined, 9),
|
|
60
|
+
cmds.action(3).setAccel(undefined, 0.13),
|
|
61
|
+
]),
|
|
62
|
+
]);
|
|
63
|
+
});
|
|
64
|
+
onBeforeUnmount(() => {
|
|
65
|
+
JsvTextureStoreApi.deleteTexture(sourceId.value);
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<JsvRipple :width="1280" :height="720" ref="rippleViewRef">
|
|
3
|
+
<jsv-focus-block autoFocus>
|
|
4
|
+
<img
|
|
5
|
+
:src="bg"
|
|
6
|
+
:style="{ width: 1280, height: 720 }"
|
|
7
|
+
:onLoad="funcBackgroundOnLoaded"
|
|
8
|
+
/>
|
|
9
|
+
<div
|
|
10
|
+
:style="{
|
|
11
|
+
width: 100,
|
|
12
|
+
height: 100,
|
|
13
|
+
backgroundImage: title,
|
|
14
|
+
left: 900,
|
|
15
|
+
top: 40,
|
|
16
|
+
}"
|
|
17
|
+
></div>
|
|
18
|
+
<!-- 随机位置和长度的雨滴 -->
|
|
19
|
+
<Rain v-for="(item, index) in 60" />
|
|
20
|
+
<!-- 波纹效果 -->
|
|
21
|
+
</jsv-focus-block>
|
|
22
|
+
</JsvRipple>
|
|
23
|
+
<Sound :bgInfos="bgInfos" />
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup>
|
|
27
|
+
import Rain from "./Rain.vue";
|
|
28
|
+
import { JsvRipple, JsvRippleShape } from "jsview";
|
|
29
|
+
import { shallowRef, onMounted, onBeforeUnmount } from "vue";
|
|
30
|
+
import { useSound, Sound } from "../../Sound";
|
|
31
|
+
|
|
32
|
+
const bg =
|
|
33
|
+
"https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/qingming_bg.jpg";
|
|
34
|
+
const title =
|
|
35
|
+
"https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/qingming_title.png";
|
|
36
|
+
const musicBg =
|
|
37
|
+
"https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/rain_background.mp3";
|
|
38
|
+
const mySound =
|
|
39
|
+
"https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/TombSweepingDayTest/Raining/RainScene/rain_tiktok.mp3";
|
|
40
|
+
|
|
41
|
+
const { playSfx, playBg, pauseBg, bgInfos } = useSound(
|
|
42
|
+
{
|
|
43
|
+
bg: {
|
|
44
|
+
url: musicBg,
|
|
45
|
+
onLoad: () => {
|
|
46
|
+
console.log("bg onLoad");
|
|
47
|
+
playBg("bg");
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{ rain: mySound }
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
let timer = { id: -1, id2: -1 };
|
|
55
|
+
let rippleViewRef = shallowRef(null);
|
|
56
|
+
const genSource = () => {
|
|
57
|
+
let leftOrRight = Math.random() >= 0.5 ? true : false;
|
|
58
|
+
if (leftOrRight) {
|
|
59
|
+
return [
|
|
60
|
+
Math.floor(Math.random() * (336 - 214 + 1)) + 214,
|
|
61
|
+
Math.round(Math.random() * 200 + 400),
|
|
62
|
+
Math.round(Math.random() * 100 + 20),
|
|
63
|
+
];
|
|
64
|
+
} else {
|
|
65
|
+
return [
|
|
66
|
+
Math.floor(Math.random() * (1066 - 960 + 1)) + 960,
|
|
67
|
+
Math.round(Math.random() * 200 + 400),
|
|
68
|
+
Math.round(Math.random() * 100 + 20),
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
let backgrounLoaded = false;
|
|
74
|
+
const funcBackgroundOnLoaded = () => {
|
|
75
|
+
backgrounLoaded = true;
|
|
76
|
+
console.log("bg image loaded");
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
onMounted(() => {
|
|
80
|
+
if (rippleViewRef.value !== null) {
|
|
81
|
+
timer.id = setInterval(() => {
|
|
82
|
+
if (backgrounLoaded) {
|
|
83
|
+
// 图片加载完成后再追加波纹,规避绘出黑色的波圈
|
|
84
|
+
const p = genSource();
|
|
85
|
+
rippleViewRef.value.addSource(
|
|
86
|
+
...p,
|
|
87
|
+
{
|
|
88
|
+
type: JsvRippleShape.CIRCLE,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
timeDecay: 0.5,
|
|
92
|
+
distanceDecay: 8,
|
|
93
|
+
speed: 60,
|
|
94
|
+
frequency: 2,
|
|
95
|
+
waveNum: 2,
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
timer.id2 = setTimeout(() => {
|
|
100
|
+
playSfx("rain");
|
|
101
|
+
}, 1000);
|
|
102
|
+
}
|
|
103
|
+
}, 3000);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
onBeforeUnmount(() => {
|
|
107
|
+
if (timer.id !== -1) {
|
|
108
|
+
clearInterval(timer.id);
|
|
109
|
+
timer.id = -1;
|
|
110
|
+
}
|
|
111
|
+
if (timer.id2 !== -1) {
|
|
112
|
+
clearTimeout(timer.id2);
|
|
113
|
+
timer.id2 = -1;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<style scoped></style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { JsvAudio } from "jsview";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
bgInfos: {
|
|
6
|
+
type: Object,
|
|
7
|
+
default: () => {},
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
console.log("bgInfos", props.bgInfos);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<div>
|
|
15
|
+
<jsv-audio
|
|
16
|
+
v-for="(bgInfo, index) in bgInfos"
|
|
17
|
+
:key="index"
|
|
18
|
+
:onRef="bgInfo.onRef"
|
|
19
|
+
:onLoad="bgInfo.onLoad"
|
|
20
|
+
:src="bgInfo.url"
|
|
21
|
+
:loop="true"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { onMounted, onBeforeUnmount } from "vue";
|
|
2
|
+
import { JsvSoundPool, globalLoadJsvAudioPlugin } from "jsview";
|
|
3
|
+
|
|
4
|
+
let jsvAudioLoaded = false;
|
|
5
|
+
const safeLoadJsvAudio = () => {
|
|
6
|
+
if (!jsvAudioLoaded) {
|
|
7
|
+
globalLoadJsvAudioPlugin((status) => {
|
|
8
|
+
console.log("load JsvAudio plugin status", status);
|
|
9
|
+
if (status == 4) {
|
|
10
|
+
jsvAudioLoaded = true;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function useSound(bgSourceMap, sfxSourceMap, needRepeat = false) {
|
|
17
|
+
let sfxController = {};
|
|
18
|
+
let bgController = {};
|
|
19
|
+
|
|
20
|
+
let soundPool = null;
|
|
21
|
+
const loadSfx = (sfxMap) => {
|
|
22
|
+
soundPool = new JsvSoundPool(10);
|
|
23
|
+
for (const [key, value] of Object.entries(sfxMap)) {
|
|
24
|
+
if (needRepeat) {
|
|
25
|
+
soundPool.requestInRepeatMode(
|
|
26
|
+
`url(${value})`,
|
|
27
|
+
100,
|
|
28
|
+
null,
|
|
29
|
+
1,
|
|
30
|
+
(state, audioController) => {
|
|
31
|
+
if (state === 0) {
|
|
32
|
+
sfxController[key] = audioController;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
} else {
|
|
37
|
+
soundPool.request(
|
|
38
|
+
`url(${value})`,
|
|
39
|
+
null,
|
|
40
|
+
1,
|
|
41
|
+
(state, audioController) => {
|
|
42
|
+
if (state === 0) {
|
|
43
|
+
sfxController[key] = audioController;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
if (sfxSourceMap && Object.keys(sfxSourceMap).length > 0) {
|
|
51
|
+
loadSfx(sfxSourceMap);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const initBg = (bgMap) => {
|
|
55
|
+
if (!bgMap) return [];
|
|
56
|
+
const bgInfos = [];
|
|
57
|
+
for (const [key, value] of Object.entries(bgMap)) {
|
|
58
|
+
const onRef = (ele) => {
|
|
59
|
+
bgController[key] = ele;
|
|
60
|
+
};
|
|
61
|
+
bgInfos.push({
|
|
62
|
+
url: value.url,
|
|
63
|
+
onRef,
|
|
64
|
+
onLoad: () => {
|
|
65
|
+
console.log("bg onLoad 2", value.onLoad);
|
|
66
|
+
value.onLoad?.();
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return bgInfos;
|
|
71
|
+
};
|
|
72
|
+
const bgInfos = initBg(bgSourceMap);
|
|
73
|
+
|
|
74
|
+
onMounted(() => {
|
|
75
|
+
safeLoadJsvAudio();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
onBeforeUnmount(() => {
|
|
79
|
+
sfxController = {};
|
|
80
|
+
soundPool?.destroy();
|
|
81
|
+
|
|
82
|
+
for (const [key, value] of Object.entries(bgController)) {
|
|
83
|
+
value?.pause();
|
|
84
|
+
value?.unload();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const playSfx = (sfxKey) => {
|
|
89
|
+
if (sfxController[sfxKey]) {
|
|
90
|
+
sfxController[sfxKey].play();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const playBg = (bgKey) => {
|
|
95
|
+
if (bgController[bgKey]) {
|
|
96
|
+
bgController[bgKey]?.play();
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const pauseBg = (bgKey) => {
|
|
101
|
+
if (bgController[bgKey]) {
|
|
102
|
+
bgController[bgKey]?.pause();
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
playSfx,
|
|
108
|
+
playBg,
|
|
109
|
+
pauseBg,
|
|
110
|
+
bgInfos,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<JsvSpriteLoader
|
|
3
|
-
v-if="show"
|
|
4
3
|
:imageUrl="spriteSrc"
|
|
5
4
|
:configUrl="jsonUrl"
|
|
6
5
|
:onConfigReady="preloadCallback"
|
|
@@ -15,35 +14,76 @@
|
|
|
15
14
|
:spriteFrameSize="spriteOriginSize"
|
|
16
15
|
:viewSize="{ w: layout.width, h: layout.height }"
|
|
17
16
|
:onAnimEnd="onAnimEnd"
|
|
18
|
-
:autostart="
|
|
17
|
+
:autostart="props.autoStart"
|
|
19
18
|
/>
|
|
20
19
|
</JsvSpriteLoader>
|
|
21
20
|
</template>
|
|
22
21
|
|
|
23
22
|
<script setup>
|
|
24
|
-
import { computed, shallowRef, onMounted } from "vue";
|
|
23
|
+
import { computed, shallowRef, onMounted, watch } from "vue";
|
|
25
24
|
import { JsvSpriteAnim, JsvSpriteLoader, JsvSpriteTools } from "jsview";
|
|
26
25
|
|
|
27
26
|
const props = defineProps({
|
|
27
|
+
/**
|
|
28
|
+
* 雪碧图资源URL
|
|
29
|
+
* @type {String}
|
|
30
|
+
*/
|
|
28
31
|
spriteSrc: {
|
|
29
32
|
type: String,
|
|
30
33
|
},
|
|
34
|
+
/**
|
|
35
|
+
* 动画循环次数
|
|
36
|
+
* -1表示无限循环
|
|
37
|
+
* @type {Number}
|
|
38
|
+
* @default 0
|
|
39
|
+
*/
|
|
31
40
|
repeat: {
|
|
32
41
|
type: Number,
|
|
33
42
|
},
|
|
43
|
+
/**
|
|
44
|
+
* 容器尺寸配置
|
|
45
|
+
* @type {Object}
|
|
46
|
+
* @property {number} width - 容器宽度
|
|
47
|
+
* @property {number} height - 容器高度
|
|
48
|
+
*/
|
|
34
49
|
layout: {
|
|
35
50
|
type: Object,
|
|
36
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* 动画结束回调函数
|
|
54
|
+
* @type {Function|undefined}
|
|
55
|
+
*/
|
|
37
56
|
onEnd: {
|
|
38
57
|
type: Function,
|
|
39
58
|
},
|
|
59
|
+
/**
|
|
60
|
+
* 动画持续时间(单位:ms)
|
|
61
|
+
* 当设置duration时会覆盖雪碧图原始帧间隔时间
|
|
62
|
+
* @type {Number}
|
|
63
|
+
*/
|
|
40
64
|
duration: {
|
|
41
65
|
type: Number,
|
|
42
66
|
},
|
|
67
|
+
/**
|
|
68
|
+
* 是否自动开始动画
|
|
69
|
+
* @type {Boolean}
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
autoStart: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: true,
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* 动画结束帧
|
|
78
|
+
* @type {"start" | "end"}
|
|
79
|
+
*/
|
|
80
|
+
endFrame: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "end",
|
|
83
|
+
},
|
|
43
84
|
});
|
|
44
85
|
|
|
45
86
|
const spriteController = shallowRef();
|
|
46
|
-
const show = shallowRef(true);
|
|
47
87
|
|
|
48
88
|
const jsonUrl = computed(() => {
|
|
49
89
|
return props.spriteSrc + ".json";
|
|
@@ -70,8 +110,11 @@ const _formatInfo = (config_json) => {
|
|
|
70
110
|
return { info };
|
|
71
111
|
};
|
|
72
112
|
|
|
113
|
+
/**
|
|
114
|
+
* 动画结束处理函数
|
|
115
|
+
* 隐藏组件并触发外部回调
|
|
116
|
+
*/
|
|
73
117
|
function onAnimEnd() {
|
|
74
|
-
show.value = false;
|
|
75
118
|
props.onEnd?.();
|
|
76
119
|
}
|
|
77
120
|
|
|
@@ -86,5 +129,19 @@ const preloadCallback = (config_json, resolve_set) => {
|
|
|
86
129
|
resolve_set(); // 通知loader数组设置完成
|
|
87
130
|
};
|
|
88
131
|
|
|
132
|
+
watch(spriteController, (value) => {
|
|
133
|
+
if (value) {
|
|
134
|
+
if (props.autoStart) {
|
|
135
|
+
value.start("all", props.endFrame, props.duration, props.repeat);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
defineExpose({
|
|
141
|
+
play: () => {
|
|
142
|
+
spriteController.value.start("all", "end", props.duration, props.repeat);
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
89
146
|
onMounted(() => {});
|
|
90
147
|
</script>
|