forked from janpaepke/ScrollMagic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_tweening.html
More file actions
93 lines (90 loc) · 4.44 KB
/
simple_tweening.html
File metadata and controls
93 lines (90 loc) · 4.44 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=500" />
<meta name="keywords" content="ScrollMagic, example, scrolling, attaching, scrollbar, tween, tweenmax" />
<meta name="author" content="Jan Paepke (www.janpaepke.de)" />
<title>Animating with GSAP - Examples - ScrollMagic</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic|Josefin+Slab:400,700italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../../assets/css/normalize.css" type="text/css">
<link rel="stylesheet" href="../../assets/css/style.css" type="text/css">
<link rel="stylesheet" href="../../assets/css/examples.css" type="text/css">
<link rel="shortcut icon" href="../../assets/img/favicon.ico" type="image/x-icon">
<script type="text/javascript" src="../../assets/js/lib/jquery.min.js"></script>
<script type="text/javascript" src="../../assets/js/lib/highlight.pack.js"></script>
<script type="text/javascript" src="../../assets/js/lib/modernizr.custom.min.js"></script>
<script type="text/javascript" src="../../assets/js/examples.js"></script>
<script type="text/javascript" src="../../assets/js/lib/gsap3/gsap.min.js"></script>
<script type="text/javascript" src="../../scrollmagic/uncompressed/ScrollMagic.js"></script>
<script type="text/javascript" src="../../scrollmagic/uncompressed/plugins/animation.gsap.js"></script>
<script type="text/javascript" src="../../scrollmagic/uncompressed/plugins/debug.addIndicators.js"></script>
</head>
<body>
<ul id="menu"></ul>
<div id="content-wrapper">
<div id="example-wrapper">
<div class="scrollContent">
<section id="titlechart">
<div id="description">
<h1 class="badge gsap">Simple Tweening</h1>
<h2>Two examples of basic animation.</h2>
<ol>
<li>When no duration is defined for the scene, the tween will simply start playing when the scroll reaches the trigger position.</li>
<li>If the scene has a duration the progress of the tween will directly correspond to the scroll position.</li>
</ol>
<p>
This example uses the shorthand version of <a href="../../docs/animation.GSAP.html#Scene.setTween">Scene.setTween()</a> to add <a href="http://greensock.com/docs/#/HTML5/GSAP/TweenMax/to/" target="_blank">TweenMax.to()</a> animations.<br>
To see how to build more advanced tweens check out the <a href="../advanced/advanced_tweening.html">Advanced Tweening Example<a>.
</p>
<a href="#" class="viewsource">view source</a>
</div>
<script>
// init controller
var controller = new ScrollMagic.Controller();
</script>
</section>
<section class="demo">
<div class="spacer s2"></div>
<div id="trigger1" class="spacer s0"></div>
<div id="animate1" class="box2 skin">
<p>You wouldn't like me, when I'm angry!</p>
<a href="#" class="viewsource">view source</a>
</div>
<div class="spacer s2"></div>
<script>
// build scene
var scene = new ScrollMagic.Scene({
triggerElement: "#trigger1"
})
.setTween("#animate1", 0.2, {backgroundColor: "green", scale: 2.5}) // trigger a TweenMax.to tween
.addIndicators({name: "1 (duration: 0)"}) // add indicators (requires plugin)
.addTo(controller);
</script>
</section>
<section class="demo">
<div class="spacer s1"></div>
<div id="trigger2" class="spacer s1"></div>
<div class="spacer s0"></div>
<div id="animate2" class="box1 black">
<p>Smurf me!</p>
<a href="#" class="viewsource">view source</a>
</div>
<div class="spacer s2"></div>
<script>
// build scene
var scene = new ScrollMagic.Scene({triggerElement: "#trigger2", duration: 300})
// animate color and top border in relation to scroll position
.setTween("#animate2", {borderTop: "30px solid white", backgroundColor: "blue", scale: 0.7}) // the tween durtion can be omitted and defaults to 1
.addIndicators({name: "2 (duration: 300)"}) // add indicators (requires plugin)
.addTo(controller);
</script>
</section>
<div class="spacer s_viewport"></div>
</div>
</div>
</div>
<script type="text/javascript" src="../../assets/js/tracking.js"></script>
</body>
</html>