|
@@ -83,8 +83,20 @@ class ViewerInner extends Component {
|
|
|
this.lastProgress = false;
|
|
|
this.isBelow = true;
|
|
|
this.isAbove = false;
|
|
|
+ this.init = this.init.bind(this);
|
|
|
+ this.init(props);
|
|
|
+ }
|
|
|
|
|
|
- props.debug && console.log("init ", props.name);
|
|
|
+ init(props) {
|
|
|
+ this.props = props;
|
|
|
+ props.debug && console.log("init", props.name);
|
|
|
+ this.fullFrameCount = props.frameCount;
|
|
|
+ this.frame = props.startFrame || 0;
|
|
|
+ if (this.props.pause) {
|
|
|
+ Object.keys(this.props.pause).forEach((index) => {
|
|
|
+ this.fullFrameCount += this.props.pause[index];
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
static propTypes = Viewer.propTypes;
|
|
|
componentWillUnmount() {
|
|
@@ -100,13 +112,6 @@ class ViewerInner extends Component {
|
|
|
}
|
|
|
|
|
|
componentDidMount() {
|
|
|
- this.fullFrameCount = this.props.frameCount;
|
|
|
- this.frame = this.props.startFrame || 0;
|
|
|
- if (this.props.pause) {
|
|
|
- Object.keys(this.props.pause).forEach((index) => {
|
|
|
- this.fullFrameCount += this.props.pause[index];
|
|
|
- });
|
|
|
- }
|
|
|
this.loadAssets();
|
|
|
this.canvasRef.current && this.initializeCanvas();
|
|
|
|
|
@@ -137,6 +142,7 @@ class ViewerInner extends Component {
|
|
|
}
|
|
|
}
|
|
|
this.sequence.push(img);
|
|
|
+
|
|
|
img.onerror = () => {
|
|
|
var timeStamp = Math.floor(Date.now() * Math.random())
|
|
|
.toString()
|
|
@@ -312,6 +318,20 @@ class ViewerInner extends Component {
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
+ if (this.props.enterTween.fromTo) {
|
|
|
+ var form = this.props.enterTween.fromTo[0],
|
|
|
+ to = this.props.enterTween.fromTo[1];
|
|
|
+ this.enterTimeline.fromTo(
|
|
|
+ this.viewerRef.current,
|
|
|
+ form,
|
|
|
+ Object.assign(
|
|
|
+ {
|
|
|
+ ease: "none",
|
|
|
+ },
|
|
|
+ to
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
initializeExitTween() {
|
|
|
this.props.debug &&
|
|
@@ -355,6 +375,20 @@ class ViewerInner extends Component {
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
+ if (this.props.exitTween.fromTo) {
|
|
|
+ var form = this.props.enterTween.fromTo[0],
|
|
|
+ to = this.props.enterTween.fromTo[1];
|
|
|
+ this.exitTimeline.fromTo(
|
|
|
+ this.viewerRef.current,
|
|
|
+ form,
|
|
|
+ Object.assign(
|
|
|
+ {
|
|
|
+ ease: "none",
|
|
|
+ },
|
|
|
+ to
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
poolNewFrames(index) {
|