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

Unified Diff: Source/devtools/front_end/sdk/AnimationModel.js

Issue 1155773002: Devtools Animations: Add cubic bezier easing editor for animations (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 5 years, 6 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
« no previous file with comments | « Source/devtools/front_end/elements/module.json ('k') | Source/devtools/front_end/ui/EditorPopoverHelper.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/AnimationModel.js
diff --git a/Source/devtools/front_end/sdk/AnimationModel.js b/Source/devtools/front_end/sdk/AnimationModel.js
index fbd2bb69d655949321f04f73a0cb3c5e310d210d..c1c33ce57408e6984fadd4958106ff38880f51f6 100644
--- a/Source/devtools/front_end/sdk/AnimationModel.js
+++ b/Source/devtools/front_end/sdk/AnimationModel.js
@@ -264,6 +264,31 @@ WebInspector.AnimationModel.AnimationPlayer.prototype = {
this._source.deferredNode().resolve(nodeResolved.bind(this));
},
+ /**
+ * @param {string} value
+ */
+ setEasing: function(value)
+ {
+ /**
+ * @param {?WebInspector.DOMNode} node
+ * @this {!WebInspector.AnimationModel.AnimationPlayer}
+ */
+ function nodeResolved(node)
+ {
+ if (!node)
+ return;
+ var animationProperty = this.type() === "CSSTransition" ? "transition" : "animation";
+ var style = node.getAttribute("style") || "";
+ style = style.replace(new RegExp("\\s*(-webkit-)?" + animationProperty + "-timing-function:[^;]*;?\\s*", "g"), "");
+ node.setAttributeValue("style", String.sprintf("%s %s-timing-function: %s !important;", style, animationProperty, value));
+ }
+
+ this.target().animationAgent().setEasing(this.id(), value);
+ // TODO (samli): Update CSS rules instead. (crbug.com/492937)
+ if (this.type() !== "WebAnimation")
+ this._source.deferredNode().resolve(nodeResolved.bind(this));
+ },
+
__proto__: WebInspector.SDKObject.prototype
}
« no previous file with comments | « Source/devtools/front_end/elements/module.json ('k') | Source/devtools/front_end/ui/EditorPopoverHelper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698