Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
polymer-animation: can have multiple targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvonne Yip committed Oct 29, 2013
1 parent 8a28c28 commit 5d8c687
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions polymer-animation/polymer-animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
*/
Polymer('polymer-animation', {
/**
* The node being animated.
* One or more nodes to animate.
* @property target
* @type HTMLElement|Node
* @type HTMLElement|Node|Array<HTMLElement|Node>
*/
target: null,
/**
Expand Down Expand Up @@ -199,9 +199,26 @@
}
return this.animation;
},
makeSingleAnimation: function(target) {
return new Animation(target, this.animationEffect, this.timingProps);
},
makeAnimation: function() {
// this.target && console.log('makeAnimation target', this.target, 'animation', this.animationEffect, 'timing', this.timingProps);
return this.target ? new Animation(this.target, this.animationEffect, this.timingProps) : null;
if (!this.target) {
return null;
}
var animation;
if (Array.isArray(this.target)) {
var array = [];
this.target.forEach(function(t) {
array.push(this.makeSingleAnimation(t));
});
animation = new ParGroup(array);
} else {
animation = this.makeSingleAnimation(this.target);
}
return animation;
// return this.target ? new Animation(this.target, this.animationEffect, this.timingProps) : null;
},
animationChanged: function() {
// TODO: attributes are not case sensitive.
Expand Down

0 comments on commit 5d8c687

Please sign in to comment.