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

Commit ba27c8d

Browse files
author
Yvonne Yip
committed
polymer-animation: use observe block
1 parent e50f049 commit ba27c8d

1 file changed

Lines changed: 15 additions & 34 deletions

File tree

polymer-animation/polymer-animation.html

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,20 @@
149149
*/
150150
autoplay: false,
151151
animation: false,
152-
created: function() {
152+
observe: {
153+
target: 'asyncApply',
154+
keyframes: 'asyncApply',
155+
sample: 'asyncApply',
156+
composite: 'asyncApply',
157+
duration: 'asyncApply',
158+
fillMode: 'asyncApply',
159+
easing: 'asyncApply',
160+
iterationCount: 'asyncApply',
161+
delay: 'asyncApply',
162+
direction: 'asyncApply',
163+
autoplay: 'asyncApply'
164+
},
165+
ready: function() {
153166
this.asyncApply();
154167
},
155168
/**
@@ -176,6 +189,7 @@
176189
this.cancelApply();
177190
this.animation = null;
178191
this.animation = this.makeAnimation();
192+
console.log('apply', this.animation);
179193
if (this.autoplay && this.animation) {
180194
this.play();
181195
}
@@ -202,44 +216,11 @@
202216
// in ShadowDOM the sender becomes the shadow host.
203217
this.fire('animationchange', this);
204218
},
205-
targetChanged: function() {
206-
this.asyncApply();
207-
},
208219
targetSelectorChanged: function() {
209220
if (this.targetSelector) {
210221
this.target = findTarget(this.targetSelector, this);
211222
}
212223
},
213-
keyframesChanged: function() {
214-
this.asyncApply();
215-
},
216-
sampleChanged: function() {
217-
this.asyncApply();
218-
},
219-
compositeChanged: function() {
220-
this.asyncApply();
221-
},
222-
durationChanged: function() {
223-
this.asyncApply();
224-
},
225-
fillModeChanged: function() {
226-
this.asyncApply();
227-
},
228-
easingChanged: function() {
229-
this.asyncApply();
230-
},
231-
iterationCountChanged: function() {
232-
this.asyncApply();
233-
},
234-
delayChanged: function() {
235-
this.asyncApply();
236-
},
237-
directionChanged: function() {
238-
this.asyncApply();
239-
},
240-
autoplayChanged: function() {
241-
this.asyncApply();
242-
},
243224
get timingProps() {
244225
var props = {};
245226
var timing = {

0 commit comments

Comments
 (0)