-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy path06_array_interpolation.html
58 lines (46 loc) · 1.57 KB
/
06_array_interpolation.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!doctype html>
<html lang="en">
<head>
<title>Tween.js / array interpolation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
body {
margin: 0px;
}
#target {
font-size: 13px;
padding: 0px 32px;
}
</style>
<link href="css/style.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="info" style="position: relative">
<h1><a href="http://github.com/tweenjs/tween.js">tween.js</a></h1>
<h2>06 _ array interpolation</h2>
<p>The different interpolations if arrays are used as values.</p>
</div>
<div id="target"></div>
<script type="module">
import {createPath, xA, x0, yA, y0} from './js/createPath.js'
import * as TWEEN from '../dist/tween.esm.js'
const group = new TWEEN.Group()
const target = document.getElementById('target')
if (!target) throw 'missing element'
target.appendChild(createPath(group, 'Linear', TWEEN.Interpolation.Linear))
target.appendChild(createPath(group, 'Bezier', TWEEN.Interpolation.Bezier))
target.appendChild(createPath(group, 'CatmullRom', TWEEN.Interpolation.CatmullRom))
target.appendChild(document.createElement('br'))
xA.push(x0)
yA.push(y0)
target.appendChild(createPath(group, 'start === end', TWEEN.Interpolation.Linear))
target.appendChild(createPath(group, '', TWEEN.Interpolation.Bezier))
target.appendChild(createPath(group, '', TWEEN.Interpolation.CatmullRom))
animate()
function animate(time) {
requestAnimationFrame(animate)
group.update(time)
}
</script>
</body>
</html>