FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixed animation value sync issues · NativeScript/NativeScript@5129516 · GitHub

Commit 5129516

Browse files
Tsvetan Raikov
committed
Fixed animation value sync issues
1 parent 743a2ef commit 5129516

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎tns-core-modules/ui/animation/animation.ios.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ export class Animation extends common.Animation implements definition.Animation
226226
let tempRotate = animation.target.rotate * Math.PI / 180;
227227
let abs;
228228

229+
if (valueSource === undefined) {
230+
valueSource = dependencyObservable.ValueSource.Local;
231+
}
232+
229233
switch (animation.property) {
230234
case common.Properties.backgroundColor:
231235
animation._originalValue = animation.target.backgroundColor;
@@ -243,6 +247,7 @@ export class Animation extends common.Animation implements definition.Animation
243247
nativeView.setValueForKey(UIColor.clearColor(), "backgroundColor");
244248
}
245249
value = value.CGColor;
250+
animation.target.style._setValue(style.backgroundColorProperty, animation.target.backgroundColor, valueSource);
246251
break;
247252
case common.Properties.opacity:
248253
animation._originalValue = animation.target.opacity;
@@ -255,6 +260,7 @@ export class Animation extends common.Animation implements definition.Animation
255260
else {
256261
originalValue = nativeView.layer.opacity;
257262
}
263+
animation.target.style._setValue(style.opacityProperty, animation.target.opacity, valueSource);
258264
break;
259265
case common.Properties.rotate:
260266
animation._originalValue = animation.target.rotate;
@@ -276,6 +282,7 @@ export class Animation extends common.Animation implements definition.Animation
276282
if (abs < 0.001 && originalValue !== tempRotate) {
277283
originalValue = tempRotate;
278284
}
285+
animation.target.style._setValue(style.rotateProperty, animation.target.rotate, valueSource);
279286
break;
280287
case common.Properties.translate:
281288
animation._originalValue = { x: animation.target.translateX, y: animation.target.translateY };
@@ -291,6 +298,8 @@ export class Animation extends common.Animation implements definition.Animation
291298
originalValue = NSValue.valueWithCATransform3D(nativeView.layer.transform);
292299
}
293300
value = NSValue.valueWithCATransform3D(CATransform3DTranslate(nativeView.layer.transform, value.x, value.y, 0));
301+
animation.target.style._setValue(style.translateXProperty, animation.target.translateX, valueSource);
302+
animation.target.style._setValue(style.translateXProperty, animation.target.translateY, valueSource);
294303
break;
295304
case common.Properties.scale:
296305
animation._originalValue = { x: animation.target.scaleX, y: animation.target.scaleY };
@@ -306,6 +315,8 @@ export class Animation extends common.Animation implements definition.Animation
306315
originalValue = NSValue.valueWithCATransform3D(nativeView.layer.transform);
307316
}
308317
value = NSValue.valueWithCATransform3D(CATransform3DScale(nativeView.layer.transform, value.x, value.y, 1));
318+
animation.target.style._setValue(style.scaleXProperty, animation.target.scaleX, valueSource);
319+
animation.target.style._setValue(style.scaleYProperty, animation.target.scaleY, valueSource);
309320
break;
310321
case _transform:
311322
if (presentationLayer != null && valueSource !== dependencyObservable.ValueSource.Css) {
@@ -324,6 +335,10 @@ export class Animation extends common.Animation implements definition.Animation
324335
};
325336
propertyNameToAnimate = "transform";
326337
value = NSValue.valueWithCATransform3D(Animation._createNativeAffineTransform(animation));
338+
animation.target.style._setValue(style.scaleXProperty, animation.target.scaleX, valueSource);
339+
animation.target.style._setValue(style.scaleYProperty, animation.target.scaleY, valueSource);
340+
animation.target.style._setValue(style.translateXProperty, animation.target.translateX, valueSource);
341+
animation.target.style._setValue(style.translateYProperty, animation.target.translateY, valueSource);
327342
break;
328343
default:
329344
throw new Error("Cannot animate " + animation.property);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL