mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Merge pull request #1960 from NativeScript/raikov/align-animation-behavior
Aligned the rotate animation behaviour between Android and iOS
This commit is contained in:
@ -9,6 +9,10 @@ import styleModule = require("ui/styling/style");
|
|||||||
|
|
||||||
global.moduleMerge(common, exports);
|
global.moduleMerge(common, exports);
|
||||||
|
|
||||||
|
interface AnimationDefinitionInternal extends definition.AnimationDefinition {
|
||||||
|
valueSource?: number;
|
||||||
|
}
|
||||||
|
|
||||||
let argbEvaluator: android.animation.ArgbEvaluator;
|
let argbEvaluator: android.animation.ArgbEvaluator;
|
||||||
function ensureArgbEvaluator() {
|
function ensureArgbEvaluator() {
|
||||||
if (!argbEvaluator) {
|
if (!argbEvaluator) {
|
||||||
@ -79,11 +83,11 @@ export class Animation extends common.Animation implements definition.Animation
|
|||||||
this._animatorSet.cancel();
|
this._animatorSet.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(animationDefinitions: Array<definition.AnimationDefinition>, playSequentially?: boolean) {
|
constructor(animationDefinitions: Array<AnimationDefinitionInternal>, playSequentially?: boolean) {
|
||||||
super(animationDefinitions, playSequentially);
|
super(animationDefinitions, playSequentially);
|
||||||
|
|
||||||
if (animationDefinitions.length > 0 && (<any>animationDefinitions[0]).valueSource !== undefined) {
|
if (animationDefinitions.length > 0 && animationDefinitions[0].valueSource !== undefined) {
|
||||||
this._valueSource = (<any>animationDefinitions[0]).valueSource;
|
this._valueSource = animationDefinitions[0].valueSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
let that = this;
|
let that = this;
|
||||||
|
@ -30,7 +30,7 @@ interface PropertyAnimationInfo extends common.PropertyAnimation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface AnimationDefinitionInternal extends definition.AnimationDefinition {
|
interface AnimationDefinitionInternal extends definition.AnimationDefinition {
|
||||||
valueSource: number;
|
valueSource?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IOSView extends viewModule.View {
|
interface IOSView extends viewModule.View {
|
||||||
@ -258,6 +258,9 @@ export class Animation extends common.Animation implements definition.Animation
|
|||||||
else {
|
else {
|
||||||
originalValue = nativeView.layer.valueForKeyPath("transform.rotation");
|
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;
|
value = value * Math.PI / 180;
|
||||||
abs = fabs(originalValue - value);
|
abs = fabs(originalValue - value);
|
||||||
if (abs < 0.001 && originalValue !== tempRotate) {
|
if (abs < 0.001 && originalValue !== tempRotate) {
|
||||||
|
Reference in New Issue
Block a user