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

Unified Diff: tracing/tracing/ui/timeline_display_transform_animations.html

Issue 2771723003: [tracing] Move math utilities from base into their own subdirectory (attempt 2) (Closed)
Patch Set: rebase Created 3 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 side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/ui/timeline_display_transform_animations.html
diff --git a/tracing/tracing/ui/timeline_display_transform_animations.html b/tracing/tracing/ui/timeline_display_transform_animations.html
index a1f5ecff9b15209f6e53d9802d5aeacb3b422174..db95593868a5498de37fe35dfdeac72e8c0e8552 100644
--- a/tracing/tracing/ui/timeline_display_transform_animations.html
+++ b/tracing/tracing/ui/timeline_display_transform_animations.html
@@ -12,6 +12,7 @@ found in the LICENSE file.
tr.exportTo('tr.ui', function() {
var kDefaultPanAnimationDurationMs = 100.0;
+ const lerp = tr.b.math.lerp;
/**
* Pans a TimelineDisplayTransform by a given amount.
@@ -67,11 +68,12 @@ tr.exportTo('tr.ui', function() {
tick: function(timestamp, target) {
var percentDone = (timestamp - this.startTimeMs) / this.durationMs;
- percentDone = tr.b.clamp(percentDone, 0, 1);
+ percentDone = tr.b.math.clamp(percentDone, 0, 1);
- target.panX = tr.b.lerp(percentDone, this.startPanX, this.goalPanX);
- if (this.affectsPanY)
- target.panY = tr.b.lerp(percentDone, this.startPanY, this.goalPanY);
+ target.panX = lerp(percentDone, this.startPanX, this.goalPanX);
+ if (this.affectsPanY) {
+ target.panY = lerp(percentDone, this.startPanY, this.goalPanY);
+ }
return timestamp >= this.startTimeMs + this.durationMs;
},
@@ -150,12 +152,11 @@ tr.exportTo('tr.ui', function() {
tick: function(timestamp, target) {
var percentDone = (timestamp - this.startTimeMs) / this.durationMs;
- percentDone = tr.b.clamp(percentDone, 0, 1);
+ percentDone = tr.b.math.clamp(percentDone, 0, 1);
- target.scaleX = tr.b.lerp(percentDone, this.startScaleX, this.goalScaleX);
+ target.scaleX = lerp(percentDone, this.startScaleX, this.goalScaleX);
if (this.affectsPanY) {
- target.panY = tr.b.lerp(
- percentDone, this.startPanY, this.goalFocalPointY);
+ target.panY = lerp(percentDone, this.startPanY, this.goalFocalPointY);
}
target.xPanWorldPosToViewPos(
« no previous file with comments | « tracing/tracing/ui/side_panel/side_panel_container.html ('k') | tracing/tracing/ui/timeline_interest_range.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698