@shijiu/jsview-vue 0.0.1-beta.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/docs/IMPORT_CHANGE_LOG.txt +3 -0
- package/docs/git_commit.md +15 -0
- package/docs/test_version_up.txt +1 -0
- package/dom/bin/jsview-dom-1.0.313.tgz +0 -0
- package/dom/browser-root-style.css +21 -0
- package/dom/jsv-browser-debug-dom.js +8 -0
- package/dom/jsv-dom.js +6 -0
- package/dom/jsv-forge-define.js +6 -0
- package/dom/target_core_revision.js +14 -0
- package/load/header_script_loader.js +134 -0
- package/load/jsview-main.js +42 -0
- package/load/jsview.config.default.js +37 -0
- package/load/jsview.default.config.js +37 -0
- package/load/loader.js +172 -0
- package/load/loader_webkit.js +40 -0
- package/package.json +27 -0
- package/patch/node_modules/@babel/preset-env/lib/available-plugins.js +219 -0
- package/patch/node_modules/@vue/cli-plugin-typescript/index.js +100 -0
- package/patch/node_modules/@vue/cli-service/lib/commands/serve.js +395 -0
- package/patch/node_modules/@vue/cli-service/lib/config/app.js +272 -0
- package/patch/node_modules/@vue/cli-service/lib/config/assets.js +70 -0
- package/patch/node_modules/@vue/cli-service/lib/config/base.js +212 -0
- package/patch/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +2566 -0
- package/patch/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +274 -0
- package/patch/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1596 -0
- package/patch/node_modules/postcss-js/objectifier.js +90 -0
- package/patch/node_modules/vue-loader/dist/resolveScript.js +70 -0
- package/patch/package-lock.json +30051 -0
- package/samples/AdvanceMetroWidget/App.vue +123 -0
- package/samples/AdvanceMetroWidget/Frame.vue +101 -0
- package/samples/AdvanceMetroWidget/Item.vue +58 -0
- package/samples/AdvanceMetroWidget/data.js +137 -0
- package/samples/AnimPicture/App.vue +224 -0
- package/samples/AnimPicture/assets/animated_webp.webp +0 -0
- package/samples/AnimPicture/assets/ball_3.webp +0 -0
- package/samples/AnimPicture/assets/girl_run.gif +0 -0
- package/samples/AnimPicture/assets/quan.webp +0 -0
- package/samples/Basic/App.vue +129 -0
- package/samples/Basic/assets/border.png +0 -0
- package/samples/Basic/assets/border2.png +0 -0
- package/samples/Basic/assets/icon.png +0 -0
- package/samples/Basic/assets/test.jpg +0 -0
- package/samples/Basic/components/ContentBlock.vue +36 -0
- package/samples/Basic/components/FontStyle.css +10 -0
- package/samples/Basic/components/TitleBar.vue +29 -0
- package/samples/Basic/components/anim/AnimGroup.vue +68 -0
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +102 -0
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +53 -0
- package/samples/Basic/components/anim/AnimTransition.vue +116 -0
- package/samples/Basic/components/div/DivBackground.vue +15 -0
- package/samples/Basic/components/div/DivClip.vue +81 -0
- package/samples/Basic/components/div/DivCssScoped.vue +27 -0
- package/samples/Basic/components/div/DivCssVar.vue +50 -0
- package/samples/Basic/components/div/DivGroup1.vue +33 -0
- package/samples/Basic/components/div/DivGroup2.vue +41 -0
- package/samples/Basic/components/div/DivLayout.vue +12 -0
- package/samples/Basic/components/div/DivRadius.vue +47 -0
- package/samples/Basic/components/text/TextAlign.vue +48 -0
- package/samples/Basic/components/text/TextFontStyle.vue +58 -0
- package/samples/Basic/components/text/TextGroup.vue +32 -0
- package/samples/Basic/components/text/TextOverflow.vue +78 -0
- package/samples/BasicFocusControl/App.vue +125 -0
- package/samples/BasicFocusControl/components/BaseBlock.vue +51 -0
- package/samples/BasicFocusControl/components/MainArea.vue +98 -0
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +21 -0
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +30 -0
- package/samples/BasicFocusControl/components/SideBar.vue +73 -0
- package/samples/BasicFocusControl/components/SideBarBlock.vue +30 -0
- package/samples/ClassNameDemo/App.vue +119 -0
- package/samples/ClassNameDemo/assets/bg.jpg +0 -0
- package/samples/ClassNameDemo/assets/coupon_content.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_left.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_mid.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_right.png +0 -0
- package/samples/ClassNameDemo/assets/focus_border.png +0 -0
- package/samples/ClassNameDemo/assets/holder_logo.png +0 -0
- package/samples/ClassNameDemo/assets/jrbm.png +0 -0
- package/samples/ClassNameDemo/assets/line_left.png +0 -0
- package/samples/ClassNameDemo/assets/line_mid.png +0 -0
- package/samples/ClassNameDemo/assets/line_right.png +0 -0
- package/samples/ClassNameDemo/assets/loading.png +0 -0
- package/samples/ClassNameDemo/assets/logo.png +0 -0
- package/samples/ClassNameDemo/assets/mcjx.png +0 -0
- package/samples/ClassNameDemo/assets/tao.png +0 -0
- package/samples/ClassNameDemo/assets/tmall.png +0 -0
- package/samples/ClassNameDemo/components/ContentItem.vue +253 -0
- package/samples/ClassNameDemo/components/LoadingView.vue +43 -0
- package/samples/ClassNameDemo/components/TitleView.vue +24 -0
- package/samples/ClassNameDemo/data.js +24 -0
- package/samples/ColorSpace/App.vue +135 -0
- package/samples/ColorSpace/bmpDemo.bmp +0 -0
- package/samples/ColorSpace/jpegDemo.jpeg +0 -0
- package/samples/ColorSpace/pngDemo.png +0 -0
- package/samples/ColorSpace/pngNoAlphaDemo.png +0 -0
- package/samples/DemoHomepage/App.vue +31 -0
- package/samples/DemoHomepage/components/BodyFrame.vue +82 -0
- package/samples/DemoHomepage/components/Dialog.vue +94 -0
- package/samples/DemoHomepage/components/Item.vue +77 -0
- package/samples/DemoHomepage/components/TabFrame.vue +86 -0
- package/samples/DemoHomepage/router.js +132 -0
- package/samples/DemoHomepage/views/Homepage.vue +186 -0
- package/samples/FlipCard/App.vue +80 -0
- package/samples/FlipCard/FlipCard.vue +124 -0
- package/samples/FlipCard/assets/blue_egg.png +0 -0
- package/samples/FlipCard/assets/red_egg.png +0 -0
- package/samples/FlipCard/data.js +13 -0
- package/samples/FlowMultiWidget/App.vue +91 -0
- package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
- package/samples/FlowMultiWidget/components/Block.vue +107 -0
- package/samples/FlowMultiWidget/components/FlowPage.vue +60 -0
- package/samples/FlowMultiWidget/components/Item.vue +103 -0
- package/samples/FlowMultiWidget/components/MenuItem.vue +72 -0
- package/samples/FlowMultiWidget/components/MyMenu.vue +90 -0
- package/samples/FlowMultiWidget/data.js +446 -0
- package/samples/HashHistory/App.vue +124 -0
- package/samples/HashHistory/components/HorizontalButtonList.vue +114 -0
- package/samples/HashHistory/components/Item.vue +74 -0
- package/samples/HashHistory/router.js +30 -0
- package/samples/HashHistory/views/BasePage.vue +19 -0
- package/samples/HashHistory/views/MainPage.vue +68 -0
- package/samples/HashHistory/views/SubPage.vue +79 -0
- package/samples/HashHistory/views/SubPageFirst.vue +10 -0
- package/samples/HashHistory/views/SubPageSecond.vue +10 -0
- package/samples/LongImage/App.vue +96 -0
- package/samples/LongImage/Button.vue +153 -0
- package/samples/LongImage/LongImageScroll.vue +127 -0
- package/samples/LongImage/Scroll.vue +16 -0
- package/samples/LongImage/assets/1280x7200.jpg +0 -0
- package/samples/LongText/App.vue +111 -0
- package/samples/LongText/Button.vue +153 -0
- package/samples/LongText/LongTextScroll.vue +225 -0
- package/samples/LongText/Scroll.vue +16 -0
- package/samples/Preload/App.vue +146 -0
- package/samples/Preload/data.js +23 -0
- package/samples/Preload/images/awesomeface.png +0 -0
- package/samples/Preload/images/cat.jpg +0 -0
- package/samples/Preload/images/rank.png +0 -0
- package/samples/Preload/images/rank_focus.png +0 -0
- package/samples/Preload/images/rule.png +0 -0
- package/samples/Preload/images/rule_focus.png +0 -0
- package/samples/Preload/images/start.png +0 -0
- package/samples/Preload/images/start_focus.png +0 -0
- package/samples/Preload/preloadItem.vue +22 -0
- package/samples/QrcodeDemo/App.vue +73 -0
- package/samples/SimpleWidgetDemo/App.vue +204 -0
- package/samples/SimpleWidgetDemo/Item.vue +83 -0
- package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
- package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
- package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
- package/samples/SimpleWidgetDemo/border.png +0 -0
- package/samples/SimpleWidgetDemo/components/ContentItem.vue +412 -0
- package/samples/SimpleWidgetDemo/components/MyTab.vue +117 -0
- package/samples/SimpleWidgetDemo/data.js +110 -0
- package/samples/SprayView/App.vue +270 -0
- package/samples/SprayView/assets/snow.png +0 -0
- package/samples/SpriteImage/App.vue +174 -0
- package/samples/SpriteImage/images/cat_run.png +0 -0
- package/samples/SpriteImage/images/egg_break.json +116 -0
- package/samples/SpriteImage/images/egg_break.png +0 -0
- package/samples/SpriteImage/images/sprite.png +0 -0
- package/samples/TextBox/App.vue +179 -0
- package/samples/TextBox/RenderCenter.vue +109 -0
- package/samples/TextBox/RenderLeft.vue +109 -0
- package/samples/TextBox/RenderOneLine.vue +120 -0
- package/samples/TextBox/RenderRight.vue +107 -0
- package/samples/TextShadowDemo/App.vue +98 -0
- package/samples/TextureSize/App.vue +142 -0
- package/samples/TextureSize/bmpDemo.bmp +0 -0
- package/samples/TextureSize/jpegDemo.jpeg +0 -0
- package/samples/TextureSize/jpgDemo.jpg +0 -0
- package/samples/TextureSize/pngDemo.png +0 -0
- package/samples/TextureSize/pngNoAlphaDemo.png +0 -0
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +118 -0
- package/samples/ThrowMoveDemo/App.vue +114 -0
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +116 -0
- package/samples/ThrowMoveDemo/TargetDemo.vue +117 -0
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +122 -0
- package/samples/TransitPage/App.vue +41 -0
- package/samples/VideoDemo/App.vue +137 -0
- package/samples/VideoDemo/components/Button.vue +69 -0
- package/samples/VideoDemo/components/Controllor.vue +195 -0
- package/samples/VideoDemo/components/VideoFrame.vue +152 -0
- package/scripts/git-commit-empty.js +21 -0
- package/scripts/install-local-packages.js +121 -0
- package/scripts/make-js.sh +181 -0
- package/scripts/post-build.js +132 -0
- package/scripts/post-install.js +127 -0
- package/scripts/pre-pack.js +2 -0
- package/scripts/run-android.js +64 -0
- package/utils/JsViewEngineWidget/bin/shijiu-jsview-vue-widget-1.0.1.tgz +0 -0
- package/utils/JsViewEngineWidget/index.d.ts +32 -0
- package/utils/JsViewEngineWidget/index.js +6 -0
- package/utils/JsViewVueTools/DebugContentShellJBridge.js +16 -0
- package/utils/JsViewVueTools/DebugTool.js +21 -0
- package/utils/JsViewVueTools/DefaultKeyMap.js +12 -0
- package/utils/JsViewVueTools/JsvDynamicCssStyle.js +73 -0
- package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +128 -0
- package/utils/JsViewVueTools/JsvHashHistory.js +112 -0
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +417 -0
- package/utils/JsViewVueTools/JsvStyleClass.js +290 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +80 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +148 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +55 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/ApicDataBase.js +29 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +124 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/GifData.js +83 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/LoopToolBase.js +25 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/NormalLoopTool.js +61 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/PartLoopTool.js +119 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/Viewer.js +106 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/WebpData.js +141 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetLoader.js +20 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js +11 -0
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +204 -0
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +64 -0
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +427 -0
- package/utils/JsViewVueWidget/JsvActorMove/index.js +12 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +179 -0
- package/utils/JsViewVueWidget/JsvApic/index.js +17 -0
- package/utils/JsViewVueWidget/JsvMarquee.vue +197 -0
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +92 -0
- package/utils/JsViewVueWidget/JsvNinePatch.vue +76 -0
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +351 -0
- package/utils/JsViewVueWidget/JsvPreload/index.js +21 -0
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +140 -0
- package/utils/JsViewVueWidget/JsvQrcode/index.js +18 -0
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +140 -0
- package/utils/JsViewVueWidget/JsvSpray/index.js +15 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +448 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.js +57 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +6 -0
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +35 -0
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +495 -0
- package/utils/JsViewVueWidget/JsvSwiper/index.js +10 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue +35 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +404 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/index.js +10 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +111 -0
- package/utils/JsViewVueWidget/JsvVideo.vue +36 -0
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2021-10-20 17:04:26
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2021-10-21 13:17:05
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Forge } from "../../../dom/jsv-forge-define";
|
|
10
|
+
import ActorControlBase from "./ActorControlBase";
|
|
11
|
+
|
|
12
|
+
const CONST_MOVE_TYPE_ACC = 1; // 抛物变速运动
|
|
13
|
+
const CONST_MOVE_TYPE_UNIFORM = 2; // 匀速运动
|
|
14
|
+
const CONST_MOVE_TYPE_JUMP = 3; // 无动画,直接调整坐标到目标位置
|
|
15
|
+
|
|
16
|
+
// 单向运动控制模块,单方向指的是只能进行一个方向的运动,要不是x,要不是y
|
|
17
|
+
class JsvActorMoveControl extends ActorControlBase {
|
|
18
|
+
constructor() {
|
|
19
|
+
// 0: X位置,
|
|
20
|
+
// 1: Y位置,
|
|
21
|
+
super(2);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* moveToX 参数说明:
|
|
26
|
+
* paused_callback (Function(x,y)) 运动暂停完成后的回调,回报当前JsvActorMove的相对x,y
|
|
27
|
+
*/
|
|
28
|
+
pause(paused_callback) {
|
|
29
|
+
super.pause(paused_callback);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* moveToX 参数说明:
|
|
34
|
+
* target_x (int) 带符号整数,标识运动的目标位置,相对于JsvActorMove当前位置
|
|
35
|
+
* speed (int) 带符号整数,符号表示方向,标识运动的运行速度,单位(pixel/s)
|
|
36
|
+
* end_callback (Function(x,y)) 运动到目标位置后的回调函数,回报当前JsvActorMove的相对x,y
|
|
37
|
+
*/
|
|
38
|
+
moveToX(target_x, speed, end_callback) {
|
|
39
|
+
this._UniformMove(0, target_x, NaN, speed, null, end_callback);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* moveToY 参数说明:
|
|
44
|
+
* target_y (int) 带符号整数,标识运动的目标位置,相对于JsvActorMove当前位置
|
|
45
|
+
* speed (int) 带符号整数,符号表示方向,标识运动的运行速度,单位(pixel/s)
|
|
46
|
+
* end_callback (Function(x,y)) 运动到目标位置后的回调函数,回报当前JsvActorMove的相对x,y
|
|
47
|
+
*/
|
|
48
|
+
moveToY(target_y, speed, end_callback) {
|
|
49
|
+
this._UniformMove(1, NaN, target_y, speed, null, end_callback);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* repeatMoveAlongX 参数说明:
|
|
54
|
+
* target_x (int) 带符号整数,标识运动的目标位置,相对于JsvActorMove当前位置
|
|
55
|
+
* speed (int) 带符号整数,符号表示方向,标识运动的运行速度,单位(pixel/s)
|
|
56
|
+
* repeat_start (int) 带符号整数,标识往复运动的起始点,使用时注意,JsvActorMove的当前位置必须在
|
|
57
|
+
* repeat_start和target_x之间
|
|
58
|
+
* repeat_callback (Function(times)) 完整一个运动周期后的回调,返回当前运动的周期数times
|
|
59
|
+
*/
|
|
60
|
+
repeatMoveAlongX(target_x, speed, repeat_start, repeat_callback) {
|
|
61
|
+
this._UniformMove(0,
|
|
62
|
+
target_x, NaN, speed,
|
|
63
|
+
{
|
|
64
|
+
start: repeat_start,
|
|
65
|
+
repeatCallback: repeat_callback,
|
|
66
|
+
},
|
|
67
|
+
null);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
* repeatMoveAlongY 参数说明:
|
|
72
|
+
* target_y (int) 带符号整数,标识运动的目标位置,相对于JsvActorMove当前位置
|
|
73
|
+
* speed (int) 带符号整数,符号表示方向,标识运动的运行速度,单位(pixel/s)
|
|
74
|
+
* repeat_start (int) 带符号整数,标识往复运动的起始点,使用时注意,JsvActorMove的当前位置必须在
|
|
75
|
+
* repeat_start和target_y之间
|
|
76
|
+
* repeat_callback (Function(times)) 完整一个运动周期后的回调,返回当前运动的周期数times
|
|
77
|
+
*/
|
|
78
|
+
repeatMoveAlongY(target_y, speed, repeat_start, repeat_callback) {
|
|
79
|
+
this._UniformMove(1,
|
|
80
|
+
NaN, target_y, speed,
|
|
81
|
+
{
|
|
82
|
+
start: repeat_start,
|
|
83
|
+
repeatCallback: repeat_callback,
|
|
84
|
+
},
|
|
85
|
+
null);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
_UniformMove(x_or_y, target_x, target_y, speed, repeat_set, end_callback) {
|
|
89
|
+
const start_params = {
|
|
90
|
+
type: CONST_MOVE_TYPE_UNIFORM,
|
|
91
|
+
xOrY: x_or_y,
|
|
92
|
+
speed,
|
|
93
|
+
repeatSet: repeat_set,
|
|
94
|
+
};
|
|
95
|
+
this._Target[0] = target_x;
|
|
96
|
+
this._Target[1] = target_y;
|
|
97
|
+
super.start(start_params, end_callback);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/*
|
|
101
|
+
* throwAlongX 参数说明:
|
|
102
|
+
* init_v (int) 带符号整形,描素运动初速度,单位(pixel/s)
|
|
103
|
+
* acc (int) 带符号整形,描素运动的加速度,单位(pixel/(s*s))
|
|
104
|
+
* end_condition (Object) 动画结束的条件设定
|
|
105
|
+
* 格式{type:"catch", position:xxx, offset:xxx, direction: 1 or -1}
|
|
106
|
+
* 例如:
|
|
107
|
+
* 1. X轴方向运动,在相对于起始点右方30px位置,接住向上运动的物体时,
|
|
108
|
+
* 设置 direction = -1, offset = -30
|
|
109
|
+
* 2. X轴方向运动,在相对于起始点左方30px位置,接住运动到右边界后回旋向左的运动的物体时,
|
|
110
|
+
* 设置 direction = 1, offset = 30
|
|
111
|
+
* position为相对于元素0点位置的绝对坐标,和offset的设定二选一
|
|
112
|
+
* end_callback (Function(x,y)) 运动到目标位置后的回调函数,回报当前JsvActorMove的相对x,y
|
|
113
|
+
* pole_callback (Function(void)) 动画运行到拐点时的回调
|
|
114
|
+
*/
|
|
115
|
+
throwAlongX(init_v, acc, end_condition, end_callback, pole_callback) {
|
|
116
|
+
this._Throw(0, init_v, acc, end_condition, end_callback, pole_callback);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/*
|
|
120
|
+
* throwAlongY 参数说明:
|
|
121
|
+
* init_v (int) 带符号整形,描素运动初速度,单位(pixel/s)
|
|
122
|
+
* acc (int) 带符号整形,描素运动的加速度,单位(pixel/(s*s))
|
|
123
|
+
* end_condition (Object) 动画结束的条件设定
|
|
124
|
+
* 格式{type:"catch", position:xxx, offset:xxx, direction: 1 or -1}
|
|
125
|
+
* 例如:
|
|
126
|
+
* 1. Y轴方向运动,在相对于起始点上方30px位置,接住向上运动的物体时,
|
|
127
|
+
* 设置 direction = -1, offset = -30
|
|
128
|
+
* 2. Y轴方向运动,在相对于起始点下方30px位置,接住运动到高点后跌落下来的运动的物体时,
|
|
129
|
+
* 设置 direction = 1, offset = 30
|
|
130
|
+
* position为相对于元素0点位置的绝对坐标,和offset的设定二选一
|
|
131
|
+
* end_callback (Function(x,y)) 运动到目标位置后的回调函数,回报当前JsvActorMove的相对x,y
|
|
132
|
+
* pole_callback (Function(void)) 动画运行到拐点时的回调
|
|
133
|
+
*/
|
|
134
|
+
throwAlongY(init_v, acc, end_condition, end_callback, pole_callback) {
|
|
135
|
+
this._Throw(1, init_v, acc, end_condition, end_callback, pole_callback);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
_Throw(x_or_y, init_v, acc, end_condition, end_callback, pole_callback) {
|
|
139
|
+
// 需要先进行动画停止,以确定本次动画的起始点(this._Current)
|
|
140
|
+
let super_start = super.start.bind(this);
|
|
141
|
+
super.pause(() => {
|
|
142
|
+
const start_params = this._CalculateTerminalStatus(x_or_y, init_v, acc, end_condition, pole_callback);
|
|
143
|
+
if (start_params !== null) {
|
|
144
|
+
super_start(start_params, end_callback);
|
|
145
|
+
} else {
|
|
146
|
+
// 无法确定终止点,动画无法启动
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/*
|
|
152
|
+
* jumpTo 参数说明:
|
|
153
|
+
* new_x (int) 带符号整数,标识目标位置,数值相对于JsvActorMove在render中的起始位置
|
|
154
|
+
* new_y (int) 带符号整数,标识目标位置,数值相对于JsvActorMove在render中的起始位置
|
|
155
|
+
*/
|
|
156
|
+
jumpTo(new_x, new_y) {
|
|
157
|
+
this._Target[0] = new_x;
|
|
158
|
+
this._Target[1] = new_y;
|
|
159
|
+
|
|
160
|
+
const start_params = {
|
|
161
|
+
type: CONST_MOVE_TYPE_JUMP,
|
|
162
|
+
};
|
|
163
|
+
super.start(start_params, null);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
_CalculateTerminalStatus(x_or_y, init_v, acc, end_condition, pole_callback) {
|
|
167
|
+
const start_params = {
|
|
168
|
+
type: CONST_MOVE_TYPE_ACC,
|
|
169
|
+
xOrY: x_or_y,
|
|
170
|
+
initV: init_v,
|
|
171
|
+
acc,
|
|
172
|
+
hasPole: false,
|
|
173
|
+
polePosition: 0,
|
|
174
|
+
poleCallback: pole_callback,
|
|
175
|
+
isPositiveMove: (init_v > 0 || (init_v === 0 && acc > 0))
|
|
176
|
+
};
|
|
177
|
+
let start_pos = (x_or_y === 0 ? this._Current[0] : this._Current[1]);
|
|
178
|
+
|
|
179
|
+
if (acc === 0) {
|
|
180
|
+
console.error("Error: Acceleration is not inited!");
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
let direction_revert = false;
|
|
185
|
+
let catch_direction = end_condition.direction;
|
|
186
|
+
let catch_pos = Object.prototype.hasOwnProperty.call(end_condition, "position") ?
|
|
187
|
+
end_condition.position
|
|
188
|
+
: (end_condition.offset + start_pos);
|
|
189
|
+
let move_pole_pos = 0; // 减速运动的顶点位置
|
|
190
|
+
let trace_include_pole = false; // 运动轨迹包含拐点
|
|
191
|
+
|
|
192
|
+
// 为了方便设计计算思路,根据初速度进行坐标系归一化(同归为向正方向进行计算)
|
|
193
|
+
if (init_v < 0 || (init_v === 0 && acc < 0)) {
|
|
194
|
+
// 启动坐标系反转
|
|
195
|
+
direction_revert = true;
|
|
196
|
+
init_v = -init_v;
|
|
197
|
+
acc = -acc;
|
|
198
|
+
start_pos = -start_pos;
|
|
199
|
+
catch_direction = -catch_direction;
|
|
200
|
+
catch_pos = -catch_pos;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (acc * init_v < 0) {
|
|
204
|
+
// 初速度与加速度反向
|
|
205
|
+
|
|
206
|
+
// 计算减速运动最终位移
|
|
207
|
+
move_pole_pos = start_pos + init_v * init_v / 2 / (-acc);
|
|
208
|
+
|
|
209
|
+
if (init_v * catch_direction < 0) {
|
|
210
|
+
// 准备在返回轨道中进行捕获
|
|
211
|
+
if (catch_pos > move_pole_pos) {
|
|
212
|
+
console.error(`Error: can not catch, range(<${move_pole_pos}), but catch=${catch_pos}`);
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
trace_include_pole = true;
|
|
216
|
+
} else {
|
|
217
|
+
// 准备在前进轨道中捕获
|
|
218
|
+
if (catch_pos > move_pole_pos || catch_pos < start_pos) {
|
|
219
|
+
console.error(`Error: can not catch, range(${start_pos}-${move_pole_pos}), but catch=${catch_pos}`);
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
} else {
|
|
224
|
+
// 初速度与加速度方向相同,包含初速度为0的场景
|
|
225
|
+
if (acc * catch_direction < 0) {
|
|
226
|
+
// 准备在返回轨道中进行捕获,但速度与加速度同向,无返回轨道,无法捕捉
|
|
227
|
+
console.error("Error: can not catch, direction incorrect");
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
// 准备在前进轨道中捕获
|
|
231
|
+
if (catch_pos < start_pos) {
|
|
232
|
+
console.error(`Error: can not catch, range(>${start_pos}), but catch=${catch_pos}`);
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// 方向恢复
|
|
238
|
+
if (direction_revert) {
|
|
239
|
+
catch_pos = -catch_pos;
|
|
240
|
+
move_pole_pos = -move_pole_pos;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// 记录拐点信息
|
|
244
|
+
start_params.hasPole = trace_include_pole;
|
|
245
|
+
start_params.polePosition = move_pole_pos;
|
|
246
|
+
|
|
247
|
+
// 刷新Target信息
|
|
248
|
+
if (x_or_y === 0) {
|
|
249
|
+
// X轴方向运动
|
|
250
|
+
this._Target[0] = catch_pos;
|
|
251
|
+
this._Target[1] = this._Current[1];
|
|
252
|
+
} else {
|
|
253
|
+
// Y轴方向运动
|
|
254
|
+
this._Target[0] = this._Current[0];
|
|
255
|
+
this._Target[1] = catch_pos;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return start_params;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
_BuildAccelAnimation(current_array, tos_array, start_params) {
|
|
262
|
+
const anim = new Forge.ThrowAnimation(
|
|
263
|
+
current_array[0],
|
|
264
|
+
current_array[1],
|
|
265
|
+
start_params.xOrY,
|
|
266
|
+
start_params.initV,
|
|
267
|
+
start_params.acc,
|
|
268
|
+
(start_params.xOrY === 0 ? tos_array[0] : tos_array[1]),
|
|
269
|
+
start_params.hasPole,
|
|
270
|
+
start_params.polePosition
|
|
271
|
+
);
|
|
272
|
+
anim.SetPoleCallback(start_params.poleCallback);
|
|
273
|
+
return anim;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
_BuildUniformMoveAnimation(current_array, tos_array, start_params) {
|
|
277
|
+
const affect_x = (start_params.xOrY === 0);
|
|
278
|
+
const from_pos = (affect_x ? current_array[0] : current_array[1]);
|
|
279
|
+
const to_pos = (affect_x ? tos_array[0] : tos_array[1]);
|
|
280
|
+
let anim = null;
|
|
281
|
+
|
|
282
|
+
if (start_params.repeatSet !== null) {
|
|
283
|
+
// 进行Repeat处理
|
|
284
|
+
const repeat_set = start_params.repeatSet;
|
|
285
|
+
|
|
286
|
+
// Repeat动画中,循环运动区域为repeatSet.start 到 to_pos,
|
|
287
|
+
// 但首次动画从from_pos开始运行,首次运动完成后,第二次运行再从repeatSet.start开始
|
|
288
|
+
const start_percent = (from_pos - repeat_set.start) / (to_pos - repeat_set.start);
|
|
289
|
+
if (start_percent > 1 || start_percent < 0) {
|
|
290
|
+
console.error(`Error: current=${from_pos} out of repeat range[${repeat_set.start}-${to_pos}]`);
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
anim = new Forge.TranslateFrameAnimation(
|
|
295
|
+
repeat_set.start, to_pos,
|
|
296
|
+
start_params.speed, affect_x,
|
|
297
|
+
current_array[0], current_array[1]
|
|
298
|
+
);
|
|
299
|
+
anim.SetStartPos(start_percent);
|
|
300
|
+
anim.EnableInfinite();
|
|
301
|
+
} else {
|
|
302
|
+
// 单次动画,无repeat
|
|
303
|
+
anim = new Forge.TranslateFrameAnimation(
|
|
304
|
+
from_pos, to_pos,
|
|
305
|
+
start_params.speed, affect_x,
|
|
306
|
+
current_array[0], current_array[1]
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return anim;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
_BuildJumpAnimation(current_array, tos_array) {
|
|
314
|
+
// 使用时长为0的Translate动画来完成jump动作
|
|
315
|
+
const anim = new Forge.TranslateAnimation(
|
|
316
|
+
tos_array[0], tos_array[0],
|
|
317
|
+
tos_array[1], tos_array[1],
|
|
318
|
+
1, null);
|
|
319
|
+
return anim;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
_ReCalculateAccelCurrent(froms, tos, progress, start_params) {
|
|
323
|
+
const position = { x: { value: froms[0] }, y: { value: froms[1] } };
|
|
324
|
+
let from = (start_params.xOrY === 0 ? position.x.value : position.y.value);
|
|
325
|
+
let to = (start_params.xOrY === 0 ? tos[0] : tos[1]);
|
|
326
|
+
const result_position_ref = (start_params.xOrY === 0 ? position.x : position.y);
|
|
327
|
+
let result_pos_value = 0;
|
|
328
|
+
|
|
329
|
+
// 转换坐标系,使运动始终向正方向以简化计算处理
|
|
330
|
+
from = (start_params.isPositiveMove ? from : -from);
|
|
331
|
+
to = (start_params.isPositiveMove ? to : -to);
|
|
332
|
+
const pole_position = (start_params.isPositiveMove ? start_params.polePosition : -start_params.polePosition);
|
|
333
|
+
|
|
334
|
+
if (start_params.hasPole) {
|
|
335
|
+
const moved = (pole_position * 2 - from - to) * progress;
|
|
336
|
+
if (moved > (pole_position - from)) {
|
|
337
|
+
// 运动了超过了拐点的距离
|
|
338
|
+
result_pos_value = pole_position - (moved - (pole_position - from));
|
|
339
|
+
} else {
|
|
340
|
+
// 未到达拐点
|
|
341
|
+
result_pos_value = from + moved;
|
|
342
|
+
}
|
|
343
|
+
} else {
|
|
344
|
+
result_pos_value = from + (to - from) * progress;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// 恢复坐标系
|
|
348
|
+
result_position_ref.value = Math.floor(start_params.isPositiveMove ? result_pos_value : -result_pos_value);
|
|
349
|
+
|
|
350
|
+
// 记录Current
|
|
351
|
+
this._Current[0] = position.x.value;
|
|
352
|
+
this._Current[1] = position.y.value;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
_ReCalculateUMoveCurrent(froms, tos, progress, start_params) {
|
|
357
|
+
if (start_params.xOrY === 0) {
|
|
358
|
+
const value = (tos[0] - froms[0]) * progress + froms[0];
|
|
359
|
+
const direction = value >= 0 ? 1 : -1;
|
|
360
|
+
this._Current[0] = direction * Math.floor(Math.abs(value));
|
|
361
|
+
} else {
|
|
362
|
+
const value = (tos[1] - froms[1]) * progress + froms[1];
|
|
363
|
+
const direction = value >= 0 ? 1 : -1;
|
|
364
|
+
this._Current[1] = direction * Math.floor(Math.abs(value));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
_ReCalculateJumpCurrent(froms, tos) {
|
|
369
|
+
this._Current[0] = tos[0];
|
|
370
|
+
this._Current[1] = tos[1];
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// 异常内部函数
|
|
374
|
+
start() { }
|
|
375
|
+
|
|
376
|
+
// Override
|
|
377
|
+
_WrapBuildAnimation(current_array, tos_array, start_params) {
|
|
378
|
+
if (start_params.type === CONST_MOVE_TYPE_ACC) {
|
|
379
|
+
// 加速运动
|
|
380
|
+
return this._BuildAccelAnimation(current_array, tos_array, start_params);
|
|
381
|
+
} if (start_params.type === CONST_MOVE_TYPE_UNIFORM) {
|
|
382
|
+
// 匀速运动
|
|
383
|
+
return this._BuildUniformMoveAnimation(current_array, tos_array, start_params);
|
|
384
|
+
} if (start_params.type === CONST_MOVE_TYPE_JUMP) {
|
|
385
|
+
// 位置调整
|
|
386
|
+
return this._BuildJumpAnimation(current_array, tos_array);
|
|
387
|
+
}
|
|
388
|
+
console.error("Error:Undefined yet");
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// Override
|
|
392
|
+
_WrapAddExtraListener(listener, start_params) {
|
|
393
|
+
if (start_params.type === CONST_MOVE_TYPE_UNIFORM) {
|
|
394
|
+
// 重复运动时,需要设定repeat回调
|
|
395
|
+
if (start_params.repeatSet !== null && start_params.repeatSet.repeatCallback) {
|
|
396
|
+
const repeat_callback = start_params.repeatSet.repeatCallback;
|
|
397
|
+
listener.OnRepeat((times) => {
|
|
398
|
+
repeat_callback(times);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Override
|
|
405
|
+
_WrapCallback(currents, callback, start_params) {
|
|
406
|
+
if (callback) {
|
|
407
|
+
callback(currents[0], currents[1], start_params);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Override
|
|
412
|
+
_WrapReCalculateCurrent(froms, tos, progress, start_params) {
|
|
413
|
+
if (start_params.type === CONST_MOVE_TYPE_ACC) {
|
|
414
|
+
this._ReCalculateAccelCurrent(froms, tos, progress, start_params);
|
|
415
|
+
} else if (start_params.type === CONST_MOVE_TYPE_UNIFORM) {
|
|
416
|
+
// 匀速运动
|
|
417
|
+
return this._ReCalculateUMoveCurrent(froms, tos, progress, start_params);
|
|
418
|
+
} else if (start_params.type === CONST_MOVE_TYPE_JUMP) {
|
|
419
|
+
// 位置调整
|
|
420
|
+
return this._ReCalculateJumpCurrent(froms, tos);
|
|
421
|
+
} else {
|
|
422
|
+
console.error("Error:Undefined yet");
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export default JsvActorMoveControl;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2021-10-20 18:20:20
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2021-10-20 18:21:29
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
import JsvActorMove from "./JsvActorMove.vue";
|
|
9
|
+
import JsvActorMoveControl from "./JsvActorMoveControl.js";
|
|
10
|
+
|
|
11
|
+
export default JsvActorMove;
|
|
12
|
+
export { JsvActorMoveControl };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2021-10-13 13:14:42
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2021-11-18 16:43:54
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
<!--
|
|
10
|
+
* 【模块 export 内容】
|
|
11
|
+
* JsvApic:Vue高阶组件,控制动图播放
|
|
12
|
+
* prop说明:
|
|
13
|
+
* src {string} 对应img标签的src
|
|
14
|
+
* style {object} 对应img标签的style
|
|
15
|
+
* loopType {enum} 循环播放类型 LOOP_DEFAULT(默认)/LOOP_INFINITE(无限)/LOOP_FINITE(有限)/LOOP_PART(部分帧循环)
|
|
16
|
+
* loopInfo {int[][3]} loopType为LOOP_PART时的循环设置,
|
|
17
|
+
* 格式[[循环次数1,循环开始帧1,循环结束帧1], [循环次数2,循环开始帧2,循环结束帧2], ...]
|
|
18
|
+
* 通过ref=拿到句柄后,可调用的方法:
|
|
19
|
+
* stop(): 停止播放
|
|
20
|
+
* play(): 开始播放
|
|
21
|
+
-->
|
|
22
|
+
<script>
|
|
23
|
+
import { ForgeExtension } from "../../../dom/jsv-forge-define";
|
|
24
|
+
|
|
25
|
+
let LOOP_DEFAULT = 0;
|
|
26
|
+
let LOOP_INFINITE = 1;
|
|
27
|
+
let LOOP_FINITE = 2;
|
|
28
|
+
let LOOP_PART = 3;
|
|
29
|
+
let LoopType = {
|
|
30
|
+
LOOP_DEFAULT: LOOP_DEFAULT,
|
|
31
|
+
LOOP_INFINITE: LOOP_INFINITE,
|
|
32
|
+
LOOP_FINITE: LOOP_FINITE,
|
|
33
|
+
LOOP_PART: LOOP_PART,
|
|
34
|
+
};
|
|
35
|
+
export { LoopType };
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
props: {
|
|
39
|
+
src: String,
|
|
40
|
+
style: Object,
|
|
41
|
+
autoPlay: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true,
|
|
44
|
+
},
|
|
45
|
+
loopType: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: LOOP_DEFAULT,
|
|
48
|
+
},
|
|
49
|
+
loopInfo: {
|
|
50
|
+
type: Array,
|
|
51
|
+
default: () => [[-1, -1, -1]],
|
|
52
|
+
},
|
|
53
|
+
onStart: Function,
|
|
54
|
+
onEnd: Function,
|
|
55
|
+
onLoad: Function,
|
|
56
|
+
},
|
|
57
|
+
setup() {
|
|
58
|
+
return {
|
|
59
|
+
element: {},
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
onStartId: -1,
|
|
65
|
+
onEndId: -1,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
methods: {
|
|
69
|
+
play() {
|
|
70
|
+
if (this.$refs.element) {
|
|
71
|
+
let main_view = this.$refs.element.jsvMainView;
|
|
72
|
+
if (main_view && main_view.ChildViews.length > 0) {
|
|
73
|
+
let target_view = main_view.ChildViews[0];
|
|
74
|
+
if (
|
|
75
|
+
target_view.TextureSetting &&
|
|
76
|
+
target_view.TextureSetting.Texture &&
|
|
77
|
+
target_view.TextureSetting.Texture.RenderTexture
|
|
78
|
+
) {
|
|
79
|
+
let params = {
|
|
80
|
+
LT: this.loopType,
|
|
81
|
+
LI: this.loopInfo,
|
|
82
|
+
};
|
|
83
|
+
ForgeExtension.TextureManager.DispatchCommand(
|
|
84
|
+
target_view.TextureSetting.Texture.RenderTexture.IdToken,
|
|
85
|
+
0,
|
|
86
|
+
JSON.stringify(params)
|
|
87
|
+
);
|
|
88
|
+
target_view.TextureSetting.Texture.unregisterOnStart(
|
|
89
|
+
this.onStartId
|
|
90
|
+
);
|
|
91
|
+
if (this.onStart) {
|
|
92
|
+
this.onStartId =
|
|
93
|
+
target_view.TextureSetting.Texture.registerOnStart(
|
|
94
|
+
this.onStart
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
target_view.TextureSetting.Texture.unregisterOnEnd(this.onEndId);
|
|
98
|
+
if (this.onEnd) {
|
|
99
|
+
this.onEndId = target_view.TextureSetting.Texture.registerOnEnd(
|
|
100
|
+
this.onEnd
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
stop() {
|
|
108
|
+
if (this.$refs.element) {
|
|
109
|
+
let main_view = this.$refs.element.jsvMainView;
|
|
110
|
+
if (main_view && main_view.ChildViews.length > 0) {
|
|
111
|
+
let target_view = main_view.ChildViews[0];
|
|
112
|
+
if (
|
|
113
|
+
target_view.TextureSetting &&
|
|
114
|
+
target_view.TextureSetting.Texture &&
|
|
115
|
+
target_view.TextureSetting.Texture.RenderTexture
|
|
116
|
+
) {
|
|
117
|
+
ForgeExtension.TextureManager.DispatchCommand(
|
|
118
|
+
target_view.TextureSetting.Texture.RenderTexture.IdToken,
|
|
119
|
+
1,
|
|
120
|
+
""
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
mounted() {
|
|
128
|
+
if (this.autoPlay) {
|
|
129
|
+
this.play();
|
|
130
|
+
}
|
|
131
|
+
if (this.onLoad) {
|
|
132
|
+
if (this.$refs.element) {
|
|
133
|
+
let main_view = this.$refs.element.jsvMainView;
|
|
134
|
+
if (main_view && main_view.ChildViews.length > 0) {
|
|
135
|
+
let target_view = main_view.ChildViews[0];
|
|
136
|
+
if (
|
|
137
|
+
target_view.TextureSetting &&
|
|
138
|
+
target_view.TextureSetting.Texture &&
|
|
139
|
+
target_view.TextureSetting.Texture.RenderTexture
|
|
140
|
+
) {
|
|
141
|
+
target_view.TextureSetting.Texture.RegisterLoadImageCallback(
|
|
142
|
+
null,
|
|
143
|
+
this.onLoad,
|
|
144
|
+
null
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
beforeUnmount() {
|
|
152
|
+
this.stop();
|
|
153
|
+
if (this.$refs.element) {
|
|
154
|
+
let main_view = this.$refs.element.jsvMainView;
|
|
155
|
+
if (main_view && main_view.ChildViews.length > 0) {
|
|
156
|
+
let target_view = main_view.ChildViews[0];
|
|
157
|
+
if (
|
|
158
|
+
target_view.TextureSetting &&
|
|
159
|
+
target_view.TextureSetting.Texture &&
|
|
160
|
+
target_view.TextureSetting.Texture.RenderTexture
|
|
161
|
+
) {
|
|
162
|
+
if (this.onStart) {
|
|
163
|
+
target_view.TextureSetting.Texture.unregisterOnStart(
|
|
164
|
+
this.onStartId
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
if (this.onEnd) {
|
|
168
|
+
target_view.TextureSetting.Texture.unregisterOnEnd(this.onEndId);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<template>
|
|
178
|
+
<img alt="" ref="element" :src="src" :style="style" />
|
|
179
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2021-10-13 15:12:45
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2021-10-13 17:41:08
|
|
6
|
+
* @Description: file content
|
|
7
|
+
*/
|
|
8
|
+
//考虑到.vue文件除了export default的component外,还有可能export其他对象,因此使用import * as
|
|
9
|
+
import * as JsvApic from "./JsvApic.vue";
|
|
10
|
+
let _JsvApic = JsvApic;
|
|
11
|
+
if (window.JsvWidgetWrapperGroup && window.JsvWidgetWrapperGroup.BrowserApic) {
|
|
12
|
+
_JsvApic = window.JsvWidgetWrapperGroup.BrowserApic;
|
|
13
|
+
}
|
|
14
|
+
let component = _JsvApic.default;
|
|
15
|
+
let LoopType = _JsvApic.LoopType;
|
|
16
|
+
export default component;
|
|
17
|
+
export { LoopType };
|