@shijiu/jsview-vue-samples 2.3.0 → 3.0.0-next-vue.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/CssPreprocessor/Scss/PanelData.js +1 -1
- package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +4 -3
- package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +2 -2
- 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 +158 -0
- package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
- package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +113 -0
- package/DemoForOperator/BookFlip/App.vue +115 -0
- package/DemoForOperator/BookFlip/BookFlip/FlipPage.vue +179 -0
- package/DemoForOperator/BookFlip/BookFlip/FlippingBook.vue +310 -0
- package/DemoForOperator/BookFlip/BookFlip/flip.glsl +135 -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 +205 -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 +1 -0
- package/DemoHomepage/components/Item.vue +11 -0
- package/DemoHomepage/components/TabFrame.vue +1 -1
- package/DemoHomepage/router.js +772 -135
- package/DemoHomepage/views/Homepage.vue +60 -2
- package/DemoHomepage/watchTest.vue +50 -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/FreeMoveChildAttract/App.vue +18 -8
- package/FreeMoveLink/App.vue +49 -20
- 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 +100 -47
- package/LongImage/Scroll.vue +28 -9
- package/LongText/LongTextScroll.vue +1 -0
- package/Markdown/App.vue +36 -0
- package/Markdown/Bubble.vue +109 -0
- package/Markdown/LongChat.vue +206 -0
- package/Markdown/Markdown/Markdown.vue +156 -0
- package/Markdown/Markdown/index.ts +1 -0
- package/Markdown/Markdown/marked/LICENSE.md +45 -0
- package/Markdown/Markdown/marked/index.ts +2 -0
- package/Markdown/Markdown/marked/marked.d.ts +756 -0
- package/Markdown/Markdown/marked/marked.js +71 -0
- package/Markdown/Markdown/parser.ts +1365 -0
- package/Markdown/data.js +581 -0
- package/MetroWidgetDemos/AI_skills_update.md +2 -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 +22 -7
- package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +7 -5
- package/MetroWidgetDemos/ninePatchFocusPage/focusConstants.js +2 -0
- package/MetroWidgetDemos/routeList.js +216 -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/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/TransitPage/App.vue +2 -0
- package/ViewOpacity/App.vue +19 -0
- package/assets/logo.png +0 -0
- package/package.json +5 -5
- 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/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,310 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { JsvTextureStoreApi } from "jsview";
|
|
3
|
+
|
|
4
|
+
const FLIP_STATUS_IDLE = 0;
|
|
5
|
+
const FLIP_STATUS_WAIT_DIV_READY = 1;
|
|
6
|
+
const FLIP_STATUS_TAKING = 2;
|
|
7
|
+
const FLIP_STATUS_READY = 3;
|
|
8
|
+
|
|
9
|
+
function takeTexture(pageDivRef, pageIndex) {
|
|
10
|
+
// 抓取界面
|
|
11
|
+
let holder = {
|
|
12
|
+
promiseRef: null,
|
|
13
|
+
textureRef: null,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
holder.promiseRef = new Promise((resolve, reject) => {
|
|
17
|
+
holder.textureRef = JsvTextureStoreApi.capture2Texture(
|
|
18
|
+
pageDivRef,
|
|
19
|
+
(textureAccessName) => {
|
|
20
|
+
if (textureAccessName != "") {
|
|
21
|
+
resolve(textureAccessName);
|
|
22
|
+
} else {
|
|
23
|
+
reject();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
return holder;
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<script setup>
|
|
33
|
+
import { computed, shallowRef, onUnmounted, onMounted, reactive } from "vue";
|
|
34
|
+
import pageFlipShader from "./flip.glsl?raw";
|
|
35
|
+
import { JsvFragShaderView } from "jsview";
|
|
36
|
+
|
|
37
|
+
// 定义组件的 props
|
|
38
|
+
const props = defineProps({
|
|
39
|
+
// 页面总数
|
|
40
|
+
pageCount: {
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 2,
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
// 初始化时显示的页面索引
|
|
46
|
+
initPageIndex: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 0,
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
// 组件的坐标 x,y
|
|
52
|
+
position: {
|
|
53
|
+
type: Object,
|
|
54
|
+
default: () => ({
|
|
55
|
+
x: 0,
|
|
56
|
+
y: 0,
|
|
57
|
+
}),
|
|
58
|
+
validator: (value) => {
|
|
59
|
+
return !isNaN(value.x) && !isNaN(value.y);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
// page的width,height
|
|
64
|
+
pageSize: {
|
|
65
|
+
type: Object,
|
|
66
|
+
required: true,
|
|
67
|
+
validator: (value) => {
|
|
68
|
+
return !isNaN(value.width) && !isNaN(value.height);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
// 动画持续时间
|
|
73
|
+
duration: {
|
|
74
|
+
type: Number,
|
|
75
|
+
default: 600,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const cFlipArea = {
|
|
80
|
+
width: Math.ceil(props.pageSize.width / 1.0),
|
|
81
|
+
height: Math.ceil(props.pageSize.height / 0.8),
|
|
82
|
+
x: 0,
|
|
83
|
+
y: 0,
|
|
84
|
+
};
|
|
85
|
+
// cFlipArea.x = Math.ceil((props.pageSize.width - cFlipArea.width) / 2); // 翻页区域对齐原div区域
|
|
86
|
+
// cFlipArea.y = Math.ceil((props.pageSize.height - cFlipArea.height) / 2); // 翻页区域对齐原div区域
|
|
87
|
+
|
|
88
|
+
// 创建rPageList数据,内容为shallowRef(null)
|
|
89
|
+
const rPageList = Array(props.pageCount)
|
|
90
|
+
.fill()
|
|
91
|
+
.map((_, idx) => ({
|
|
92
|
+
index: idx,
|
|
93
|
+
divRef: null,
|
|
94
|
+
pageReady: false,
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
const rPageLives = reactive([props.initPageIndex, -1]);
|
|
98
|
+
|
|
99
|
+
const rCurrentPageIndex = shallowRef(props.initPageIndex);
|
|
100
|
+
|
|
101
|
+
const rPrevPageIndex = shallowRef(-1);
|
|
102
|
+
|
|
103
|
+
// fragShaderView的Texture管理
|
|
104
|
+
const rTextureStatus = shallowRef(FLIP_STATUS_IDLE);
|
|
105
|
+
const rTextureNames = [shallowRef(null), shallowRef(null)];
|
|
106
|
+
let vTextureHolder = {
|
|
107
|
+
holder0: null,
|
|
108
|
+
holder1: null,
|
|
109
|
+
token: 0,
|
|
110
|
+
};
|
|
111
|
+
let vTexturePromiseAll = null;
|
|
112
|
+
|
|
113
|
+
const rPageFlipSettings = computed(() => {
|
|
114
|
+
return {
|
|
115
|
+
name: "pageFlip",
|
|
116
|
+
shader: pageFlipShader,
|
|
117
|
+
uniforms: [],
|
|
118
|
+
textures: [
|
|
119
|
+
{
|
|
120
|
+
name: "iChannel0",
|
|
121
|
+
resource: "jsvtexturestore://" + rTextureNames[1].value,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "iChannel1",
|
|
125
|
+
resource: "jsvtexturestore://" + rTextureNames[0].value,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
duration: props.duration,
|
|
129
|
+
onEnd: (end_or_cancel) => {
|
|
130
|
+
// 结束动画, 以触发prev页面的销毁
|
|
131
|
+
if (rTextureStatus.value == FLIP_STATUS_READY) {
|
|
132
|
+
// 非开新界面时,结束动画后,恢复到空闲状态
|
|
133
|
+
rTextureStatus.value = FLIP_STATUS_IDLE;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// 新进界面触发flush处理,第一个flush传来后才启动动画
|
|
140
|
+
const fncTriggerFlush = (pageIndex) => {
|
|
141
|
+
rPageList[pageIndex].pageReady = true;
|
|
142
|
+
|
|
143
|
+
// prev和current的page都ready了就启动翻页动画
|
|
144
|
+
if (
|
|
145
|
+
rTextureStatus.value == FLIP_STATUS_WAIT_DIV_READY &&
|
|
146
|
+
rPageList[rPrevPageIndex.value].pageReady &&
|
|
147
|
+
rPageList[rCurrentPageIndex.value].pageReady
|
|
148
|
+
) {
|
|
149
|
+
// 抓取界面
|
|
150
|
+
|
|
151
|
+
// 取消上一次的抓取
|
|
152
|
+
vTextureHolder.holder0?.textureRef.cancel();
|
|
153
|
+
vTextureHolder.holder1?.textureRef.cancel();
|
|
154
|
+
|
|
155
|
+
// 抓取当前界面
|
|
156
|
+
rTextureStatus.value = FLIP_STATUS_TAKING;
|
|
157
|
+
|
|
158
|
+
vTextureHolder = {
|
|
159
|
+
holder0: takeTexture(
|
|
160
|
+
rPageList[rPageLives[0]].divRef,
|
|
161
|
+
rPageList[rPageLives[0]].index
|
|
162
|
+
),
|
|
163
|
+
holder1: takeTexture(
|
|
164
|
+
rPageList[rPageLives[1]].divRef,
|
|
165
|
+
rPageList[rPageLives[1]].index
|
|
166
|
+
),
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
let holders = vTextureHolder;
|
|
170
|
+
|
|
171
|
+
// TODO: promise.all的引用和unmount时释放, 可能可以规避组件退出时内存泄露问题
|
|
172
|
+
vTexturePromiseAll = Promise.all([
|
|
173
|
+
holders.holder0.promiseRef,
|
|
174
|
+
holders.holder1.promiseRef,
|
|
175
|
+
])
|
|
176
|
+
.then(([page_0_texture, page_1_texture]) => {
|
|
177
|
+
if (rCurrentPageIndex.value > rPrevPageIndex.value) {
|
|
178
|
+
rTextureNames[0].value = page_0_texture;
|
|
179
|
+
rTextureNames[1].value = page_1_texture;
|
|
180
|
+
} else {
|
|
181
|
+
rTextureNames[0].value = page_1_texture;
|
|
182
|
+
rTextureNames[1].value = page_0_texture;
|
|
183
|
+
}
|
|
184
|
+
rTextureStatus.value = FLIP_STATUS_READY;
|
|
185
|
+
})
|
|
186
|
+
.finally(() => {
|
|
187
|
+
// resolve或者reject时,释放holder引用
|
|
188
|
+
holders.holder0 = null;
|
|
189
|
+
holders.holder1 = null;
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// 暴露组件方法给父组件
|
|
195
|
+
defineExpose({
|
|
196
|
+
/**
|
|
197
|
+
* 设置当前页码
|
|
198
|
+
* @param {number} pageIndex - 要设置的页码索引
|
|
199
|
+
*/
|
|
200
|
+
setCurrentPage: (pageIndex) => {
|
|
201
|
+
if (pageIndex < 0 || pageIndex >= props.pageCount) {
|
|
202
|
+
console.error(`页码超出范围: ${pageIndex}, 总页数: ${props.pageCount}`);
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (pageIndex == rCurrentPageIndex.value) {
|
|
207
|
+
// 如果当前页码和要设置的页码相同,则不进行操作
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 更新页码索引
|
|
212
|
+
// 保存旧的当前页码
|
|
213
|
+
const oldCurrentIndex = rCurrentPageIndex.value;
|
|
214
|
+
|
|
215
|
+
if (
|
|
216
|
+
rTextureStatus.value != FLIP_STATUS_IDLE &&
|
|
217
|
+
pageIndex == rPrevPageIndex.value &&
|
|
218
|
+
rPageList[pageIndex].pageReady
|
|
219
|
+
) {
|
|
220
|
+
// 在动画过程中,翻页反向,此时由于页面不重新mount,不会触发fncTriggerFlush
|
|
221
|
+
// 需要手动触发fncTriggerFlush
|
|
222
|
+
Promise.resolve().then(() => {
|
|
223
|
+
fncTriggerFlush(pageIndex);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// 设置当前页码
|
|
228
|
+
rCurrentPageIndex.value = pageIndex;
|
|
229
|
+
rPrevPageIndex.value = oldCurrentIndex;
|
|
230
|
+
|
|
231
|
+
// 界面进入动画状态
|
|
232
|
+
rTextureStatus.value = FLIP_STATUS_WAIT_DIV_READY;
|
|
233
|
+
|
|
234
|
+
// 设置新页面为未准备就绪
|
|
235
|
+
rPageList[pageIndex].pageReady = false;
|
|
236
|
+
|
|
237
|
+
rPageLives[0] = pageIndex;
|
|
238
|
+
rPageLives[1] = oldCurrentIndex; // 老页面遮挡在上面
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
onMounted(() => {});
|
|
243
|
+
|
|
244
|
+
onUnmounted(() => {
|
|
245
|
+
// 取消截屏处理,并释放promise引用
|
|
246
|
+
vTextureHolder.holder0?.textureRef.cancel();
|
|
247
|
+
vTextureHolder.holder1?.textureRef.cancel();
|
|
248
|
+
vTextureHolder.holder0 = null;
|
|
249
|
+
vTextureHolder.holder1 = null;
|
|
250
|
+
|
|
251
|
+
// 释放PromiseAll引用
|
|
252
|
+
vTexturePromiseAll = null;
|
|
253
|
+
});
|
|
254
|
+
</script>
|
|
255
|
+
|
|
256
|
+
<template>
|
|
257
|
+
<div
|
|
258
|
+
:style="{
|
|
259
|
+
left: props.position.x,
|
|
260
|
+
top: props.position.y,
|
|
261
|
+
}"
|
|
262
|
+
>
|
|
263
|
+
<!-- 通过key锁定, 当 currentPageIndex 变化时,已存在页面不会重新创建 -->
|
|
264
|
+
<div
|
|
265
|
+
v-show="rTextureStatus != FLIP_STATUS_READY"
|
|
266
|
+
v-for="pageIndex in rPageLives"
|
|
267
|
+
:key="pageIndex"
|
|
268
|
+
>
|
|
269
|
+
<div
|
|
270
|
+
v-if="
|
|
271
|
+
pageIndex == rCurrentPageIndex || rTextureStatus != FLIP_STATUS_IDLE
|
|
272
|
+
"
|
|
273
|
+
:ref="(el) => (rPageList[pageIndex].divRef = el)"
|
|
274
|
+
:style="{
|
|
275
|
+
width: props.pageSize.width,
|
|
276
|
+
height: props.pageSize.height,
|
|
277
|
+
}"
|
|
278
|
+
>
|
|
279
|
+
<slot :pageIndex="pageIndex" :triggerFlush="fncTriggerFlush"></slot>
|
|
280
|
+
</div>
|
|
281
|
+
<!-- <div
|
|
282
|
+
:style="{
|
|
283
|
+
width: 300,
|
|
284
|
+
height: 100,
|
|
285
|
+
fontSize: 20,
|
|
286
|
+
color: 'rgba(255,255,255,1)',
|
|
287
|
+
lineHeight: 100,
|
|
288
|
+
}"
|
|
289
|
+
>
|
|
290
|
+
当前界面: {{ "" + pageIndex + " " + rCurrentPageIndex }}
|
|
291
|
+
</div> -->
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<jsv-frag-shader-view
|
|
295
|
+
v-if="rTextureStatus == FLIP_STATUS_READY"
|
|
296
|
+
:style="{
|
|
297
|
+
left: cFlipArea.x,
|
|
298
|
+
top: cFlipArea.y,
|
|
299
|
+
width: cFlipArea.width,
|
|
300
|
+
height: cFlipArea.height,
|
|
301
|
+
}"
|
|
302
|
+
:duration="rPageFlipSettings.duration"
|
|
303
|
+
:shaderStr="rPageFlipSettings.shader"
|
|
304
|
+
:autoplay="true"
|
|
305
|
+
:reverseAnimate="rCurrentPageIndex < rPrevPageIndex"
|
|
306
|
+
:textures="rPageFlipSettings.textures"
|
|
307
|
+
:onEnd="rPageFlipSettings.onEnd"
|
|
308
|
+
></jsv-frag-shader-view>
|
|
309
|
+
</div>
|
|
310
|
+
</template>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#define PI 3.14159265359
|
|
2
|
+
#define RADIUS .05
|
|
3
|
+
#define LIGHT_DIR vec3(5,3,1)
|
|
4
|
+
#define SPECULAR_SHININESS 24.0
|
|
5
|
+
#define SPECULAR_COLOR vec3(1.0,1.0,1.0)
|
|
6
|
+
#define SPECULAR_POWER 10.0
|
|
7
|
+
//书籍范围的百分比
|
|
8
|
+
#define BOOK_BOUND vec4(0.00, 0.20, 1.00, 1.00)
|
|
9
|
+
|
|
10
|
+
// 优化的快速反正弦函数
|
|
11
|
+
float fastAsin(float x) {
|
|
12
|
+
// 使用更少的项来近似计算
|
|
13
|
+
// return x + (1.0 / 6.0) * x3 + (3.0 / 40.0) * x5 + (5.0 / 112.0) * x7;
|
|
14
|
+
return x + x*x*x*(1.0/6.0) + x*x*x*x*x*(3.0/40.0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 优化的矩形检测函数
|
|
18
|
+
bool inRect(vec2 uv, vec4 rect) {
|
|
19
|
+
return all(greaterThanEqual(uv, rect.xy)) && all(lessThanEqual(uv, rect.zw));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
vec3 fakeSpine(vec3 col, float t, float darken)
|
|
23
|
+
{
|
|
24
|
+
return mix(col * darken, col, min(1.0, sqrt(abs(t) * 30.0)));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
vec3 fakeNormal(float t, float center)
|
|
28
|
+
{
|
|
29
|
+
t -= center;
|
|
30
|
+
float interp = (1.0 - abs(t * 2.0)) * PI + PI * 0.75;
|
|
31
|
+
|
|
32
|
+
vec3 normal = vec3(abs(sin(interp)) ,0. , abs(cos(interp)));
|
|
33
|
+
|
|
34
|
+
return mix(normal, vec3(0.0, 0.0, 1.0), min(1.0, sqrt(abs(t) * 5.0)));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vec3 specular(vec3 viewDir, vec3 normal)
|
|
38
|
+
{
|
|
39
|
+
vec3 lightDir = normalize(LIGHT_DIR);
|
|
40
|
+
float dist = length(lightDir);
|
|
41
|
+
vec3 halfV = normalize(lightDir + normalize(viewDir));
|
|
42
|
+
|
|
43
|
+
float NdotH = dot(normal, halfV);
|
|
44
|
+
float intensity = pow(max(NdotH, 0.0), SPECULAR_SHININESS);
|
|
45
|
+
|
|
46
|
+
return intensity * SPECULAR_COLOR * SPECULAR_POWER / dist;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
|
|
50
|
+
vec2 aspect = iResolution.xy / iResolution.y;
|
|
51
|
+
vec2 uv = fragCoord / iResolution.y;
|
|
52
|
+
// vec2 mouse = iMouse.xy / iResolution.y;
|
|
53
|
+
|
|
54
|
+
vec4 bgColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
55
|
+
|
|
56
|
+
vec4 viewBounds = vec4(0., 0., aspect);
|
|
57
|
+
vec4 bookBounds = vec4(BOOK_BOUND.xy * aspect, BOOK_BOUND.zw * aspect);
|
|
58
|
+
vec2 bookSize = bookBounds.zw - bookBounds.xy;
|
|
59
|
+
vec2 bookAspect = bookSize.xy / bookSize.y;
|
|
60
|
+
vec4 bookUvBounds = vec4(0.0, 0.0, bookAspect);
|
|
61
|
+
vec2 bookUv = (uv - bookBounds.xy) / bookSize.y;
|
|
62
|
+
// mouse = (mouse - bookBounds.xy) / bookSize.y;
|
|
63
|
+
|
|
64
|
+
// 优化鼠标轨迹计算
|
|
65
|
+
float timeFact = 1. - iTime / iDuration;
|
|
66
|
+
vec2 mouse = vec2(timeFact, 1.2 * timeFact * (timeFact - 1.0) + 1.0) * bookAspect;
|
|
67
|
+
// 防止鼠标超出书本范围
|
|
68
|
+
mouse = clamp(mouse, vec2(0.0), bookAspect - vec2(1e-2));
|
|
69
|
+
|
|
70
|
+
//bookAspect为bookUv的右上角
|
|
71
|
+
vec2 mouseDir = normalize(bookAspect - mouse);
|
|
72
|
+
vec2 origin = mouse - mouseDir * mouse.x / abs(mouseDir.x);
|
|
73
|
+
vec2 axisPos = (mouse + bookAspect) * 0.5; // 使用乘法代替除法
|
|
74
|
+
|
|
75
|
+
float axisDist = length(axisPos - origin);
|
|
76
|
+
|
|
77
|
+
float proj = dot(bookUv - origin, mouseDir);
|
|
78
|
+
float dist = proj - axisDist;
|
|
79
|
+
vec2 linePoint = bookUv - dist * mouseDir;
|
|
80
|
+
|
|
81
|
+
float radius = clamp(2.0 * mouse.x * RADIUS, 0.0, RADIUS);
|
|
82
|
+
|
|
83
|
+
// 提前计算常用值
|
|
84
|
+
bool inBookBounds = inRect(uv, bookBounds);
|
|
85
|
+
|
|
86
|
+
if(dist > radius) {
|
|
87
|
+
if (inRect(uv, bookBounds)) {
|
|
88
|
+
fragColor = jsvTexture2D(iChannel1, bookUv / bookAspect);
|
|
89
|
+
} else {
|
|
90
|
+
fragColor = bgColor;
|
|
91
|
+
}
|
|
92
|
+
} else if(dist >= 0.0) {
|
|
93
|
+
//圆柱体部分
|
|
94
|
+
if (radius > 1e-5) {
|
|
95
|
+
float theta = fastAsin(dist / radius);
|
|
96
|
+
vec2 p1 = linePoint + mouseDir * theta * radius;
|
|
97
|
+
vec2 p2 = linePoint + mouseDir * (PI - theta) * radius;
|
|
98
|
+
|
|
99
|
+
vec2 uv2 = p2 / bookAspect;
|
|
100
|
+
uv2.x = 1.0 - uv2.x;
|
|
101
|
+
|
|
102
|
+
vec2 uv1 = p1 / bookAspect;
|
|
103
|
+
|
|
104
|
+
bool inP2 = inRect(p2, bookUvBounds);
|
|
105
|
+
bool inP1 = inRect(p1, bookUvBounds);
|
|
106
|
+
|
|
107
|
+
if(inP2) {
|
|
108
|
+
fragColor = jsvTexture2D(iChannel1, uv2);
|
|
109
|
+
fragColor.xyz += specular(vec3(0.0, 0.0, 1.0), fakeNormal(dist - radius * 0.5, 0.0)) * 0.2;
|
|
110
|
+
} else if(inP1) {
|
|
111
|
+
fragColor = jsvTexture2D(iChannel0, uv1);
|
|
112
|
+
} else {
|
|
113
|
+
fragColor = bgColor;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
vec2 p = linePoint + mouseDir * (abs(dist) + PI * radius);
|
|
118
|
+
bool inP = inRect(p, bookUvBounds);
|
|
119
|
+
|
|
120
|
+
if (inP) {
|
|
121
|
+
vec2 uv = p / bookAspect;
|
|
122
|
+
uv.x = 1.0 - uv.x;
|
|
123
|
+
fragColor = jsvTexture2D(iChannel1, uv);
|
|
124
|
+
} else if (inRect(bookUv, bookUvBounds) ) {
|
|
125
|
+
vec2 uv2 = bookUv / bookAspect;
|
|
126
|
+
fragColor = jsvTexture2D(iChannel0, uv2);
|
|
127
|
+
} else {
|
|
128
|
+
fragColor = bgColor;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (inBookBounds) {
|
|
133
|
+
fragColor.xyz = fakeSpine(fragColor.xyz, dist - radius, 0.0);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :style="pageStyle">
|
|
3
|
+
<div class="page-number">{{ index }}</div>
|
|
4
|
+
<div
|
|
5
|
+
class="page-detail"
|
|
6
|
+
:style="{
|
|
7
|
+
left: 30,
|
|
8
|
+
top: 30,
|
|
9
|
+
width: pageStyle.width - 60,
|
|
10
|
+
height: pageStyle.height - 60,
|
|
11
|
+
textOverflow: 'ellipsis',
|
|
12
|
+
backgroundColor: 'rgba(0,0,128,0.5)',
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
{{ TextList[index % 3] }}
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { computed, onUnmounted, onMounted } from "vue";
|
|
22
|
+
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
width: {
|
|
25
|
+
type: Number,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
height: {
|
|
29
|
+
type: Number,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
index: {
|
|
33
|
+
type: Number,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
flushTrigger: {
|
|
37
|
+
type: Function,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const TextList = [
|
|
43
|
+
"以下是长句子:\n" +
|
|
44
|
+
"1.石室诗士施氏,嗜狮,誓食十狮。2.施氏时时适市视狮。3.十时,适十狮适市。4.是时,适施氏适市。5.施氏视是十狮,恃矢势,使是十狮逝世。6.氏拾是十狮尸,适石室。7.石室湿,氏使侍拭石室。8.石室拭,施氏始试食是十狮尸。9.食时,始识是十狮尸,实十石狮尸。10.试释是事。\n",
|
|
45
|
+
"以下是长句子:\n" + "君不见,黄河之水天上来,奔流到海不复回。\n",
|
|
46
|
+
"以下是长句子:\n" +
|
|
47
|
+
'ABC انجليزي "abc" سعر الملابس 180 ABC انجليزي "abc" سعر الملابس 180 \n',
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
console.log("页面构建(测试BookFlip用key来保持prevPage)" + props.index);
|
|
51
|
+
|
|
52
|
+
const pageStyle = computed(() => {
|
|
53
|
+
const randomColor = `#${Math.floor(Math.random() * 16777215)
|
|
54
|
+
.toString(16)
|
|
55
|
+
.padStart(6, "0")}`;
|
|
56
|
+
return {
|
|
57
|
+
width: `${props.width}`,
|
|
58
|
+
height: `${props.height}`,
|
|
59
|
+
backgroundColor: randomColor,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
onMounted(() => {
|
|
64
|
+
console.log("页面挂载(测试BookFlip用key来保持prevPage)" + props.index);
|
|
65
|
+
props.flushTrigger(props.index); // 若有图片,要用jsvPreload进行图片预加载,并在预加载完成后调用flushTrigger
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
onUnmounted(() => {
|
|
69
|
+
console.log("页面销毁(测试BookFlip用key来保持prevPage)" + props.index);
|
|
70
|
+
});
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<style scoped>
|
|
74
|
+
.page-number {
|
|
75
|
+
font-size: 24px;
|
|
76
|
+
color: rgba(255, 255, 255, 1);
|
|
77
|
+
}
|
|
78
|
+
.page-detail {
|
|
79
|
+
font-size: 30px;
|
|
80
|
+
color: rgb(207, 52, 168);
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -22,10 +22,32 @@ import { shallowRef } from "vue";
|
|
|
22
22
|
import { buildBounce } from "./FreeMoveBuilder";
|
|
23
23
|
|
|
24
24
|
const props = defineProps({
|
|
25
|
+
/**
|
|
26
|
+
* 图片资源路径
|
|
27
|
+
* @type {String}
|
|
28
|
+
* @required
|
|
29
|
+
* @example
|
|
30
|
+
* // 正确用法
|
|
31
|
+
* src: "/images/ball.png"
|
|
32
|
+
*/
|
|
25
33
|
src: {
|
|
26
34
|
type: String,
|
|
27
35
|
required: true,
|
|
28
36
|
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 布局配置对象
|
|
40
|
+
* @type {Object}
|
|
41
|
+
* @required
|
|
42
|
+
* @typedef {Object} LayoutConfig
|
|
43
|
+
* @property {number} top - 组件顶部位置(单位:px)
|
|
44
|
+
* @property {number} left - 组件左侧位置(单位:px)
|
|
45
|
+
* @property {number} width - 组件宽度(单位:px)
|
|
46
|
+
* @property {number} height - 组件高度(单位:px)
|
|
47
|
+
* @example
|
|
48
|
+
* // 正确配置示例
|
|
49
|
+
* { top: 100, left: 200, width: 50, height: 50 }
|
|
50
|
+
*/
|
|
29
51
|
layout: {
|
|
30
52
|
type: Object,
|
|
31
53
|
required: true,
|
|
@@ -35,14 +57,24 @@ const props = defineProps({
|
|
|
35
57
|
let actorRef = shallowRef(null);
|
|
36
58
|
let vLeftSnakeControl = null;
|
|
37
59
|
|
|
60
|
+
/**
|
|
61
|
+
* 启动弹跳动画
|
|
62
|
+
* @param {number} left - 目标位置X坐标(单位:px)
|
|
63
|
+
* @param {number} top - 目标位置Y坐标(单位:px)
|
|
64
|
+
* @param {number} bounceTimes - 弹跳次数(建议1-5次)
|
|
65
|
+
* @description 调用此方法后组件会从当前位置向目标位置执行弹跳动画
|
|
66
|
+
* @example
|
|
67
|
+
* // 在(200,300)位置弹跳3次
|
|
68
|
+
* start(200, 300, 3)
|
|
69
|
+
*/
|
|
38
70
|
function startSnakeAnim(left, top, bounceTimes) {
|
|
39
|
-
// showSnake.value = true;
|
|
40
71
|
vLeftSnakeControl = actorRef.value.control;
|
|
41
72
|
vLeftSnakeControl.run((cmds) => [
|
|
42
73
|
...buildBounce(cmds, 1, left, top, bounceTimes, 2.0, (state) => {}),
|
|
43
74
|
]);
|
|
44
75
|
}
|
|
45
76
|
|
|
77
|
+
// 暴露给父组件的方法
|
|
46
78
|
defineExpose({
|
|
47
79
|
start: startSnakeAnim,
|
|
48
80
|
});
|
|
@@ -119,7 +119,7 @@ export function buildBounce(
|
|
|
119
119
|
cmds.state().removeConditionByGroup(condGroupId),
|
|
120
120
|
|
|
121
121
|
// wallPosition用于规避运动路程计算超出(times越大超出越多)时,解决动画结尾的回弹问题
|
|
122
|
-
cmds.condition(condGroupId, true, sWallConditionName).wallPosition(wallname, 0
|
|
122
|
+
cmds.condition(condGroupId, true, sWallConditionName).wallPosition(wallname, 0).then([
|
|
123
123
|
cmds.action().teleportTo(0, undefined),
|
|
124
124
|
cmds.action().setSpdAndAccel(0, undefined, undefined, undefined),
|
|
125
125
|
]),
|
|
@@ -103,7 +103,17 @@ import {
|
|
|
103
103
|
buildPreloadInfo,
|
|
104
104
|
} from "jsview";
|
|
105
105
|
import { shallowRef, onBeforeUnmount, watch } from "vue";
|
|
106
|
+
|
|
106
107
|
const props = defineProps({
|
|
108
|
+
/**
|
|
109
|
+
* 春联图片资源配置对象
|
|
110
|
+
* @type {Object}
|
|
111
|
+
* @property {string} leftContent - 左侧春联图片URL
|
|
112
|
+
* @property {string} rightContent - 右侧春联图片URL
|
|
113
|
+
* @property {string} scrollSprite - 滚轴精灵图URL
|
|
114
|
+
* @property {string} scrollStatic - 静态滚轴图片URL
|
|
115
|
+
* @required
|
|
116
|
+
*/
|
|
107
117
|
sourceMap: {
|
|
108
118
|
type: Object,
|
|
109
119
|
require: true,
|
|
@@ -116,6 +126,14 @@ const props = defineProps({
|
|
|
116
126
|
);
|
|
117
127
|
},
|
|
118
128
|
},
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 春联尺寸配置
|
|
132
|
+
* @type {Object}
|
|
133
|
+
* @property {number} width - 春联宽度
|
|
134
|
+
* @property {number} height - 春联高度
|
|
135
|
+
* @required
|
|
136
|
+
*/
|
|
119
137
|
size: {
|
|
120
138
|
type: Object,
|
|
121
139
|
required: true,
|
|
@@ -123,6 +141,14 @@ const props = defineProps({
|
|
|
123
141
|
return "width" in value && "height" in value;
|
|
124
142
|
},
|
|
125
143
|
},
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 左侧春联位置配置
|
|
147
|
+
* @type {Object}
|
|
148
|
+
* @property {number} left - 左侧春联的水平位置
|
|
149
|
+
* @property {number} top - 左侧春联的垂直位置
|
|
150
|
+
* @required
|
|
151
|
+
*/
|
|
126
152
|
leftPosition: {
|
|
127
153
|
type: Object,
|
|
128
154
|
require: true,
|
|
@@ -130,6 +156,14 @@ const props = defineProps({
|
|
|
130
156
|
return "left" in value && "top" in value;
|
|
131
157
|
},
|
|
132
158
|
},
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 右侧春联位置配置
|
|
162
|
+
* @type {Object}
|
|
163
|
+
* @property {number} left - 右侧春联的水平位置
|
|
164
|
+
* @property {number} top - 右侧春联的垂直位置
|
|
165
|
+
* @required
|
|
166
|
+
*/
|
|
133
167
|
rightPosition: {
|
|
134
168
|
type: Object,
|
|
135
169
|
require: true,
|
|
@@ -137,7 +171,16 @@ const props = defineProps({
|
|
|
137
171
|
return "left" in value && "top" in value;
|
|
138
172
|
},
|
|
139
173
|
},
|
|
140
|
-
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 动画持续时间(单位:秒)
|
|
177
|
+
* @type {Number}
|
|
178
|
+
* @required
|
|
179
|
+
*/
|
|
180
|
+
duration: {
|
|
181
|
+
type: Number,
|
|
182
|
+
require: true
|
|
183
|
+
}
|
|
141
184
|
});
|
|
142
185
|
const layouts = [{ ...props.leftPosition, isLeft: true }, props.rightPosition];
|
|
143
186
|
let myShow = shallowRef(false);
|