-
-
Save alexeypegov/76b22e60a70402bc8e4f to your computer and use it in GitHub Desktop.
Embedding Animatron Player
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<!-- Animatron Player Bundle --> | |
<script type="text/javascript" src="http://player-dev.animatron.com/latest/bundle/animatron.js"></script> | |
</head> | |
<body> | |
<!-- Canvas element for Player to draw into --> | |
<canvas id="anm"></canvas> | |
<!-- Custom controls --> | |
<div id="sections"> | |
<div class="section"> | |
Section 1. | |
<a href="javascript:play(0)">Play</a> | <!-- call play(0) to start playing from the beginning (0 sec) --> | |
<a href="javascript:pause();">Pause</a></div> <!-- pause control --> | |
<div class="section"> | |
Section 2. | |
<a href="javascript:play(10)">Play</a> | <!-- call play(10) to start playing from the beginning of second scene (10 secs) --> | |
<a href="javascript:pause();">Pause</a></div> <!-- pause control --> | |
</div> | |
<!-- Player initialization and project loading --> | |
<script type="text/javascript"> | |
// play function | |
function play(time) { | |
var player = window.player; | |
player.stop(); // ensure player is stopped | |
player.play(time); // start playing from the specified time | |
} | |
// pause player | |
function pause() { | |
window.player.pause(); | |
} | |
// initialize player and load project data | |
window.player = anm.Player.forSnapshot("anm", | |
/* Use your project ID from the Publish HTML dialog here */ | |
"http://snapshots.animatron.com/8e188b4e170e60300117ce70fa76ab76-v1.1", | |
anm.createImporter('animatron')); | |
window.player.on(anm.C.S_LOAD, function(_player) { | |
// add something you need to be run as soon as project will be loaded | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment