forked from tweenjs/tween.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
17_generate_pow.html
71 lines (58 loc) · 1.94 KB
/
17_generate_pow.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
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
<title>Tween.js / easing with a power of number</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>17 _ Easing with Pow</h2>
<p>TWEEN.Easing.generatePow() provides easing with a power of number.</p>
</div>
<div id="target"></div>
<script src="../dist/tween.umd.js"></script>
<script src="js/RequestAnimationFrame.js"></script>
<script src="js/createGraph.js"></script>
<script>
window.addEventListener('load', function () {
init()
animate()
})
function init() {
var target = document.getElementById('target')
const addGraph = pow => {
target.appendChild(createGraph(`Power"${pow}".In`, TWEEN.Easing.generatePow(pow).In))
target.appendChild(createGraph(`Power"${pow}".Out`, TWEEN.Easing.generatePow(pow).Out))
target.appendChild(createGraph(`Power"${pow}".InOut`, TWEEN.Easing.generatePow(pow).InOut))
}
target.appendChild(createGraph('Power1', TWEEN.Easing.generatePow(1).In))
target.appendChild(document.createElement('br'))
addGraph(2)
addGraph(3)
target.appendChild(document.createElement('br'))
addGraph(4)
addGraph(5)
target.appendChild(document.createElement('br'))
addGraph(5.8)
target.appendChild(createGraph(`Exponential.In`, TWEEN.Easing.Exponential.In))
target.appendChild(createGraph(`Exponential.Out`, TWEEN.Easing.Exponential.Out))
target.appendChild(createGraph(`Exponential.InOut`, TWEEN.Easing.Exponential.InOut))
}
function animate(time) {
requestAnimationFrame(animate)
TWEEN.update(time)
}
</script>
</body>
</html>