pixuireactcomponents 1.4.10 → 1.4.12
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/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
- package/src/components/react/app/carousel/Carousel.d.ts +2 -0
- package/src/components/react/app/carousel/Carousel.js +11 -8
- package/src/components/react/app/common.d.ts +3 -0
- package/src/components/react/app/common.js +13 -0
- package/src/components/{react/app/loadChecker → tools}/LoadChecker.d.ts +0 -1
- package/src/components/{react/app/loadChecker → tools}/LoadChecker.js +11 -8
- package/src/components/tools/antiRepeat.d.ts +7 -0
- package/src/components/tools/antiRepeat.js +21 -0
- package/src/components/js/frameAnimationJs/frameAnimationJs.d.ts +0 -46
- package/src/components/js/frameAnimationJs/frameAnimationJs.js +0 -125
package/index.d.ts
CHANGED
|
@@ -13,10 +13,10 @@ export { OutlineText } from "./src/components/react/base/outlinetext/OutlineText
|
|
|
13
13
|
export { FrameAnimation } from "./src/components/react/app/frameAnimation/FrameAnimation";
|
|
14
14
|
export { AsyncTaskProcessor } from "./src/components/tools/AsyncTaskProcessor";
|
|
15
15
|
export { assetCache } from "./src/components/tools/assetCache";
|
|
16
|
-
export { frameAnimationJs } from "./src/components/js/frameAnimationJs/frameAnimationJs";
|
|
17
16
|
export { ScrollBar } from "./src/components/react/app/scrollBar/ScrollBar";
|
|
18
17
|
export { tools } from "./src/components/tools/tools";
|
|
19
18
|
export { PreloadImg } from "./src/components/react/app/preloadImg/PreloadImg";
|
|
20
|
-
export { LoadChecker } from "./src/components/
|
|
19
|
+
export { LoadChecker } from "./src/components/tools/LoadChecker";
|
|
20
|
+
export { AntiRepeat } from "./src/components/tools/antiRepeat";
|
|
21
21
|
export { Slider, SliderProps } from "./src/components/react/app/slider/Slider";
|
|
22
22
|
export { ImgPreLoader_base64, PreLoadPic_base64 } from "./src/components/tools/ImgPreLoader";
|
package/index.js
CHANGED
|
@@ -16,8 +16,8 @@ export { FrameAnimation } from './src/components/react/app/frameAnimation/FrameA
|
|
|
16
16
|
export { ImgPreLoader_base64, PreLoadPic_base64 } from './src/components/tools/ImgPreLoader';
|
|
17
17
|
export { AsyncTaskProcessor } from './src/components/tools/AsyncTaskProcessor';
|
|
18
18
|
export { assetCache } from './src/components/tools/assetCache';
|
|
19
|
-
export { frameAnimationJs } from './src/components/js/frameAnimationJs/frameAnimationJs';
|
|
20
19
|
export { ScrollBar } from './src/components/react/app/scrollBar/ScrollBar';
|
|
21
20
|
export { tools } from './src/components/tools/tools';
|
|
22
21
|
export { PreloadImg } from './src/components/react/app/preloadImg/PreloadImg';
|
|
23
|
-
export { LoadChecker } from './src/components/
|
|
22
|
+
export { LoadChecker } from './src/components/tools/LoadChecker';
|
|
23
|
+
export { AntiRepeat } from './src/components/tools/antiRepeat';
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import { h } from 'preact';
|
|
|
14
14
|
* @param touchable - 是否允许手势切换
|
|
15
15
|
* @param onSlideChange - 切换元素后的回调函数
|
|
16
16
|
* @param onClick - 点击元素的回调函数
|
|
17
|
+
* @param touchSwitchDistance - 手势切换的距离,一个0-1的小数,代表父元素宽度的百分比
|
|
17
18
|
*/
|
|
18
19
|
export declare function Carousel(props: {
|
|
19
20
|
rootId?: string;
|
|
@@ -30,4 +31,5 @@ export declare function Carousel(props: {
|
|
|
30
31
|
touchable?: boolean;
|
|
31
32
|
onSlideChange?: Function | null;
|
|
32
33
|
onClick?: Function | null;
|
|
34
|
+
touchSwitchDistance?: number;
|
|
33
35
|
}): h.JSX.Element;
|
|
@@ -60,9 +60,12 @@ import { useImperativeHandle, useState, useRef, useMemo, useEffect } from 'preac
|
|
|
60
60
|
* @param touchable - 是否允许手势切换
|
|
61
61
|
* @param onSlideChange - 切换元素后的回调函数
|
|
62
62
|
* @param onClick - 点击元素的回调函数
|
|
63
|
+
* @param touchSwitchDistance - 手势切换的距离,一个0-1的小数,代表父元素宽度的百分比
|
|
63
64
|
*/
|
|
64
65
|
export function Carousel(props) {
|
|
65
|
-
var _a = props.rootId, rootId = _a === void 0 ? '' : _a, _b = props.rootClassName, rootClassName = _b === void 0 ? '' : _b, _c = props.children, children = _c === void 0 ? [] : _c, _d = props.defaultIndex, defaultIndex = _d === void 0 ? 1 : _d, _e = props.compWidth, compWidth = _e === void 0 ? 100 : _e, _f = props.compHeight, compHeight = _f === void 0 ? 100 : _f, _g = props.autoplay, autoplay = _g === void 0 ? true : _g, _h = props.switchDuration, switchDuration = _h === void 0 ? 3000 : _h, _j = props.loop, loop = _j === void 0 ? true : _j, _k = props.isVertical, isVertical = _k === void 0 ? false : _k, _l = props.touchable, touchable = _l === void 0 ? true : _l, _m = props.onSlideChange, onSlideChange = _m === void 0 ? null : _m, _o = props.onClick, onClick = _o === void 0 ? null : _o
|
|
66
|
+
var _a = props.rootId, rootId = _a === void 0 ? '' : _a, _b = props.rootClassName, rootClassName = _b === void 0 ? '' : _b, _c = props.children, children = _c === void 0 ? [] : _c, _d = props.defaultIndex, defaultIndex = _d === void 0 ? 1 : _d, _e = props.compWidth, compWidth = _e === void 0 ? 100 : _e, _f = props.compHeight, compHeight = _f === void 0 ? 100 : _f, _g = props.autoplay, autoplay = _g === void 0 ? true : _g, _h = props.switchDuration, switchDuration = _h === void 0 ? 3000 : _h, _j = props.loop, loop = _j === void 0 ? true : _j, _k = props.isVertical, isVertical = _k === void 0 ? false : _k, _l = props.touchable, touchable = _l === void 0 ? true : _l, _m = props.onSlideChange, onSlideChange = _m === void 0 ? null : _m, _o = props.onClick, onClick = _o === void 0 ? null : _o, _p = props.touchSwitchDistance, touchSwitchDistance = _p === void 0 ? props.touchSwitchDistance && props.touchSwitchDistance > 0 && props.touchSwitchDistance < 1
|
|
67
|
+
? props.touchSwitchDistance
|
|
68
|
+
: 0.3 : _p;
|
|
66
69
|
// console.log('children', children.length);
|
|
67
70
|
var safeNext = function () {
|
|
68
71
|
if (!canClickSwitch.current)
|
|
@@ -92,7 +95,7 @@ export function Carousel(props) {
|
|
|
92
95
|
setShowIndex: setShowIndex,
|
|
93
96
|
}); });
|
|
94
97
|
var duration = switchDuration < 1000 ? 1000 : switchDuration;
|
|
95
|
-
var
|
|
98
|
+
var _q = useState(defaultIndex), showIndex = _q[0], setShowIndex = _q[1];
|
|
96
99
|
//轮播元素正在滚动
|
|
97
100
|
var isMoving = useRef(false);
|
|
98
101
|
//鼠标手势信息
|
|
@@ -105,8 +108,8 @@ export function Carousel(props) {
|
|
|
105
108
|
var safeNextHandle = useRef();
|
|
106
109
|
var safePrevHandle = useRef();
|
|
107
110
|
var nextInterval = useRef();
|
|
108
|
-
var
|
|
109
|
-
var
|
|
111
|
+
var _r = useState(true), showTransition = _r[0], setShowTransition = _r[1];
|
|
112
|
+
var _s = useState([0, 0]), gestureoffset = _s[0], setGestureoffset = _s[1];
|
|
110
113
|
var offset = useMemo(function () { return -(isVertical ? compHeight : compWidth) * showIndex; }, [showIndex]);
|
|
111
114
|
var itemBoxStyle = {
|
|
112
115
|
minWidth: compWidth + 'px',
|
|
@@ -211,18 +214,18 @@ export function Carousel(props) {
|
|
|
211
214
|
isMouseDown.current = false;
|
|
212
215
|
//拖动大于1/3的时候跳转
|
|
213
216
|
if (isVertical) {
|
|
214
|
-
if (gestureoffset[1] > compHeight
|
|
217
|
+
if (gestureoffset[1] > compHeight * touchSwitchDistance) {
|
|
215
218
|
handlePrev();
|
|
216
219
|
}
|
|
217
|
-
else if (gestureoffset[1] < -compHeight
|
|
220
|
+
else if (gestureoffset[1] < -compHeight * touchSwitchDistance) {
|
|
218
221
|
handleNext();
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
224
|
else {
|
|
222
|
-
if (gestureoffset[0] > compWidth
|
|
225
|
+
if (gestureoffset[0] > compWidth * touchSwitchDistance) {
|
|
223
226
|
handlePrev();
|
|
224
227
|
}
|
|
225
|
-
else if (gestureoffset[0] < -compWidth
|
|
228
|
+
else if (gestureoffset[0] < -compWidth * touchSwitchDistance) {
|
|
226
229
|
handleNext();
|
|
227
230
|
}
|
|
228
231
|
}
|
|
@@ -10,12 +10,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
10
10
|
import h from 'lib/dom';
|
|
11
11
|
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
12
12
|
export var LoadChecker = function (props) {
|
|
13
|
-
var children = props.children, _a = props.rootClass, rootClass = _a === void 0 ? '' : _a, _b = props.timeoutPeriod, timeoutPeriod = _b === void 0 ? 500 : _b, onLoad = props.onLoad, _c = props.enableCompLog, enableCompLog = _c === void 0 ? false : _c, _d = props.
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
13
|
+
var children = props.children, _a = props.rootClass, rootClass = _a === void 0 ? '' : _a, _b = props.timeoutPeriod, timeoutPeriod = _b === void 0 ? 500 : _b, onLoad = props.onLoad, _c = props.enableCompLog, enableCompLog = _c === void 0 ? false : _c, _d = props.tag, tag = _d === void 0 ? '' : _d;
|
|
14
|
+
var _e = useState(false), loaded = _e[0], setLoaded = _e[1];
|
|
15
|
+
var _f = useState(false), collectFinish = _f[0], setCollectFinish = _f[1];
|
|
16
|
+
var _g = useState([]), loadedElements = _g[0], setLoadedElements = _g[1];
|
|
17
|
+
var _h = useState([]), collectSrcs = _h[0], setCollectSrcs = _h[1];
|
|
18
|
+
var _j = useState(new Date().getTime()), timeStamp = _j[0], setTimeStamp = _j[1];
|
|
19
19
|
var ref = useRef(null);
|
|
20
20
|
var myLog = function () {
|
|
21
21
|
var args = [];
|
|
@@ -29,6 +29,8 @@ export var LoadChecker = function (props) {
|
|
|
29
29
|
//0.5s后直接显示
|
|
30
30
|
useEffect(function () {
|
|
31
31
|
var timer = setTimeout(function () {
|
|
32
|
+
if (loaded)
|
|
33
|
+
return;
|
|
32
34
|
setLoaded(true);
|
|
33
35
|
myLog(timeoutPeriod, 's timeout, direct show');
|
|
34
36
|
}, timeoutPeriod);
|
|
@@ -48,7 +50,7 @@ export var LoadChecker = function (props) {
|
|
|
48
50
|
if (!collectFinish)
|
|
49
51
|
return;
|
|
50
52
|
myLog('elementsLoadedCount:', loadedElements.length, 'collectSrcs:', collectSrcs.length);
|
|
51
|
-
myLog('loadedElements:', loadedElements, collectSrcs);
|
|
53
|
+
myLog('loadedElements:', JSON.stringify(loadedElements, null, 4), JSON.stringify(collectSrcs, null, 4));
|
|
52
54
|
if (collectSrcs.length == 0 || loadedElements.length >= collectSrcs.length) {
|
|
53
55
|
myLog('all loaded, srcs:', JSON.stringify(collectSrcs, null, 2));
|
|
54
56
|
myLog('all loaded, timeStamp:', new Date().getTime() - timeStamp);
|
|
@@ -84,7 +86,8 @@ export var LoadChecker = function (props) {
|
|
|
84
86
|
if (src.startsWith('url(')) {
|
|
85
87
|
src = src.substring(4, src.length - 1);
|
|
86
88
|
}
|
|
87
|
-
|
|
89
|
+
//非http开头:本地资源,在useeffect时已经onload了。 http://后带有:,本地预览时的本地资源,同理
|
|
90
|
+
if (!src.startsWith('http') || (src.startsWith('http://') && src.substring(7).includes(':'))) {
|
|
88
91
|
return '';
|
|
89
92
|
}
|
|
90
93
|
return src;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { singleton } from '../react/app/common';
|
|
2
|
+
var AntiRepeatImpl = /** @class */ (function () {
|
|
3
|
+
function AntiRepeatImpl() {
|
|
4
|
+
this.lastExecTime = 0;
|
|
5
|
+
}
|
|
6
|
+
AntiRepeatImpl.prototype.wrap = function (func, interval) {
|
|
7
|
+
var _this = this;
|
|
8
|
+
if (interval === void 0) { interval = 2000; }
|
|
9
|
+
return function () {
|
|
10
|
+
var now = Date.now();
|
|
11
|
+
if (now - _this.lastExecTime < interval) {
|
|
12
|
+
console.log('anti repeat block click');
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
_this.lastExecTime = now;
|
|
16
|
+
func();
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
return AntiRepeatImpl;
|
|
20
|
+
}());
|
|
21
|
+
export var AntiRepeat = singleton(AntiRepeatImpl).getInstance();
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FrameAnimation的js版本
|
|
3
|
-
* @param rootId 根节点id
|
|
4
|
-
* @param rootClassName 根节点className
|
|
5
|
-
* @param totalTime 动画总时长
|
|
6
|
-
* @param width 组件宽度
|
|
7
|
-
* @param height 组件高度
|
|
8
|
-
* @param srcArr 图片url数组
|
|
9
|
-
* @param onShow 每一帧显示时的回调
|
|
10
|
-
* @param onFinish 动画结束时的回调
|
|
11
|
-
* @param preloadCount 预加载节点的数量
|
|
12
|
-
* @param loop 是否循环播放
|
|
13
|
-
* @param showLastFrame 播放结束后是否显示最后一帧
|
|
14
|
-
*/
|
|
15
|
-
export class frameAnimationJs {
|
|
16
|
-
constructor({ rootId, rootClassName, totalTime, width, height, srcArr, onShow, onFinish, preloadCount, loop, showLastFrame, }: {
|
|
17
|
-
rootId?: string | undefined;
|
|
18
|
-
rootClassName?: string | undefined;
|
|
19
|
-
totalTime: any;
|
|
20
|
-
width: any;
|
|
21
|
-
height: any;
|
|
22
|
-
srcArr: any;
|
|
23
|
-
onShow: any;
|
|
24
|
-
onFinish: any;
|
|
25
|
-
preloadCount?: number | undefined;
|
|
26
|
-
loop?: boolean | undefined;
|
|
27
|
-
showLastFrame?: boolean | undefined;
|
|
28
|
-
});
|
|
29
|
-
rootId: string;
|
|
30
|
-
rootClassName: string;
|
|
31
|
-
totalTime: any;
|
|
32
|
-
width: any;
|
|
33
|
-
height: any;
|
|
34
|
-
srcArr: any;
|
|
35
|
-
onShow: any;
|
|
36
|
-
onFinish: any;
|
|
37
|
-
preloadCount: number;
|
|
38
|
-
loop: boolean;
|
|
39
|
-
showLastFrame: boolean;
|
|
40
|
-
cRefArr: HTMLImageElement[];
|
|
41
|
-
imgEleArr: HTMLImageElement[];
|
|
42
|
-
nextFrame(startTime: any, oneFrameTime: any, showedFrame: any): void;
|
|
43
|
-
rootEle: HTMLDivElement;
|
|
44
|
-
init(): void;
|
|
45
|
-
getRootEle(): HTMLDivElement;
|
|
46
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FrameAnimation的js版本
|
|
3
|
-
* @param rootId 根节点id
|
|
4
|
-
* @param rootClassName 根节点className
|
|
5
|
-
* @param totalTime 动画总时长
|
|
6
|
-
* @param width 组件宽度
|
|
7
|
-
* @param height 组件高度
|
|
8
|
-
* @param srcArr 图片url数组
|
|
9
|
-
* @param onShow 每一帧显示时的回调
|
|
10
|
-
* @param onFinish 动画结束时的回调
|
|
11
|
-
* @param preloadCount 预加载节点的数量
|
|
12
|
-
* @param loop 是否循环播放
|
|
13
|
-
* @param showLastFrame 播放结束后是否显示最后一帧
|
|
14
|
-
*/
|
|
15
|
-
var frameAnimationJs = /** @class */ (function () {
|
|
16
|
-
function frameAnimationJs(_a) {
|
|
17
|
-
var _b = _a.rootId, rootId = _b === void 0 ? '' : _b, _c = _a.rootClassName, rootClassName = _c === void 0 ? '' : _c, totalTime = _a.totalTime, width = _a.width, height = _a.height, srcArr = _a.srcArr, onShow = _a.onShow, onFinish = _a.onFinish, _d = _a.preloadCount, preloadCount = _d === void 0 ? 5 : _d, _e = _a.loop, loop = _e === void 0 ? false : _e, _f = _a.showLastFrame, showLastFrame = _f === void 0 ? true : _f;
|
|
18
|
-
var _this = this;
|
|
19
|
-
this.rootId = rootId;
|
|
20
|
-
this.rootClassName = rootClassName;
|
|
21
|
-
this.totalTime = totalTime;
|
|
22
|
-
this.width = width;
|
|
23
|
-
this.height = height;
|
|
24
|
-
this.srcArr = srcArr;
|
|
25
|
-
this.onShow = onShow;
|
|
26
|
-
this.onFinish = onFinish;
|
|
27
|
-
this.preloadCount = preloadCount;
|
|
28
|
-
this.loop = loop;
|
|
29
|
-
this.showLastFrame = showLastFrame;
|
|
30
|
-
this.cRefArr = Array.from({ length: preloadCount }, function () { return document.createElement('img'); });
|
|
31
|
-
this.imgEleArr = Array.from({ length: preloadCount }, function (v, i) {
|
|
32
|
-
_this.cRefArr[i].src = _this.srcArr[i];
|
|
33
|
-
_this.cRefArr[i].style.position = 'absolute';
|
|
34
|
-
_this.cRefArr[i].style.visibility = 'hidden';
|
|
35
|
-
_this.cRefArr[i].style.width = _this.width;
|
|
36
|
-
_this.cRefArr[i].style.height = _this.height;
|
|
37
|
-
return _this.cRefArr[i];
|
|
38
|
-
});
|
|
39
|
-
this.nextFrame = this.nextFrame.bind(this);
|
|
40
|
-
this.rootEle = document.createElement('div');
|
|
41
|
-
console.log('ccc');
|
|
42
|
-
this.init();
|
|
43
|
-
}
|
|
44
|
-
frameAnimationJs.prototype.init = function () {
|
|
45
|
-
var _this = this;
|
|
46
|
-
this.rootEle.style.width = this.width;
|
|
47
|
-
this.rootEle.style.height = this.height;
|
|
48
|
-
this.rootEle.id = this.rootId;
|
|
49
|
-
this.rootEle.className = this.rootClassName;
|
|
50
|
-
this.imgEleArr.forEach(function (ele) {
|
|
51
|
-
_this.rootEle.appendChild(ele);
|
|
52
|
-
});
|
|
53
|
-
var startTime = Date.now();
|
|
54
|
-
var oneFrameTime = this.totalTime / this.srcArr.length;
|
|
55
|
-
//设置第一帧
|
|
56
|
-
this.cRefArr[0].style.visibility = 'visible';
|
|
57
|
-
this.nextFrame(startTime, oneFrameTime, 0);
|
|
58
|
-
};
|
|
59
|
-
//循环修改imgEleArr的src和visibility实现帧动画,,记录上一帧的序号防止跳帧
|
|
60
|
-
frameAnimationJs.prototype.nextFrame = function (startTime, oneFrameTime, showedFrame) {
|
|
61
|
-
var _this = this;
|
|
62
|
-
var nowTime = Date.now();
|
|
63
|
-
//该显示第几帧
|
|
64
|
-
var nowFrame = Math.floor((nowTime - startTime) / oneFrameTime);
|
|
65
|
-
//使用第几个img元素
|
|
66
|
-
var nowArrIndex = nowFrame % this.preloadCount;
|
|
67
|
-
var showedArrIndex = showedFrame % this.preloadCount;
|
|
68
|
-
// console.log('nextFrame', nowFrame, 'nowArrIndex', nowArrIndex, 'nowFrame', nowFrame);
|
|
69
|
-
if (!this.cRefArr[0]) {
|
|
70
|
-
//组件已经被卸载
|
|
71
|
-
this.onFinish && this.onFinish();
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (nowFrame >= this.srcArr.length) {
|
|
75
|
-
this.onFinish && this.onFinish();
|
|
76
|
-
if (!this.loop) {
|
|
77
|
-
this.cRefArr.forEach(function (ref, i) {
|
|
78
|
-
ref.style.visibility = 'hidden';
|
|
79
|
-
});
|
|
80
|
-
if (this.showLastFrame) {
|
|
81
|
-
//跳帧的话,最后一帧可能不是最后一张图片,设为最后一张图片
|
|
82
|
-
this.cRefArr[0].src = this.srcArr[this.srcArr.length - 1];
|
|
83
|
-
this.cRefArr[0].style.visibility = 'visible';
|
|
84
|
-
}
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
//重置img标签的 src 和 visibility
|
|
88
|
-
this.cRefArr.forEach(function (ref, i) {
|
|
89
|
-
ref.style.visibility = 'hidden';
|
|
90
|
-
ref.src = _this.srcArr[i];
|
|
91
|
-
});
|
|
92
|
-
startTime = Date.now();
|
|
93
|
-
this.cRefArr[0].style.visibility = 'visible';
|
|
94
|
-
requestAnimationFrame(function () {
|
|
95
|
-
_this.nextFrame(startTime, oneFrameTime, 0);
|
|
96
|
-
});
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (nowFrame !== showedFrame) {
|
|
100
|
-
this.cRefArr[nowArrIndex].style.visibility = 'visible';
|
|
101
|
-
//隐藏上一帧
|
|
102
|
-
this.cRefArr[showedArrIndex].style.visibility = 'hidden';
|
|
103
|
-
//可能跳帧,在所有其他的元素上预加载
|
|
104
|
-
this.cRefArr.forEach(function (ref, i) {
|
|
105
|
-
if (i !== nowArrIndex) {
|
|
106
|
-
var offset = (i + _this.cRefArr.length - nowArrIndex) % _this.cRefArr.length;
|
|
107
|
-
var offsetFrame = (nowFrame + offset) % _this.srcArr.length;
|
|
108
|
-
if (ref.src !== _this.srcArr[offsetFrame]) {
|
|
109
|
-
ref.src = _this.srcArr[offsetFrame];
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
showedFrame = nowFrame;
|
|
114
|
-
this.onShow && this.onShow(nowFrame);
|
|
115
|
-
}
|
|
116
|
-
requestAnimationFrame(function () {
|
|
117
|
-
_this.nextFrame(startTime, oneFrameTime, showedFrame);
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
frameAnimationJs.prototype.getRootEle = function () {
|
|
121
|
-
return this.rootEle;
|
|
122
|
-
};
|
|
123
|
-
return frameAnimationJs;
|
|
124
|
-
}());
|
|
125
|
-
export { frameAnimationJs };
|