https://chenqingspring.github.io/ng-lottie/demo/
Renamed fromlottie-angular2after angular4 supported
bodymovinisAdobe After Effectsplugin for exporting animations as JSON, also it provide bodymovin.js for vender them as svg/canvas/html.
We currently support solids, shape layers, masks, alpha mattes, trim paths, and dash patterns. And we’ll be adding new features on a regular basis.
You can go forward, backward, and most importantly you can program your animation to respond to any interaction.
Bundle vector animations within your app without having to worry about multiple dimensions or large file sizes. Alternatively, you can decouple animation files from your app’s code entirely by loading them from a JSON API.
Learn more›http://airbnb.design/lottie/
Looking for lottie files ›https://www.lottiefiles.com/
Install through npm:
npm install --save ng-lottie
Then include in your apps module:
import{Component,NgModule}from'@angular/core';
import{LottieAnimationViewModule}from'ng-lottie';
@NgModule({
imports:[
LottieAnimationViewModule.forRoot()
]
})
exportclassMyModule{}
Finally use in one of your apps components:
import{Component}from'@angular/core';
@Component({
selector:'lottie-animation-view-demo-app',
template:` <lottie-animation-view
[options]= "lottieConfig"
[width]= "300"
[height]= "600"
(animCreated)= "handleAnimation($event)" >
</lottie-animation-view>
<div id= "player" >
<p>Speed: x{{animationSpeed}}</p>
<div class= "range-container" >
<input #range type= "range" value= "1" min= "0" max= "3" step= "0.5"
(change)= "setSpeed(range.value)" >
</div>
<button (click)= "stop()" >stop</button>
<button (click)= "pause()" >pause</button>
<button (click)= "play()" >play</button>
</div>`
})
exportclassDemoComponent{
publiclottieConfig:Object;
privateanim:any;
privateanimationSpeed:number=1;
constructor(){
this.lottieConfig={
path:'assets/pinjump.json',
renderer:'canvas',
autoplay:true,
loop:true
};
}
handleAnimation(anim:any){
this.anim=anim;
}
stop(){
this.anim.stop();
}
play(){
this.anim.play();
}
pause(){
this.anim.pause();
}
setSpeed(speed:number){
this.animationSpeed=speed;
this.anim.setSpeed(speed);
}
}
- Bodymovinng-lottie is a wrapper of bodymovin
- Ionic LottieThanks for @yannbf demonstrating ng-lottie on ionic3
- React Lottiereact implementation
- Vue Lottievue implementation
- React Native Lottiereact native implementation by airbnb
- IOS Lottieios implementation by airbnb
- Android Lottieandroid implementation by airbnb
Your contributions and suggestions are heartily welcome.
MIT