OLD | NEW |
1 suite('animation-node', function() { | 1 suite('animation-node', function() { |
2 test('normalize timing input', function() { | 2 test('normalize timing input', function() { |
3 assert.equal(normalizeTimingInput(1).duration, 1); | 3 assert.equal(normalizeTimingInput(1).duration, 1); |
4 assert.equal(normalizeTimingInput(1).easing(0.2), 0.2); | 4 assert.equal(normalizeTimingInput(1).easing(0.2), 0.2); |
5 assert.equal(normalizeTimingInput(undefined).duration, 0); | 5 assert.equal(normalizeTimingInput(undefined).duration, 0); |
6 }); | 6 }); |
7 test('calculating active duration', function() { | 7 test('calculating active duration', function() { |
8 assert.equal(calculateActiveDuration({duration: 1000, playbackRate: 4, itera
tions: 20}), 5000); | 8 assert.equal(calculateActiveDuration({duration: 1000, playbackRate: 4, itera
tions: 20}), 5000); |
9 assert.equal(calculateActiveDuration({duration: 500, playbackRate: 0.1, iter
ations: 300}), 1500000); | 9 assert.equal(calculateActiveDuration({duration: 500, playbackRate: 0.1, iter
ations: 300}), 1500000); |
10 }); | 10 }); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 assert.equal(calculateTransformedTime(4, 1000, 200, {easing: function(x) { r
eturn x; }, direction: 'reverse'}), 800); | 86 assert.equal(calculateTransformedTime(4, 1000, 200, {easing: function(x) { r
eturn x; }, direction: 'reverse'}), 800); |
87 assert.closeTo(calculateTransformedTime(4, 1000, 200, {easing: function(x) {
return x * x; }, direction: 'reverse'}), 640, 0.0001); | 87 assert.closeTo(calculateTransformedTime(4, 1000, 200, {easing: function(x) {
return x * x; }, direction: 'reverse'}), 640, 0.0001); |
88 assert.closeTo(calculateTransformedTime(4, 1000, 600, {easing: function(x) {
return x * x; }, direction: 'alternate'}), 360, 0.0001); | 88 assert.closeTo(calculateTransformedTime(4, 1000, 600, {easing: function(x) {
return x * x; }, direction: 'alternate'}), 360, 0.0001); |
89 assert.closeTo(calculateTransformedTime(3, 1000, 600, {easing: function(x) {
return x * x; }, direction: 'alternate'}), 160, 0.0001); | 89 assert.closeTo(calculateTransformedTime(3, 1000, 600, {easing: function(x) {
return x * x; }, direction: 'alternate'}), 160, 0.0001); |
90 assert.closeTo(calculateTransformedTime(4, 1000, 600, {easing: function(x) {
return x * x; }, direction: 'alternate-reverse'}), 160, 0.0001); | 90 assert.closeTo(calculateTransformedTime(4, 1000, 600, {easing: function(x) {
return x * x; }, direction: 'alternate-reverse'}), 160, 0.0001); |
91 assert.closeTo(calculateTransformedTime(3, 1000, 600, {easing: function(x) {
return x * x; }, direction: 'alternate-reverse'}), 360, 0.0001); | 91 assert.closeTo(calculateTransformedTime(3, 1000, 600, {easing: function(x) {
return x * x; }, direction: 'alternate-reverse'}), 360, 0.0001); |
92 }); | 92 }); |
93 test('Animation Node', function() { | 93 test('Animation Node', function() { |
94 var timing = normalizeTimingInput({duration: 1000, iterations: 4, iterationS
tart: 0.5, easing: 'linear', direction: 'alternate', delay: 100, fill: 'forwards
'}); | 94 var timing = normalizeTimingInput({duration: 1000, iterations: 4, iterationS
tart: 0.5, easing: 'linear', direction: 'alternate', delay: 100, fill: 'forwards
'}); |
95 var timing2 = normalizeTimingInput({duration: 1000, iterations: 4, iteration
Start: 0.5, easing: 'ease', direction: 'alternate', delay: 100, fill: 'forwards'
}); | 95 var timing2 = normalizeTimingInput({duration: 1000, iterations: 4, iteration
Start: 0.5, easing: 'ease', direction: 'alternate', delay: 100, fill: 'forwards'
}); |
96 var node = webAnimationsMinifill.AnimationNode(timing); | 96 var node = webAnimations1.AnimationNode(timing); |
97 var node2 = webAnimationsMinifill.AnimationNode(timing2); | 97 var node2 = webAnimations1.AnimationNode(timing2); |
98 assert.equal(node(0), null); | 98 assert.equal(node(0), null); |
99 assert.equal(node(100), 0.5); | 99 assert.equal(node(100), 0.5); |
100 assert.closeTo(node2(100), 0.8, 0.005); | 100 assert.closeTo(node2(100), 0.8, 0.005); |
101 assert.equal(node(600), 1); | 101 assert.equal(node(600), 1); |
102 assert.closeTo(node2(600), 1, 0.005); | 102 assert.closeTo(node2(600), 1, 0.005); |
103 assert.equal(node(700), 0.9); | 103 assert.equal(node(700), 0.9); |
104 assert.closeTo(node2(700), 0.99, 0.005); | 104 assert.closeTo(node2(700), 0.99, 0.005); |
105 assert.equal(node(1600), 0); | 105 assert.equal(node(1600), 0); |
106 assert.closeTo(node2(1600), 0, 0.005); | 106 assert.closeTo(node2(1600), 0, 0.005); |
107 assert.equal(node(4000), 0.4); | 107 assert.equal(node(4000), 0.4); |
108 assert.closeTo(node2(4000), 0.68, 0.005); | 108 assert.closeTo(node2(4000), 0.68, 0.005); |
109 assert.equal(node(4100), 0.5); | 109 assert.equal(node(4100), 0.5); |
110 assert.closeTo(node2(4100), 0.8, 0.005); | 110 assert.closeTo(node2(4100), 0.8, 0.005); |
111 assert.equal(node(6000), 0.5); | 111 assert.equal(node(6000), 0.5); |
112 assert.closeTo(node2(6000), 0.8, 0.005); | 112 assert.closeTo(node2(6000), 0.8, 0.005); |
113 }); | 113 }); |
114 }); | 114 }); |
OLD | NEW |