Animation examples
This article contains examples demonstrating how to animate the animatable view properties. A full list of all animatable properties and a detailed explanation of the animations API is presented here.
The full source code for all samples is located here.
Animated opacity

Try this in the NativeScript Playground
Animate background color

Try this in the NativeScript Playground
Animate position

Try this in the NativeScript Playground
Animate scale

Try this in the NativeScript Playground
Animate rotate

Try this in the NativeScript Playground
Chaining animations with AnimationSet

Animating multiple views

Try this in the NativeScript Playground
Reusing animations

Slide-in effect

Infinite animations

Rotation using originX and originY
Example 5: Rotating a view around its center. Center of view is changed via originX and originY properties.

Animation - View's Width and Height
Width
@ViewChild("lblNS", { read: ElementRef, static: false }) labelRef: ElementRef;
private label: Label;
...
ngAfterViewInit(): void {
this.label = this.labelRef.nativeElement;
}
...
let animation = new Animation([
{
width: 200,
duration: 2000,
target: this.label,
delay: 200
}
]);
animation.play();
Height
@ViewChild("lblNS", { read: ElementRef, static: false }) labelRef: ElementRef;
private label: Label;
...
ngAfterViewInit(): void {
this.label = this.labelRef.nativeElement;
}
...
let animation = new Animation([
{
height: 200,
duration: 2000,
target: this.label,
delay: 200
}
]);
animation.play();