-
Notifications
You must be signed in to change notification settings - Fork 540
/
index.html
executable file
·598 lines (556 loc) · 28.7 KB
/
index.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>SUPERSCROLLORAMA</title>
<link href='http://fonts.googleapis.com/css?family=Luckiest+Guy' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/normalize.css" type="text/css">
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="author" href="https://plus.google.com/107766061849006545830"/>
</head>
<body>
<a href="https://github.com/johnpolacek/superscrollorama">
<img style="position: absolute; top: 0; right: 0; border: 0; z-index: 999999999;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub" alt="Fork me on GitHub" />
</a>
<div id="newversion">
<a href="http://janpaepke.github.io/ScrollMagic/">
<h2>New Version</h2>
<span>Click here to find out more!</span>
</a>
</div>
<div id="intro">
<h1 id="title">
<span id="title-line1" class="title-line">Super</span>
<span id="title-line2" class="title-line">scroll</span>
<span id="title-line3" class="title-line">orama</span>
</h1>
</div>
<div id="title-info">
<p id="desc">The jQuery plugin for supercool scroll animation</p>
<p class="credit">powered by <a href="http://www.greensock.com">Greensock</a></p>
<p class="credit">
created by <a href="http://twitter.com/johnpolacek">John Polacek</a>
</p>
<p class="credit">
with help from <a href="http://twitter.com/janpaepke">Jan Paepke</a>
</p>
<p class="credit">
<a href="https://twitter.com/johnpolacek" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @johnpolacek</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</p>
</div>
<div id="download">
<p><em>NOTE: SuperScrollorama is no longer under active development. ScrollMagic is the new hotness!</em><br /><a href="http://janpaepke.github.io/ScrollMagic/">Get ScrollMagic</a></p>
<p><span class="accent">★</span> DOWNLOAD <span class="accent">★</span><br />
<a class="download" href="https://github.com/johnpolacek/superscrollorama/zipball/master">zip</a>
<a class="download" href="https://github.com/johnpolacek/superscrollorama/tarball/master">tar</a>
</p>
</div>
<div id="showcase">
<h1>Showcase</h1>
<p>Check out these great websites to see SuperScrollorama in action</p>
<div class="gallery clearfix">
<figure>
<a href="http://www.zivotjednekuchyne.cz">
<img src="gallery/ikea.jpg" alt="Ikea, Life of One Kitchen">
</a>
<figcaption>Ikea, Life of One Kitchen<br />
<small><a href="http://www.smashingawards.com/design/life-of-one-kitchen/">Smashing Award Winner</a></small>
</figcaption>
</figure>
<figure>
<a href="http://lifeisvertical.alpina-since1883.com">
<img src="gallery/alpina.jpg" alt="Alpina - Life Is Vertical">
</a>
<figcaption>Alpina - Life Is Vertical<br />
<small><a href="http://www.cssdesignawards.com/css-web-design-award-winner.php?id=20048">CSS Design Award Winner</a></small>
</figcaption>
</figure>
<figure>
<a href="http://www.nouvelleoctavia.fr">
<img src="gallery/skoda.jpg" alt="New Škoda Octavia">
</a>
<figcaption>New Škoda Octavia<br />
<small><a href="http://cssawards.net/new-skoda-octavia/">CSS Awards Site of the Day</a></small>
</figcaption>
</figure>
<figure>
<a href="https://corporate.target.com/about/design-innovation/owned-brands/">
<img src="gallery/target.jpg" alt="Target Exclusive Brands Site">
</a>
<figcaption>Target Exclusive Brands</figcaption>
</figure>
<figure>
<a href="http://www.zippergaleria.com.br/pt/">
<img src="gallery/zipper.jpg" alt="Zipper Galleria">
</a>
<figcaption>Zipper Galleria<br />
<small><a href="http://www.awwwards.com/web-design-awards/zipper-galeria">Awwwards Site of the Day Winner</a></small>
</figcaption>
</figure>
<figure>
<a href="http://inception-explained.com">
<img src="gallery/inception.jpg" alt="Inception Explained">
</a>
<figcaption>Inception Explained<br />
<small><a href="http://designtaxi.com/news/351985/Finally-The-Complex-Plot-of-Inception-Explained/">Featured on TAXI</a></small>
</figcaption>
</figure>
<figure>
<a href="http://finnsjourney.de">
<img src="gallery/finnsjourney.jpg" alt="Finn’s Journey">
</a>
<figcaption>Finn’s Journey</figcaption>
</figure>
<figure>
<a href="http://public.orsi-and-jan.info/home">
<img src="gallery/jan.jpg" alt="Orsi and Jan">
</a>
<figcaption>Orsi & Jan’s Wedding</figcaption>
</figure>
<figure>
<a href="http://innovation.kenmore.com/explore/">
<img src="gallery/kenmore.jpg" alt="Kenmore Innovations">
</a>
<figcaption>Kenmore Innovations</figcaption>
</figure>
</div>
</div>
<div id="hire">
<h3>Scrollorama For Hire</h3>
<p>Need help building your website? <a href="http://johnpolacek.com/contact/">Contact us</a>.</p>
</div>
<div id="hire">
<h3>Get Skills</h3>
<p><a href="http://www.shareasale.com/r.cfm?b=505392&u=471107&m=43811&urllink=&afftrack=" class="banner"><img src="http://www.shareasale.com/image/43811/comp3_728-90_00.jpg" alt="Treehouse has teamed up with various companies who are willing to offer students jobs with the right badges! Unlock your full potential! Get 3 months free!"></a></p>
</div>
<div id="content-wrapper">
<div id="examples-1">
<h2 id="fade-it">Fade It</h2>
<h2 id="fly-it">Fly It</h2>
<h2 id="spin-it">Spin It</h2>
<h2 id="scale-it">Scale It</h2>
<h2 id="smush-it">Smush It</h2>
</div>
<div id="examples-pin">
<div id="pin-frame-pin" class="pin-frame"><h2>Pin It</h2></div>
<div id="pin-frame-slide" class="pin-frame"><h2>Slide It</h2></div>
<div id="pin-frame-wipe" class="pin-frame"><h2>Wipe It</h2></div>
<div id="pin-frame-bounce" class="pin-frame"><h2>Bounce It</h2></div>
<div id="pin-frame-color" class="pin-frame"><h2>Color It</h2></div>
<div id="pin-frame-unpin" class="pin-frame"><h2>Unpin It</h2></div>
</div>
<div id="examples-2">
<h2 id="fling-it">Fling It</h2>
<h2 id="move-it">Move It</h2>
</div>
<div id="examples-parallax">
<h2 id="parallax-it">Parallax It</h2>
<h2 id="parallax-it-left">Parallax It</h2>
<h2 id="parallax-it-right">Parallax It</h2>
</div>
<h2 id="bring-it">Bring It</h2>
<div id="howtouse">
<h1>How To Use</h1>
<div id="caution">
<p class="disclaimer">Please note, this is a powerful tool, and with great power comes great responsibility. <br />Use wisely. A little subtlety can go a long way.</p>
</div>
<p class="divider">★ ★ ★</p>
<div id="instructions">
<p>SuperScrollorama is powered by TweenMax and the Greensock Tweening Engine. Go to <a href="http://www.greensock.com/get-started-js/" target="_blank">greensock.com</a> for documentation on how to use it. Why Greensock/TweenMax? Great performance, ease-of-use, expandibility and basically because it is awesome.</p>
<p>First, link to the <a href="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" target="_blank">jQuery CDN</a> and then embed TweenMax.js and SuperScrollorama. Next, start up SuperScrollorama. Think of it as a controller for animation. You add tweens and timelines to it, targeting when an element appears in the viewport or at a specific scroll point.</p>
<p>When initializing SuperScrollorama there are several options you might want to change.</p>
<div class="documentation">
<span class="documentation-method">$.superscrollorama({options})</span>
<ul class="param-list">
<li><span class="param">vars:</span> optional properties for the pin method (object):
<ul class="param-list param-list-sub">
<li><span class="param">isVertical</span> Are we scrolling vertically (true) or horizontally (false)? - default: true</li>
<li><span class="param">triggerAtCenter:</span> The animation triggers when the respective Element's origin is in the center of the scrollarea (true). This can be changed here to be at the top/left edge (false) - default: true</li>
<li><span class="param">playoutAnimations:</span> When scrolling past the animation should they be played out (true) or just be jumped to the respective last frame (false)?<br>(Does not affect animations where duration = 0) - default: true</li>
<li><span class="param">reverse:</span> Global flag do set if animations should be reversed (true) when scrolling back or not (false) - default: true</li>
</ul>
<li>
</ul>
</div>
<p>Example</p>
<p><blockquote><pre>
$(document).ready(function() {
var controller = $.superscrollorama({
triggerAtCenter: false,
playoutAnimations: true
});
});</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>Use the addTween method to build your scroll animations.</p>
<div class="documentation">
<span class="documentation-method">.addTween(target, tween, duration, offset, reverse)</span>
<ul class="param-list">
<li><span class="param">target:</span> scroll position (number) or element (string or object)</li>
<li><span class="param">tween:</span> a Greensock animation tween object</li>
<li><span class="param">duration:</span> scroll duration of tween in pixels (0 means autoplay)</li>
<li><span class="param">offset:</span> adjust the animation start point</li>
<li><span class="param">reverse:</span> disable reverse animation on up scrolling (optional)</li>
</ul>
</div>
<p>In the example below, the animation fades in when scrolled into view.</p>
<p><blockquote><pre>
controller.addTween('#fade',
TweenMax.from($('#fade'), .5, {css:{opacity:0}}));</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>The default duration is 0, which means the tween plays through completely when its scroll point is reached. You can add a duration which will instead sync the tween progress to the scrollbar position. Instead of one tween, you can create a timeline of multiple tweens.<br>If you use the TweenMax or TimelineMax option {repeat: -1} the animation will loop indefinetly for the set duration.</p>
<p><blockquote><pre>
// parallax example
controller.addTween(
'#examples-parallax',
(new TimelineLite())
.append([
TweenMax.fromTo($('#parallax-it-left'), 1,
{css:{top: 200}, immediateRender:true},
{css:{top: -600}}),
TweenMax.fromTo($('#parallax-it-right'), 1,
{css:{top: 500}, immediateRender:true},
{css:{top: -1250}})
]),
1000 // scroll duration of tween
);</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>The 4th parameter is offset, which you can use to adjust the scroll point at which the animation is triggered.</p>
<p><blockquote><pre>
controller.addTween('#fade',
TweenMax.from($('#fade'),.5,{
css:{opacity:0}}),
0, // scroll duration of tween (0 means autoplay)
200); // offset the start of the tween by 200 pixels</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>The 5th parameter is reverse, which you can use to disable reverse animation.</p>
<p><blockquote><pre>
controller.addTween('#fade',
TweenMax.from($('#fade'),.5,{
css:{opacity:0}}),
200,
false); // prevent backwards animation of the element</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>Pass in a function to the tween for when the animation is complete.</p>
<p><blockquote><pre>
controller.addTween('#fade',
TweenMax.from($('#fade'),.5,{
css:{opacity:0},
onComplete: function(){alert('test')}
}));</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>You can remove any previously added Tweens using the removeTween method.</p>
<div class="documentation">
<span class="documentation-method">.removeTween(target, tween, reset)</span>
<ul class="param-list">
<li><span class="param">target:</span> scroll position (number) or element (string or object)</li>
<li><span class="param">tween:</span> a Greensock animation tween object; if not set, all Tweens for the target will be removed. (optional, default: null)</li>
<li><span class="param">reset:</span> if true the tween will be reset to the starting position. (optional, default: true)</li>
</ul>
</div>
<p>In the example below, all tweens from the "#fade" element are removed and reset.</p>
<p><blockquote><pre>
controller.removeTween('#fade');</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>You can use the pin method to pin an element, do a series of animations and then unpin it.</p>
<p>The callback functions will be called with a boolean parameter, true if triggered at end (bottom) of pin, false, if triggered at the beginning (top point).</p>
<div class="documentation">
<span class="documentation-method">.pin(el, dur, vars)</span>
<ul class="param-list">
<li><span class="param">el:</span> element being pinned (string or object)</li>
<li><span class="param">dur:</span> scroll duration of pin (in pixels)</li>
<li><span class="param">vars:</span> optional properties for the pin method (object):
<ul class="param-list param-list-sub">
<li><span class="param">anim:</span> tween animation object that occurs during the pin</li>
<li><span class="param">offset:</span> adjust the pin start point</li>
<li><span class="param">onPin:</span> callback function for start of pin</li>
<li><span class="param">onUnpin:</span> callback function for end of pin</li>
<li><span class="param">pushFollowers:</span> Decide if following elements should be pushed down (true) or scrolled past (false), default: true</li>
</ul>
<li>
</ul>
</div>
<p>Example:</p>
<p><blockquote><pre>
controller.pin($('#examples-2'), 3000, {
anim: (new TimelineLite())
.append(
TweenMax.fromTo($('#move-it'), .5,
{css:{left: -200, top: 500}, immediateRender:true},
{css:{top: -400}})
)
.append(
TweenMax.to($('#move-it'), .5,
{css:{left: 200}})
)
.append(
TweenMax.to($('#move-it'), .5,
{css:{top: -200}})
)
.append(
TweenMax.to($('#move-it'), .5,
{css:{left: 0}})
)
});</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>You can use the updatePin method if you want to change options for pinned elements at runtime. For example when the window size or the size of your pin Item have changed. It Expects the same parameters as the .pin method, except all but the element is optional.</p>
<div class="documentation">
<span class="documentation-method">.updatePin(el, dur, vars)</span>
<ul class="param-list">
<li><span class="param">el:</span> element being pinned(string or object)</li>
<li><span class="param">dur:</span> scroll duration of pin (in pixels) (optional, default: 0)</li>
<li><span class="param">vars:</span> optional properties for the pin method (object):
<ul class="param-list param-list-sub">
<li><span class="param">anim:</span> tween animation object that occurs during the pin</li>
<li><span class="param">offset:</span> adjust the pin start point</li>
<li><span class="param">onPin:</span> callback function for start of pin</li>
<li><span class="param">onUnpin:</span> callback function for end of pin</li>
<li><span class="param">pushFollowers:</span> Decide if following elements should be pushed down (true) or scrolled past (false), default: true</li>
</ul>
<li>
</ul>
</div>
<p>Example:</p>
<p><blockquote><pre>
controller.updatePin($('#examples-2'), null, {
offset: 200
});</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>You can remove any previously added Pins using the removePin method.</p>
<div class="documentation">
<span class="documentation-method">.removePin(el, reset)</span>
<ul class="param-list">
<li><span class="param">el:</span> element being pinned(string or object)</li>
<li><span class="param">reset:</span> if true the element will be unpinned and the tween will be reset to the starting position. (optional, default: true)</li>
</ul>
</div>
<p>In the example below, the pin is removed, but not reset.<br>
reset=false will also mean that if you call it during pin, the element will stay pinned.</p>
<p><blockquote><pre>
controller.removePin('#examples-2', false);</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>Sometimes you might want to tell SuperScrollorama to update all elements, for example when the window is resized. Here the method triggerCheckAnim comes in handy.</p>
<div class="documentation">
<span class="documentation-method">.triggerCheckAnim(immediately)</span>
<ul class="param-list">
<li><span class="param">immediately:</span> if true the update will be done immediately, if false it will wait for the next tickEvent of TweenMax (to save performance)<br>(optional, default: false)</li>
</ul>
</div>
<p>Example:</p>
<p><blockquote><pre>
$(window).resize(function () {
controller.triggerCheckAnim();
});</pre></blockquote></p>
<p class="divider">★ ★ ★</p>
<p>To help make your SuperScrollorama application accessible to mobile users you'll need the method setScrollContainerOffset. For more details see <a href="simpledemo_mobile.html">simpledemo_mobile.html</a></p>
<div class="documentation">
<span class="documentation-method">.setScrollContainerOffset(x, y)</span>
<ul class="param-list">
<li><span class="param">x:</span> the x offset of the scrollcontainer</li>
<li><span class="param">y:</span> the y offset of the scrollcontainer</li>
</ul>
</div>
<p>Example:</p>
<p><blockquote><pre>
controller.setScrollContainerOffset(0, 200);</pre></blockquote></p>
</div>
<div id="credits">
<h1>Credits</h1>
<p>SuperScrollorama by <a href="http://johnpolacek.com">Chicago Web Developer John Polacek</a> <br>with <a href="http://twitter.com/janpaepke">Jan Paepke</a></p>
<p><a href="http://greensock.com">Greensock Tweening Engine & TweenMax</a> by <a href="http://greensock.com">Greensock</a></p>
<p><a href="http://letteringjs.com">Lettering.js</a> by <a href="http://daverupert.com">Dave Rupert</a></p>
<p><a href="http://www.google.com/fonts/specimen/Luckiest+Guy">Luckiest Guy Font</a> by <a href="https://profiles.google.com/astigmaticfonts/about">Astigmatic Fonts</a></p>
<p>John Polacek works at <a href="http://gesture.com">Gesture</a>, a <a href="http://gesture.com/mobile-bidding/">mobile bidding</a> and <a href="http://gesture.com/fundraising-event-services-for-charities/">fundraising technology</a> company that <a href="http://gesture.com/testimonials/">helps charities</a> raise more money.</p>
</div>
</div>
</div>
<script type="text/javascript" src="js/greensock/TweenMax.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.9.1.min.js"><\/script>')</script>
<script src="js/jquery.lettering-0.6.1.min.js"></script>
<script src="js/jquery.superscrollorama.js"></script>
<script>
$(document).ready(function() {
// set rotation of flash
TweenMax.set("#newversion", {rotation: 15});
$('body').css('visibility','visible');
// hide content until after title animation
$('#content-wrapper').css('display','none');
// lettering.js to split up letters for animation
$('#title-line1').lettering();
$('#title-line2').lettering();
$('#title-line3').lettering();
// TimelineLite for title animation, then start up superscrollorama when complete
(new TimelineLite({onComplete:initScrollAnimations}))
.from( $('#title-line1 span'), .4, {delay: 1, css:{right:'1000px'}, ease:Back.easeOut})
.from( $('#title-line2'), .4, {css:{top:'1000px',opacity:'0'}, ease:Expo.easeOut})
.append([
TweenMax.from( $('#title-line3 .char1'), .25+Math.random(), {css:{top: '-200px', right:'1000px'}, ease:Elastic.easeOut}),
TweenMax.from( $('#title-line3 .char2'), .25+Math.random(), {css:{top: '300px', right:'1000px'}, ease:Elastic.easeOut}),
TweenMax.from( $('#title-line3 .char3'), .25+Math.random(), {css:{top: '-400px', right:'1000px'}, ease:Elastic.easeOut}),
TweenMax.from( $('#title-line3 .char4'), .25+Math.random(), {css:{top: '-200px', left:'1000px'}, ease:Elastic.easeOut}),
TweenMax.from( $('#title-line3 .char5'), .25+Math.random(), {css:{top: '200px', left:'1000px'}, ease:Elastic.easeOut})
])
.from("#newversion", .4, {scale: 5, autoAlpha: 0, ease: Elastic.easeOut})
.to( $('#title-info'), .5, {css:{opacity:.99, 'margin-top':0}, delay:-1, ease:Quad.easeOut})
.to( $('#download'), .25, {autoAlpha:1});
function initScrollAnimations() {
$('#content-wrapper').css('display','block');
var controller = $.superscrollorama();
// title tweens
$('.title-line span').each(function() {
controller.addTween(10, TweenMax.to(this, .5, {css:{top: Math.random()*-200-600, left: (Math.random()*1000)-500, rotation:Math.random()*720-360, 'font-size': Math.random()*300+150}, ease:Quad.easeOut}),200);
});
controller.addTween(10, TweenMax.to($('#title-line1'), .75, {css:{top: 600}, ease:Quad.easeOut}),200);
controller.addTween(10, TweenMax.to($('#title-line2'), .75, {css:{top: 200}, ease:Quad.easeOut}),200);
controller.addTween(10, TweenMax.to($('#title-line3'), .75, {css:{top: -100}, ease:Quad.easeOut},200));
// showcase tweens
controller.addTween('#showcase h1', TweenMax.from( $('#showcase h1'), .75, {css:{letterSpacing:20,opacity:0}, ease:Quad.easeOut}));
controller.addTween('#showcase p', TweenMax.from( $('#showcase p'), 1, {css:{opacity:0}, ease:Quad.easeOut}));
$('#showcase .gallery figure').css('position','relative').each(function() {
controller.addTween('#showcase .gallery', TweenMax.from( $(this), 1, {delay:Math.random()*.2,css:{left:Math.random()*200-100,top:Math.random()*200-100,opacity:0}, ease:Back.easeOut}));
});
// hire tweens
$('#hire h3').lettering().find('span').css('position','relative').each(function() {
controller.addTween('#hire h3', TweenMax.from( $(this), .25, {delay:Math.random()*.2,css:{left:Math.random()*1200-600,top:Math.random()*600-300,opacity:0}, ease:Expo.easeOut}),200);
});
controller.addTween('#hire p', TweenMax.from( $('#hire p'), .5, {css:{opacity:0}}));
// individual element tween examples
controller.addTween('#fade-it', TweenMax.from( $('#fade-it'), .5, {css:{opacity: 0}}));
controller.addTween('#fly-it', TweenMax.from( $('#fly-it'), .25, {css:{right:'1000px'}, ease:Quad.easeInOut}));
controller.addTween('#spin-it', TweenMax.from( $('#spin-it'), .25, {css:{opacity:0, rotation: 720}, ease:Quad.easeOut}));
controller.addTween('#scale-it', TweenMax.fromTo( $('#scale-it'), .25, {css:{opacity:0, fontSize:'20px'}, immediateRender:true, ease:Quad.easeInOut}, {css:{opacity:1, fontSize:'240px'}, ease:Quad.easeInOut}));
controller.addTween('#smush-it', TweenMax.fromTo( $('#smush-it'), .25, {css:{opacity:0, 'letter-spacing':'30px'}, immediateRender:true, ease:Quad.easeInOut}, {css:{opacity:1, 'letter-spacing':'-10px'}, ease:Quad.easeInOut}), 0, 100); // 100 px offset for better timing
// set duration, in pixels scrolled, for pinned element
var pinDur = 4000;
// create animation timeline for pinned element
var pinAnimations = new TimelineLite();
pinAnimations
.append(TweenMax.from($('#pin-frame-pin h2'), .5, {css:{marginTop:0}, ease: Quad.easeInOut}))
.append([
TweenMax.to($('#pin-frame-slide'), 1, {css:{marginLeft:0}}),
TweenMax.to($('#pin-frame-pin'), 1, {css:{marginLeft:'100%'}})
], .5)
.append([
TweenMax.to($('#pin-frame-wipe'), .5, {css:{top:0}}),
TweenMax.from($('#pin-frame-wipe h2'), .5, {css:{marginTop:'-600px'}})
], .5)
.append(TweenMax.from($('#pin-frame-bounce'), 5, {css:{marginTop:'-100%'}, ease:Bounce.easeOut}), .5)
.append(TweenMax.from($('#pin-frame-color'), .25, {css:{opacity:0}}), .5)
.append([
TweenMax.to($('#pin-frame-color'), .25, {css:{backgroundColor:'blue'}}),
TweenMax.to($('#pin-frame-color h2'), .25, {css:{color:'orange'}})
])
.append([
TweenMax.to($('#pin-frame-color'), .25, {css:{backgroundColor:'green'}}),
TweenMax.to($('#pin-frame-color h2'), .25, {css:{color:'red'}})
])
.append([
TweenMax.to($('#pin-frame-color'), .25, {css:{backgroundColor:'yellow'}}),
TweenMax.to($('#pin-frame-color h2'), .25, {css:{color:'purple'}})
])
.append([
TweenMax.to($('#pin-frame-color'), .25, {css:{backgroundColor:'orange'}}),
TweenMax.to($('#pin-frame-color h2'), .25, {css:{color:'blue'}})
])
.append([
TweenMax.to($('#pin-frame-color'), .25, {css:{backgroundColor:'red'}}),
TweenMax.to($('#pin-frame-color h2'), .25, {css:{color:'green'}})
])
.append([
TweenMax.to($('#pin-frame-color'), .25, {css:{backgroundColor:'#222438'}}),
TweenMax.to($('#pin-frame-color h2'), .25, {css:{color:'#FFB000'}})
])
.append(TweenMax.to($('#pin-frame-unpin'), .5, {css:{top:'100px'}}));
// pin element, use onPin and onUnpin to adjust the height of the element
controller.pin($('#examples-pin'), pinDur, {
anim:pinAnimations,
onPin: function() {
$('#examples-pin').css('height','100%');
},
onUnpin: function() {
$('#examples-pin').css('height','600px');
}
});
controller.pin($('#examples-2'), 3000, {
anim: (new TimelineLite())
.append(
TweenMax.fromTo($('#fling-it'), 2,
{css:{left:-1000, top: 500, rotation: -360}, immediateRender:true},
{css:{left:2000, top: -600, rotation: 360}})
)
.append(
TweenMax.fromTo($('#move-it'), .75,
{css:{left: -200, top: 800}, immediateRender:true},
{css:{top: -200}}),
-1.5 // offset for better timing
)
.append(
TweenMax.to($('#move-it'), .5,
{css:{left: 200}})
)
.append(
TweenMax.to($('#move-it'), .5,
{css:{top: 0}})
)
.append(
TweenMax.to($('#move-it'), .5,
{css:{left: 0}})
)
})
// parallax example, setting duration ties animation to scroll position
// you can target a scroll position instead of an element (whose position can change)
controller.addTween(
'#examples-parallax',
(new TimelineLite())
.append([
TweenMax.fromTo($('#parallax-it-left'), 1,
{css:{top: 200}, immediateRender:true},
{css:{top: -600}}),
TweenMax.fromTo($('#parallax-it-right'), 1,
{css:{top: 500}, immediateRender:true},
{css:{top: -1250}})
]),
1000 // scroll duration of tween
);
$('#bring-it').lettering();
controller.addTween(
'#bring-it',
(new TimelineLite())
.append([
TweenMax.from($('#bring-it .char1'), 1,
{css:{fontSize: 0}, immediateRender:true, ease:Elastic.easeOut}),
TweenMax.from($('#bring-it .char2'), .6,
{css:{fontSize: 0}, immediateRender:true, ease:Elastic.easeOut}),
TweenMax.from($('#bring-it .char3'), 1.1,
{css:{fontSize: 0}, immediateRender:true, ease:Elastic.easeOut}),
TweenMax.from($('#bring-it .char4'), .7,
{css:{fontSize: 0}, immediateRender:true, ease:Elastic.easeOut}),
TweenMax.from($('#bring-it .char5'), .9,
{css:{fontSize: 0}, immediateRender:true, ease:Elastic.easeOut}),
TweenMax.from($('#bring-it .char6'), 1.2,
{css:{fontSize: 0}, immediateRender:true, ease:Elastic.easeOut}),
TweenMax.from($('#bring-it .char7'), .6,
{css:{fontSize: 0}, immediateRender:true, ease:Elastic.easeOut}),
TweenMax.from($('#bring-it .char8'), .8,
{css:{fontSize: 0}, immediateRender:true, ease:Elastic.easeOut})
])
,
1200,
-100 // offset for better timing
);
}
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2821890-9']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body></html>