clone
Summary
Creates a copy of an Animation object.
Method of apis/web animations/Animationapis/web animations/Animation
Syntax
var myMiniMe = myAnimation.clone();
Return Value
Returns an object of type
Return a new Animation object created by calling the Animation constructor with parameters Animation(source.target, cloned effect, cloned timing).
Examples
This example creates an instance of the AnimationPlayer that animates an object horizontally and vertically using computed values, and runs for 1500ms (1.5 seconds), and then creates a copy of the player for later use.
var player = snowFlake.animate([
{transform: 'translate(' + snowLeft + 'px, -100%)'},
{transform: 'translate(' + snowLeft + 'px, ' + window.innerHeight + 'px)'}
], 1500);
var player2 = player.clone();
Related specifications
- Web Animations 1.0
- W3C Working Draft
Attributions
Portions of this content come from HTML5Rocks! article