-
Notifications
You must be signed in to change notification settings - Fork 1
/
player.html
44 lines (43 loc) · 1.85 KB
/
player.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Keyframe3D Player</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- These are the 3 scripts required for the player -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.min.js"></script>
<script src="https://minkcv.github.io/keyframe3d/js/BufferGeometryUtils.js"></script>
<script src="https://minkcv.github.io/keyframe3d/player.js"></script>
<style>
.controls {
margin: auto;
width: 200px;
}
</style>
</head>
<body>
<!-- This is the div that the player will show in -->
<!-- You might want to style it with a width and height -->
<!-- The id must match what you use for createContext(), playPlayer(), and pausePlayer() -->
<div id='player1' style='width: 100%; height: 500px;'>
</div>
<!-- Optional, add some controls for play and pause -->
<!-- Make sure to use the same id that you used for createContext() -->
<div class='controls'>
<button onclick='playPlayer("player1")'>Play</button>
<button onclick='pausePlayer("player1")'>Pause</button>
</div>
<!-- Create a player context and load a project from a URL -->
<script type='text/javascript'>
// Pass in the id of the div that will have the rendered animation
var pc1 = createContext('player1');
// Use the URL for your animation here
loadProjectPlayer('https://minkcv.github.io/keyframe3d/demos/logo.json', pc1, function(pcx) {
// Want to do something once the player has loaded? Pass a callback function.
// The pcx argument is the context.
});
// Play/pause when clicking on the animation
pc1.renderer.domElement.onclick = function(){togglePlayPausePlayer("player1")};
</script>
</body>
</html>