OLD | NEW |
| (Empty) |
1 // Copyright 2014 Google Inc. All rights reserved. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 (function(shared, scope, testing) { | |
16 | |
17 scope.Animation = function(target, effectInput, timingInput) { | |
18 var animationNode = scope.AnimationNode(shared.normalizeTimingInput(timingIn
put)); | |
19 var effect = scope.convertEffectInput(effectInput); | |
20 var timeFraction; | |
21 var animation = function() { | |
22 WEB_ANIMATIONS_TESTING && console.assert(typeof timeFraction !== 'undefine
d'); | |
23 effect(target, timeFraction); | |
24 }; | |
25 // Returns whether the animation is in effect or not after the timing update
. | |
26 animation._update = function(localTime) { | |
27 timeFraction = animationNode(localTime); | |
28 return timeFraction !== null; | |
29 }; | |
30 animation._clear = function() { | |
31 effect(target, null); | |
32 }; | |
33 animation._hasSameTarget = function(otherTarget) { | |
34 return target === otherTarget; | |
35 }; | |
36 animation._isCurrent = animationNode._isCurrent; | |
37 animation._totalDuration = animationNode._totalDuration; | |
38 return animation; | |
39 }; | |
40 | |
41 scope.NullAnimation = function(clear) { | |
42 var nullAnimation = function() { | |
43 if (clear) { | |
44 clear(); | |
45 clear = null; | |
46 } | |
47 }; | |
48 nullAnimation._update = function() { | |
49 return null; | |
50 }; | |
51 nullAnimation._totalDuration = 0; | |
52 nullAnimation._isCurrent = function() { | |
53 return false; | |
54 }; | |
55 nullAnimation._hasSameTarget = function() { | |
56 return false; | |
57 }; | |
58 return nullAnimation; | |
59 }; | |
60 | |
61 if (WEB_ANIMATIONS_TESTING) { | |
62 testing.webAnimations1Animation = scope.Animation; | |
63 } | |
64 | |
65 })(webAnimationsShared, webAnimations1, webAnimationsTesting); | |
OLD | NEW |