jquery - Scrollmagic timelineMax duration offset -


i have pretty simple scrollmagic event. involves section wipes, explained here - scrollmagic section wipes example.

so taking put following scrollmagic setup.

var ctrl = new scrollmagic.controller({     globalsceneoptions: {         triggerhook: 'onleave'     } });  var animationevents = new timelinemax()     .fromto($('#show .elem1'), 0.5, {opacity: '1'}, {opacity: '0', ease:power1.easeinout}, 0)     .fromto($('#show .elem2'), 1, {x: '0%'}, {x: '-100%', ease:power1.easeinout}, 2)     .fromto($('#show .elem3'), 0.5, {opacity: '0'}, {opacity: '1', ease: back.easeout}, 2.4)     .fromto($('#show .elem4'), 1, {opacity: '0'}, {opacity: '1', ease:power1.easeinout}, 3);  new scrollmagic.scene({     triggerelement: '#wrapper',     duration: '400%', }) .setpin('#wrapper') .settween(animationevents) .addto(ctrl); 

so did created scrollmagic controller, made timeline of animations, , setup scene.

it works great, no problems what-so-ever. however, trying wrap head around few of these values can make scrollto function menu, can scroll each of elements.

i have close working cannot seem figure out following; duration of scene 400% means scroll #wrapper pinned equivalent of scrolling past element (in relation trigger) 4 times height of wrapper.

that understand, not understand in each element of timelinemax have this...

.fromto($('#show .elem2'), 1, {x: '0%'}, {x: '-100%', ease:power1.easeinout}, 2) 

you can break down, 1 represents sort of duration, of not sure. , last variable, in case 2 represents offset of when start.

this question, values represent in comparison duration. since in case have 4 actions first 1 starting @ 0 , last 1 finishing @ number of 4 make sense me .elem1 starts @ duration point 0% , finishes @ duration point 50% , elem4 starts @ duration point 300% , finishes @ duration point 400% not seem case, or atleast maybe duration of #wrapper not how duration element calculated.

at least need figure out representation between offset numbers within timelinemax , duration.

any appreciated.

new timelinemax()     .fromto($('#show .elem2'), 1, {x: '0%'}, {x: '-100%', ease:power1.easeinout}, 2)                                ^^ -->                                                                                   ^^ --> b 

a time animation needs play start end. (in case needs one second move original intended position).

b position of animation within timeline. (especially interesting when have several tweens in same timeline shouldn't play in direct succession.) here means animation (the fromto(...) starts two seconds timeline.

the above timeline has duration of three seconds.

if apply logic timeline animationevents see has duration of four seconds.


now scrollmagic part:

scrollmagic projects duration of timeline or tween onto own duration (the duration of scrollmagic.scene).


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -