Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: tools/perf/page_sets/tough_animation_cases/web_animations_many_keyframes.html

Issue 365613002: Add Web Animations perf tests to tough_animation_cases page set (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style inconsistencies Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta name="viewport" content="width=device-width, user-scalable=no">
3 <link rel="stylesheet" type="text/css" href="resources/tablet.css">
4 <script src="resources/perftesthelper.js"></script>
5 <style>
6 target {
7 position: absolute;
8 width: 0px;
9 height: 0px;
10 border: 5px solid green;
11 border-radius: 100%;
12 }
13 </style>
14
15 <container id="container"></container>
16
17 <script>
18 var N = PerfTestHelper.getN(1000);
19 var numKeyframes = 500;
20 var duration = 4000;
21
22 function makeKeyframes(numKeyframes, width, height) {
23 var keyframes = [];
24 for (var i = 0; i < numKeyframes + 1; i++) {
25 var fraction = i / numKeyframes;
26 var t = fraction * 2 * Math.PI;
27 var x = Math.cos(t) - Math.pow(Math.cos(4 * t), 3);
28 x = ((x / 4 + 1 / 2) * width).toFixed(5);
29 var y = Math.pow(Math.sin(4 * t), 3) - Math.sin(2 * t);
30 y = ((y / 4 + 1 / 2) * height).toFixed(5);
31 keyframes.push({transform: 'translate(' + x + 'px, ' + y + 'px)'});
32 }
33 return keyframes;
34 }
35
36 requestAnimationFrame(function() {
37 var keyframes = makeKeyframes(numKeyframes, 550, 800);
38 for (var i = 0; i < N; i++) {
39 var target = document.createElement('target');
40 container.appendChild(target);
41 target.animate(keyframes, {duration: duration, iterations: Infinity, delay: -duration / 10 * i / N});
42 }
43 });
44
45 PerfTestHelper.signalReady();
46 </script>
47
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698