Skip to content

Commit

Permalink
Upstream animation-play-after-finish-restarts.html from Blink (#3335)
Browse files Browse the repository at this point in the history
  • Loading branch information
suzyh authored and birtles committed Mar 17, 2017
1 parent 10d0d5a commit cccdbe1
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions web-animations/timing-model/animations/playing-an-animation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Playing an animation</title>
<link rel="help"
href="https://w3c.github.io/web-animations/#playing-an-animation-section">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';

test(function(t) {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.currentTime = 1 * MS_PER_SEC;
assert_times_equal(animation.currentTime, 1 * MS_PER_SEC);
animation.play();
assert_times_equal(animation.currentTime, 1 * MS_PER_SEC);
}, 'Playing a running animation leaves the current time unchanged');

test(function(t) {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.finish();
assert_times_equal(animation.currentTime, 100 * MS_PER_SEC);
animation.play();
assert_times_equal(animation.currentTime, 0);
}, 'Playing a finished animation seeks back to the start');

test(function(t) {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.playbackRate = -1;
animation.currentTime = 0;
assert_times_equal(animation.currentTime, 0);
animation.play();
assert_times_equal(animation.currentTime, 100 * MS_PER_SEC);
}, 'Playing a finished and reversed animation seeks to end');

</script>
</body>

0 comments on commit cccdbe1

Please sign in to comment.