| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,7 +106,7 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition { | |||
| 106 | 106 | } | |
| 107 | 107 | } | |
| 108 | 108 | ||
| 109 | - animations.map(a => a["curve"] ? a : Object.assign(a, {curve: info.curve})); | ||
| 109 | + animations.map(a => a["curve"] ? a : Object.assign(a, { curve: info.curve })); | ||
| 110 | 110 | ||
| 111 | 111 | const animation: KeyframeAnimation = new KeyframeAnimation(); | |
| 112 | 112 | animation.delay = info.delay; | |
@@ -230,9 +230,19 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition { | |||
| 230 | 230 | } | |
| 231 | 231 | } | |
| 232 | 232 | else { | |
| 233 | - let animationDef = this.animations[index]; | ||
| 234 | - (<any>animationDef).target = view; | ||
| 235 | - let animation = new Animation([animationDef]); | ||
| 233 | + let animation; | ||
| 234 | + const cachedAnimation = this._nativeAnimations[index - 1]; | ||
| 235 | + | ||
| 236 | + if (cachedAnimation) { | ||
| 237 | + animation = cachedAnimation; | ||
| 238 | + } | ||
| 239 | + else { | ||
| 240 | + let animationDef = this.animations[index]; | ||
| 241 | + (<any>animationDef).target = view; | ||
| 242 | + animation = new Animation([animationDef]); | ||
| 243 | + this._nativeAnimations.push(animation); | ||
| 244 | + } | ||
| 245 | + | ||
| 236 | 246 | // Catch the animation cancel to prevent unhandled promise rejection warnings | |
| 237 | 247 | animation.play().then(() => { | |
| 238 | 248 | this.animate(view, index + 1, iterations); | |
@@ -241,7 +251,6 @@ export class KeyframeAnimation implements KeyframeAnimationDefinition { | |||
| 241 | 251 | }).catch((error: any) => { | |
| 242 | 252 | traceWrite(typeof error === "string" ? error : error.message, traceCategories.Animation, traceType.warn); | |
| 243 | 253 | }); // tslint:disable-line | |
| 244 | - this._nativeAnimations.push(animation); | ||
| 245 | 254 | } | |
| 246 | 255 | } | |
| 247 | 256 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments