Aligned the rotate animation behaviour between Android and iOS

This commit is contained in:
Tsvetan Raikov
2016-04-13 15:16:06 +03:00
parent 7693e3abb7
commit 4c17efa1a8
2 changed files with 11 additions and 4 deletions

View File

@ -9,6 +9,10 @@ import styleModule = require("ui/styling/style");
global.moduleMerge(common, exports);
interface AnimationDefinitionInternal extends definition.AnimationDefinition {
valueSource?: number;
}
let argbEvaluator: android.animation.ArgbEvaluator;
function ensureArgbEvaluator() {
if (!argbEvaluator) {
@ -79,11 +83,11 @@ export class Animation extends common.Animation implements definition.Animation
this._animatorSet.cancel();
}
constructor(animationDefinitions: Array<definition.AnimationDefinition>, playSequentially?: boolean) {
constructor(animationDefinitions: Array<AnimationDefinitionInternal>, playSequentially?: boolean) {
super(animationDefinitions, playSequentially);
if (animationDefinitions.length > 0 && (<any>animationDefinitions[0]).valueSource !== undefined) {
this._valueSource = (<any>animationDefinitions[0]).valueSource;
if (animationDefinitions.length > 0 && animationDefinitions[0].valueSource !== undefined) {
this._valueSource = animationDefinitions[0].valueSource;
}
let that = this;

View File

@ -30,7 +30,7 @@ interface PropertyAnimationInfo extends common.PropertyAnimation {
}
interface AnimationDefinitionInternal extends definition.AnimationDefinition {
valueSource: number;
valueSource?: number;
}
interface IOSView extends viewModule.View {
@ -258,6 +258,9 @@ export class Animation extends common.Animation implements definition.Animation
else {
originalValue = nativeView.layer.valueForKeyPath("transform.rotation");
}
if (originalValue === 0 && animation.target.rotate !== 0 && Math.floor(value / 360) - value / 360 === 0) {
originalValue = animation.target.rotate * Math.PI / 180;
}
value = value * Math.PI / 180;
abs = fabs(originalValue - value);
if (abs < 0.001 && originalValue !== tempRotate) {