11--- 
22nav-title : Animation 
3- title : " Animation" 
3+ title : " UI:  Animation" 
44description : Learn how to animate view properties. 
55position : 18 
66--- 
@@ -186,7 +186,7 @@ definitions.push({ target: view3, translate: { x: -200, y: 0 }, duration: 3000 }
186186definitions .push ({ target:  view4, translate:  { x:  0 , y:  - 200  }, duration:  3000  });
187187var  playSequentially =  true ;
188188var  animationSet =  new  animationModule.Animation (definitions, playSequentially);
189- animationSet .play ().finished . then (function  () {
189+ animationSet .play ().then (function  () {
190190 console .log (" Animation finished"  );
191191})
192192 .catch (function  (e ) {
@@ -201,7 +201,7 @@ definitions.push({target: view3, translate: {x: -200, y: 0}, duration: 3000 });
201201definitions .push ({target: view4 , translate: {x: 0 , y: - 200 }, duration: 3000  });
202202var  playSequentially =  true ;
203203var  animationSet =  new  animationModule .Animation (definitions , playSequentially );
204- animationSet .play ().finished . then (() =>  {
204+ animationSet .play ().then (() =>  {
205205 console .log (" Animation finished"  );
206206})
207207.catch ((e ) =>  {
@@ -238,7 +238,7 @@ var a4 = {
238238};
239239definitions .push (a4);
240240var  animationSet =  new  animationModule.Animation (definitions);
241- animationSet .play ().finished . then (function  () {
241+ animationSet .play ().then (function  () {
242242 console .log (" Animation finished"  );
243243})
244244 .catch (function  (e ) {
@@ -277,7 +277,43 @@ definitions.push(a4);
277277
278278var  animationSet =  new  animationModule .Animation (definitions );
279279
280- animationSet .play ().finished .then (() =>  {
280+ animationSet .play ().then (() =>  {
281+  console .log (" Animation finished"  );
282+ })
283+ .catch ((e ) =>  {
284+  console .log (e .message );
285+ });
286+ ``` 
287+ 
288+ ## Reusing Animations  
289+ ![ reusing] ( img/modules/animation/reusing.gif  " Reusing Animations ") 
290+ ```  JavaScript 
291+ var  animation1 =  view .createAnimation ({ opacity:  0  });
292+ var  animation2 =  view .createAnimation ({ opacity:  1  });
293+ animation1 .play ()
294+  .then (function  () { return  animation2 .play (); })
295+  .then (function  () { return  animation1 .play (); })
296+  .then (function  () { return  animation2 .play (); })
297+  .then (function  () { return  animation1 .play (); })
298+  .then (function  () { return  animation2 .play (); })
299+  .then (function  () {
300+  console .log (" Animation finished"  );
301+ })
302+  .catch (function  (e ) {
303+  console .log (e .message );
304+ });
305+ ``` 
306+ ```  TypeScript 
307+ var  animation1 =  view .createAnimation ({opacity: 0 });
308+ var  animation2 =  view .createAnimation ({opacity: 1 });
309+ 
310+ animation1 .play ()
311+ .then (()=> animation2 .play ())
312+ .then (()=> animation1 .play ())
313+ .then (()=> animation2 .play ())
314+ .then (()=> animation1 .play ())
315+ .then (()=> animation2 .play ())
316+ .then (() =>  {
281317 console .log (" Animation finished"  );
282318})
283319.catch ((e ) =>  {
@@ -324,7 +360,7 @@ animationSet = new animationModule.Animation([{
324360 iterations:  Number .POSITIVE_INFINITY ,
325361 curve:  view .ios  ?  UIViewAnimationCurve .UIViewAnimationCurveLinear  :  new  android.view.animation.LinearInterpolator 
326362 }]);
327- animationSet .play ().finished . catch (function  (e ) {
363+ animationSet .play ().catch (function  (e ) {
328364 console .log (" Animation stoppped!"  );
329365});
330366//  Call animationSet.cancel() to stop it;
@@ -337,7 +373,7 @@ animationSet = new animationModule.Animation([{
337373 iterations: Number .POSITIVE_INFINITY,
338374 curve: view .ios  ?  UIViewAnimationCurve .UIViewAnimationCurveLinear  :  new  android .view .animation .LinearInterpolator 
339375}]);
340- animationSet .play ().finished . catch ((e ) =>  {
376+ animationSet .play ().catch ((e ) =>  {
341377 console .log (" Animation stoppped!"  );
342378});
343379//  Call animationSet.cancel() to stop it;
0 commit comments