1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | (function(shared, scope, testing) {
|
16 |
|
17 | function EffectTime(timing) {
|
18 | var timeFraction = 0;
|
19 | var activeDuration = shared.calculateActiveDuration(timing);
|
20 | var effectTime = function(localTime) {
|
21 | return shared.calculateIterationProgress(activeDuration, localTime, timing);
|
22 | };
|
23 | effectTime._totalDuration = timing.delay + activeDuration + timing.endDelay;
|
24 | return effectTime;
|
25 | }
|
26 |
|
27 | scope.KeyframeEffect = function(target, effectInput, timingInput, id) {
|
28 | var effectTime = EffectTime(shared.normalizeTimingInput(timingInput));
|
29 | var interpolations = scope.convertEffectInput(effectInput);
|
30 | var timeFraction;
|
31 | var keyframeEffect = function() {
|
32 | WEB_ANIMATIONS_TESTING && console.assert(typeof timeFraction !== 'undefined');
|
33 | interpolations(target, timeFraction);
|
34 | };
|
35 |
|
36 | keyframeEffect._update = function(localTime) {
|
37 | timeFraction = effectTime(localTime);
|
38 | return timeFraction !== null;
|
39 | };
|
40 | keyframeEffect._clear = function() {
|
41 | interpolations(target, null);
|
42 | };
|
43 | keyframeEffect._hasSameTarget = function(otherTarget) {
|
44 | return target === otherTarget;
|
45 | };
|
46 | keyframeEffect._target = target;
|
47 | keyframeEffect._totalDuration = effectTime._totalDuration;
|
48 | keyframeEffect._id = id;
|
49 | return keyframeEffect;
|
50 | };
|
51 |
|
52 | if (WEB_ANIMATIONS_TESTING) {
|
53 | testing.webAnimations1KeyframeEffect = scope.KeyframeEffect;
|
54 | testing.effectTime = EffectTime;
|
55 | }
|
56 |
|
57 | })(webAnimationsShared, webAnimations1, webAnimationsTesting);
|