-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbrowser.html
More file actions
48 lines (44 loc) · 1.17 KB
/
browser.html
File metadata and controls
48 lines (44 loc) · 1.17 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Color Tween Demo</title>
<style>
body {
font-family: sans-serif;
background-color: #ffa500;
}
button {
font-size: 1.4em;
padding: 1em 2em;
}
</style>
</head>
<body>
<h1>Hello, Color Tweens!</h1>
<button onclick="makeItSo()">Show Me</button>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../dist/color-tween.min.js"></script>
<script>
var tween;
function makeItSo(){
tween = new ColorTween('#ffa500', '#40e0d0')
.duration(3000)
.easing('linear')
.onUpdate(update)
.onEnd(function(){
console.log('All Done!');
})
.start(animate);
}
function animate(time) {
if (tween.update()) {
requestAnimationFrame(animate);
}
}
function update(color) {
$('body').css('background-color', color.hex())
}
</script>
</body>
</html>