From 46921d53f6e592379d755670e564de500e6d5528 Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Wed, 14 Oct 2015 16:39:23 +0300 Subject: [PATCH 1/2] Move from begin/commit animation blocks to keyframe animations, they handle continuation from the current state. There is a new "Sequence" animation in the "animations" app that displays a sequence of animations that used to be buggy in iOS (the animated object was jumping around) but should now display a nice continuos animation. The problem that has been fixed appeared only when multiple properties that affect transform are animated: rotate + translate or scale + translate. --- apps/animations/main-page.ts | 71 +++++++++++++++++++++++ apps/animations/main-page.xml | 35 +++++++----- tsconfig.json | 3 + ui/animation/animation.ios.ts | 102 ++++++++++++++++++---------------- 4 files changed, 148 insertions(+), 63 deletions(-) diff --git a/apps/animations/main-page.ts b/apps/animations/main-page.ts index c1773befd..7fc833370 100644 --- a/apps/animations/main-page.ts +++ b/apps/animations/main-page.ts @@ -90,4 +90,75 @@ export function onSingle(args: observable.EventData) { }) .then(() => console.log("Animation finished")) .catch((e) => console.log(e.message)); +} + +export function onSequence(args: observable.EventData) { + console.log("onSequence"); + + button3.animate({ + translate: { x: 80, y: 40 }, + scale: { x: 0.9, y: 0.3 }, + rotate: 25, + duration: 1000 + }) + .then(() => button3.animate({ + translate: { x: 0, y: 80 }, + scale: { x: 0.5, y: 0.5 }, + rotate: -25, + duration: 1000 + })) + .then(() => button3.animate({ + translate: { x: -80, y: 40 }, + scale: { x: 0.5, y: 0.9 }, + rotate: 45, + duration: 1000 + })) + .then(() => button3.animate({ + translate: { x: 0, y: 0 }, + scale: { x: 1, y: 1 }, + rotate: 0, + duration: 1000 + })) + .then(() => console.log("Animation finished")) + .catch((e) => console.log(e.message)); +} + +export function onInterrupted(args: observable.EventData) { + console.log("onInterrupt"); + + setTimeout(() => { + button3.animate({ + translate: { x: 80, y: 40 }, + scale: { x: 0.9, y: 0.3 }, + rotate: 25, + duration: 1000 + }); + }, 700 * 0); + + setTimeout(function() { + button3.animate({ + translate: { x: 0, y: 80 }, + scale: { x: 0.5, y: 0.5 }, + rotate: -25, + duration: 1000 + }) + }, 700 * 1); + + setTimeout(function() { + button3.animate({ + translate: { x: -80, y: 40 }, + scale: { x: 0.5, y: 0.9 }, + rotate: 45, + duration: 1000 + }) + }, 700 * 2); + + setTimeout(function() { + button3.animate({ + translate: { x: 0, y: 0 }, + scale: { x: 1, y: 1 }, + rotate: 0, + duration: 1000 + }) + }, 700 * 3); } \ No newline at end of file diff --git a/apps/animations/main-page.xml b/apps/animations/main-page.xml index 8a132ce87..33e9da7e2 100644 --- a/apps/animations/main-page.xml +++ b/apps/animations/main-page.xml @@ -2,29 +2,34 @@ -