4 var ANIMATION_GROUPS
= {
6 'seq': AnimationSequence
9 Polymer('core-animation-group',{
13 * If target is set, any children without a target will be assigned the group's
14 * target when this property is set.
17 * @type HTMLElement|Node|Array|Array<HTMLElement|Node>
21 * For a `core-animation-group`, a duration of "auto" means the duration should
22 * be the specified duration of its children. If set to anything other than
23 * "auto", any children without a set duration will be assigned the group's duration.
29 duration
: {value
: 'auto', reflect
: true},
32 * The type of the animation group. 'par' creates a parallel group and 'seq' creates
39 type
: {value
: 'par', reflect
: true}
42 typeChanged: function() {
46 targetChanged: function() {
47 // Only propagate target to children animations if it's defined.
49 this.doOnChildren(function(c
) {
50 c
.target
= this.target
;
55 durationChanged: function() {
56 if (this.duration
&& this.duration
!== 'auto') {
57 this.doOnChildren(function(c
) {
58 // Propagate to children that is not a group and has no
59 // duration specified.
60 if (!c
.type
&& (!c
.duration
|| c
.duration
=== 'auto')) {
61 c
.duration
= this.duration
;
67 doOnChildren: function(inFn
) {
68 var children
= this.children
;
69 if (!children
.length
) {
70 children
= this.shadowRoot
? this.shadowRoot
.childNodes
: [];
72 Array
.prototype.forEach
.call(children
, function(c
) {
73 // TODO <template> in the way
78 makeAnimation: function() {
79 return new ANIMATION_GROUPS
[this.type
](this.childAnimations
, this.timingProps
);
82 hasTarget: function() {
83 var ht
= this.target
!== null;
85 this.doOnChildren(function(c
) {
86 ht
= ht
|| c
.hasTarget();
93 // Propagate target and duration to child animations first.
94 this.durationChanged();
96 this.doOnChildren(function(c
) {
102 get childAnimationElements() {
104 this.doOnChildren(function(c
) {
105 if (c
.makeAnimation
) {
112 get childAnimations() {
114 this.doOnChildren(function(c
) {
116 list
.push(c
.animation
);