Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 599 lines (556 sloc) 28.7 KB
<!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">&#9733;</span> DOWNLOAD <span class="accent">&#9733;</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 &amp; 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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</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">&#9733; &#9733; &#9733;</p>
<p>If you go the extra mile to 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 x 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 &amp; 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>