Skip to content

Instantly share code, notes, and snippets.

@OrenBochman
Created August 22, 2016 07:06
Show Gist options
  • Save OrenBochman/c6c51ac2e75a7711e8a5c57e00001d00 to your computer and use it in GitHub Desktop.
Save OrenBochman/c6c51ac2e75a7711e8a5c57e00001d00 to your computer and use it in GitHub Desktop.
Polymer: basic animated element
//implement NeonAnimatableBehavior behavior
// or Polymer.NeonAnimationRunnerBehavior if also reponsible for running the animation (ctrl)
Polymer({
is: 'my-animatable',
behaviors: [
Polymer.NeonAnimationRunnerBehavior //I am reponsible for running the animation
],
properties: {
animationConfig: {
value: function() {
return {
// provided by neon-animation/animations/scale-down-animation.html
name: 'scale-down-animation',
node: this //which node to use for the baisc animation
}
}
}
},
listeners: {
// this event is fired when the animation finishes
'neon-animation-finish': '_onNeonAnimationFinish'
},
animate: function() {
// run scale-down-animation
this.playAnimation();
},
_onNeonAnimationFinish: function() {
console.log('animation done!');
}
});
@OrenBochman
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment