1<!DOCTYPE html> 2<!-- 3Copyright (c) 2014 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7<link rel="import" href="/tracing/base/base.html"> 8<script> 9'use strict'; 10 11tr.exportTo('tr.ui.b', function() { 12 /** 13 * Represents a procedural animation that can be run by an 14 * tr.ui.b.AnimationController. 15 * 16 * @constructor 17 */ 18 function Animation() { 19 } 20 21 Animation.prototype = { 22 23 /** 24 * Called when an animation has been queued after a running animation. 25 * 26 * @return {boolean} True if the animation can take on the responsibilities 27 * of the running animation. If true, takeOverFor will be called on the 28 * animation. 29 * 30 * This can be used to build animations that accelerate as pairs of them are 31 * queued. 32 */ 33 canTakeOverFor: function(existingAnimation) { 34 throw new Error('Not implemented'); 35 }, 36 37 /** 38 * Called to take over responsiblities of an existingAnimation. 39 * 40 * At this point, the existingAnimation has been ticked one last time, then 41 * stopped. This animation will be started after this returns and has the 42 * job of finishing(or transitioning away from) the effect the existing 43 * animation was trying to accomplish. 44 */ 45 takeOverFor: function(existingAnimation, newStartTimestamp, target) { 46 throw new Error('Not implemented'); 47 }, 48 49 start: function(timestamp, target) { 50 throw new Error('Not implemented'); 51 }, 52 53 /** 54 * Called when an animation is stopped before it finishes. The animation can 55 * do what it wants here, usually nothing. 56 * 57 * @param {Number} timestamp When the animation was stopped. 58 * @param {Object} target The object being animated. May be undefined, take 59 * care. 60 * @param {boolean} willBeTakenOverByAnotherAnimation Whether this animation 61 * is going to be handed to another animation's takeOverFor function. 62 */ 63 didStopEarly: function(timestamp, target, 64 willBeTakenOverByAnotherAnimation) { 65 }, 66 67 /** 68 * @return {boolean} true if the animation is finished. 69 */ 70 tick: function(timestamp, target) { 71 throw new Error('Not implemented'); 72 } 73 }; 74 75 return { 76 Animation: Animation 77 }; 78}); 79</script> 80