@flk/animator
Advanced tools
Comparing version 1.3.2 to 1.3.3
const Attribute = require(ATTRIBUTE_CLASS_PATH); | ||
/** | ||
* Usage example | ||
* | ||
* Example of usage | ||
* <h1 [animate]="fadeInUp">Hello, World</h1> | ||
* <h1 [animate]="fadeInUp" [speed]="speedy">Hello, World</h1> | ||
*/ | ||
class List extends Attribute { | ||
class AnimateAttribute extends Attribute { | ||
/** | ||
@@ -13,4 +14,4 @@ * {@inheritdoc} | ||
return { | ||
'animate': this.setAnimation, | ||
'[animate]': this.setAnimation, | ||
'animate': this.animate, | ||
'[animate]': this.animate, | ||
}; | ||
@@ -22,12 +23,14 @@ } | ||
*/ | ||
setAnimation() { | ||
this.animationName = this.forcePullProp('animate'); | ||
this.speedMode = this.forcePullProp('speed') || "'normal'"; | ||
animate() { | ||
if (this.tag.type() != 'tag') return; | ||
this.animationName = this.pull('animate'); | ||
this.speedMode = this.pull('speed', 'normal'); | ||
this.animationMethod = 'animate'; | ||
if (this.animationName == 'random') { | ||
this.animationMethod = `animator.randomShow(${this.tag.variableName}, \$\{\`${this.speedMode}\`\})`; | ||
this.animationMethod = `animator.randomShow(${this.tag.variableName}, ${this.speedMode})`; | ||
} else { | ||
this.animationMethod = `animator.animate(${this.tag.variableName}, \`\${${this.animationName}\}\`, \`\$\{${this.speedMode}\}\`)`; | ||
this.animationMethod = `animator.animate(${this.tag.variableName}, ${this.animationName}, ${this.speedMode})`; | ||
} | ||
@@ -42,2 +45,3 @@ | ||
module.exports = List; | ||
module.exports = AnimateAttribute; |
{ | ||
"name": "@flk/animator", | ||
"description": "Animate.css animation on elements", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"main": "dist/Animator.js", | ||
@@ -6,0 +6,0 @@ "externals": { |
5825
93