Skip to content

Commit 025ad55

Browse files
Animations: Make perf tests for web animations animate properly.
Web Animations uses ms for duration, while legacy keyframe animations uses sec for duration. Currently, the given perf tests use sec, so animations are weird. BUG=309981 Review URL: https://codereview.chromium.org/433423003 git-svn-id: svn://svn.chromium.org/blink/trunk@180150 bbb929c8-8fbe-4397-9dbb-9b2b20218538
1 parent 7ffda75 commit 025ad55

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

PerformanceTests/Animation/api-balls-keyframe-animations.html

+2-5
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@
7777
for (var i = 0; i < maxParticles; i++) {
7878
generateParticleKeyframes(i);
7979
var particle = new Particle(i);
80+
particle.start();
8081
particles.push(particle);
8182
}
82-
for (var i = 0; i < maxParticles; i++)
83-
particles[i].start();
8483

8584
startTrackingFrameRate();
8685
}
@@ -133,8 +132,6 @@
133132
}
134133
allParticleKeyframes[index].push(generateKeyframe(t, x, y));
135134
}
136-
137-
return keyframes;
138135
}
139136

140137
function generateKeyframe(t, x, y) {
@@ -151,7 +148,7 @@
151148
domNode.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
152149

153150
function start() {
154-
var player = domNode.animate(allParticleKeyframes[index], {easing: "linear", iterations: Infinity, direction: "alternate", duration: animationDuration});
151+
var player = domNode.animate(allParticleKeyframes[index], {easing: "linear", iterations: Infinity, direction: "alternate", duration: animationDuration * 1000});
155152
}
156153

157154
function destroy()

PerformanceTests/Animation/api-set-current-time-balls-keyframe-animations.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@
132132
}
133133
allParticleKeyframes[index].push(generateKeyframe(t, x, y));
134134
}
135-
136-
return keyframes;
137135
}
138136

139137
function generateKeyframe(t, x, y) {
@@ -150,7 +148,7 @@
150148
domNode.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
151149

152150
function start() {
153-
var player = domNode.animate(allParticleKeyframes[index], {easing: "linear", iterations: Infinity, direction: "alternate", duration: animationDuration});
151+
var player = domNode.animate(allParticleKeyframes[index], {easing: "linear", iterations: Infinity, direction: "alternate", duration: animationDuration * 1000});
154152
player.pause();
155153
this.player = player;
156154
}
@@ -171,7 +169,7 @@
171169
if (start == null)
172170
start = timestamp;
173171
for (var x in particles) {
174-
particles[x].player.currentTime = (timestamp - start) / 1000;
172+
particles[x].player.currentTime = timestamp - start;
175173
}
176174
if (particles.length !== 0)
177175
requestAnimationFrame(advance);

0 commit comments

Comments
 (0)