polymate
v0.1.7
Published
Lottie Animation View for Polymer 2
Downloads
40
Maintainers
Readme
Why Lottie?
Flexible After Effects features
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.
Manipulate your animation any way you like
You can go forward, backward, and most importantly you can program your animation to respond to any interaction.
Small file sizes
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.
Download lottie files › lottiefiles.com
View documentation, FAQ, help, examples, and more at airbnb.io/lottie
Demo
<style>
#polymateElement {
--polymate-view-width: 400px;
}
</style>
<polymate-view id="polymateElement" path="demo/motorcycle.json" autoplay loop show-controllers></polymate-view>
Installation
Install through npm:
npm install --save polymate
Install through bower:
bower install --save polymate
Usage
- Import the polymate view component
<link rel="import" href="../polymate/polymate-view.html">
- Initialize
Download animation json from LottieFiles.com or use some json from demo folder
- Using path, autoplay and loop
<polymate-view id="polymateElement" path="data.json" autoplay loop></polymate-view>
- Using options object
<polymate-view id="polymateElement"></polymate-view>
<script>
class PolymateElement extends Polymer.Element {
static get is() { return 'polymate-element'; }
ready() {
super.ready();
this.$.polymateElement.options = {
path: 'data.json',
loop: true,
autoplay: true
};
}
}
window.customElements.define(PolymateElement.is, PolymateElement);
</script>
- Style
- custom vars
<style>
#polymateElement {
--polymate-view-width: 100px;
--polymate-view-height: 100px;
}
</style>
- font-size
<style>
#polymateElement {
font-size: 24px;
}
</style>
Configuration
You can pass a configuration object through options
property:
- animationData: an Object with the exported animation data.
- path: the relative path to the animation object. (animationData and path are mutually exclusive)
- loop: true / false / number
- autoplay: true / false it will start playing as soon as it is ready
- renderer: 'svg' / 'canvas' / 'html' to set the renderer
More information on lottie-web Documentation
Related Projects
- Bodymovin ng-lottie is a wrapper of bodymovin
- Angular Lottie angular implementation
- Ionic Lottie Thanks for @yannbf demonstrating ng-lottie on ionic3
- React Lottie react implementation
- Vue Lottie vue implementation
- React Native Lottie react native implementation by airbnb
- IOS Lottie ios implementation by airbnb
- Android Lottie android implementation by airbnb
Contribution
Appreciate your contributions and suggestions.
License
MIT