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

Side by Side Diff: Source/devtools/front_end/elements/BezierUI.js

Issue 967213002: Devtools Animations: Represent delay and end-delay on the animation timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Round values Created 5 years, 9 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
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {number} width 7 * @param {number} width
8 * @param {number} height 8 * @param {number} height
9 * @param {number} marginTop 9 * @param {number} marginTop
10 * @param {number} controlPointRadius 10 * @param {number} controlPointRadius
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 var height = WebInspector.AnimationUI.Options.AnimationHeight; 110 var height = WebInspector.AnimationUI.Options.AnimationHeight;
111 var pathBuilder = ["M", 0, height]; 111 var pathBuilder = ["M", 0, height];
112 const sampleSize = 1 / 40; 112 const sampleSize = 1 / 40;
113 113
114 var prev = bezier.evaluateAt(0); 114 var prev = bezier.evaluateAt(0);
115 for (var t = sampleSize; t < 1 + sampleSize; t += sampleSize) { 115 for (var t = sampleSize; t < 1 + sampleSize; t += sampleSize) {
116 var current = bezier.evaluateAt(t); 116 var current = bezier.evaluateAt(t);
117 var slope = (current.y - prev.y) / (current.x - prev.x); 117 var slope = (current.y - prev.y) / (current.x - prev.x);
118 var weightedX = prev.x * (1 - t) + current.x * t; 118 var weightedX = prev.x * (1 - t) + current.x * t;
119 slope = Math.tanh(slope / 1.5); // Normalise slope 119 slope = Math.tanh(slope / 1.5); // Normalise slope
120 pathBuilder = pathBuilder.concat(["L", weightedX * width, height - slope * height ]); 120 pathBuilder = pathBuilder.concat(["L", (weightedX * width).toFixed(2), ( height - slope * height).toFixed(2) ]);
121 prev = current; 121 prev = current;
122 } 122 }
123 pathBuilder = pathBuilder.concat(["L", width, height, "Z"]); 123 pathBuilder = pathBuilder.concat(["L", width.toFixed(2), height, "Z"]);
124 path.setAttribute("d", pathBuilder.join(" ")); 124 path.setAttribute("d", pathBuilder.join(" "));
125 } 125 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/AnimationTimeline.js ('k') | Source/devtools/front_end/elements/animationTimeline.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698