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