Skip to content

Commit

Permalink
add : a example page for TWEEN.Easing.generatePow()
Browse files Browse the repository at this point in the history
related tweenjs#116
  • Loading branch information
MasatoMakino committed Apr 21, 2021
1 parent 88f2275 commit 53eba58
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions examples/17_generate_pow.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,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>

0 comments on commit 53eba58

Please sign in to comment.