UNPKG

monaca-lib

Version:

Monaca cloud API bindings for JavaScript

72 lines (63 loc) 2.17 kB
// Copyright (c) 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /** * @constructor * @extends {WebInspector.ElementsSidebarPane} */ WebInspector.AnimationsSidebarPane = function(stylesPane) { WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Animations")); this._stylesPane = stylesPane; this._timeline = new WebInspector.AnimationTimeline(this._stylesPane); this._timeline.show(this.bodyElement); } WebInspector.AnimationsSidebarPane.prototype = { /** * @override * @param {?WebInspector.DOMNode} node */ setNode: function(node) { WebInspector.ElementsSidebarPane.prototype.setNode.call(this, node); if (!node) return; this._updateTarget(node.target()); }, /** * @param {!WebInspector.Target} target */ _updateTarget: function(target) { if (this._target === target) return; if (this._target) this._target.animationModel.removeEventListener(WebInspector.AnimationModel.Events.AnimationPlayerCreated, this._animationPlayerCreated, this); this._target = target; this._target.animationModel.addEventListener(WebInspector.AnimationModel.Events.AnimationPlayerCreated, this._animationPlayerCreated, this); }, /** * @param {!WebInspector.Event} event */ _animationPlayerCreated: function(event) { this._timeline.addAnimation(/** @type {!WebInspector.AnimationModel.AnimationPlayer} */ (event.data.player), event.data.resetTimeline); }, /** * @override * @param {!WebInspector.Throttler.FinishCallback} finishCallback * @protected */ doUpdate: function(finishCallback) { if (!this.node()) { finishCallback(); return; } this._target.animationModel.ensureEnabled(); this._timeline.redraw(); finishCallback(); }, __proto__: WebInspector.ElementsSidebarPane.prototype } WebInspector.AnimationsSidebarPane.GlobalPlaybackRates = [0.1, 0.25, 0.5, 1.0];