Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const blocks = [
  2.     {
  3.         elements: [
  4.             {
  5.                 $element: $('.main__luggage'),
  6.                 durationCoeff: 0.6,
  7.                 params: [{autoAlpha: 0}],
  8.             },
  9.             {
  10.                 $element: $('.main__man'),
  11.                 durationCoeff: 0.6,
  12.                 params: [{autoAlpha: 0}],
  13.             },
  14.             {
  15.                 $element: $('.main__woman'),
  16.                 durationCoeff: 0.6,
  17.                 params: [{autoAlpha: 0}],
  18.             },
  19.             {
  20.                 $element: $('.main__title'),
  21.                 durationCoeff: 1,
  22.                 params: [{y: -500}],
  23.             },
  24.             {
  25.                 $element: $('.main__subtitle'),
  26.                 durationCoeff: 1,
  27.                 params: [{y: -500}],
  28.             },
  29.             {
  30.                 $element: $('.main__item').eq(0),
  31.                 durationCoeff: 1,
  32.                 params: [{y: -700}],
  33.             },
  34.             {
  35.                 $element: $('.main__item').eq(1),
  36.                 durationCoeff: 1,
  37.                 params: [{y: -700}],
  38.             },
  39.             {
  40.                 $element: $('.main__item').eq(2),
  41.                 durationCoeff: 1,
  42.                 params: [{y: -700}],
  43.             },
  44.         ],
  45.         start: 0,
  46.         scrollDuration: 300,
  47.     },
  48.     {
  49.         elements: [
  50.             {
  51.                 $element: vars.$mainCircle,
  52.                 durationCoeff: 1,
  53.                 params: [{
  54.                     bottom: innerHeight + vw(424),
  55.                     ease: Power0.easeNone,
  56.                 }],
  57.             },
  58.         ],
  59.         start: 300,
  60.         scrollDuration: 2000,
  61.     },
  62.     {
  63.         elements: [
  64.             {
  65.                 $element: $('.main__text-image'),
  66.                 durationCoeff: 1,
  67.                 params: [{
  68.                     top: '-100%',
  69.                     ease: Power0.easeNone,
  70.                 }],
  71.             },
  72.         ],
  73.         start: 2300 / 7 * 3,
  74.         scrollDuration: 2300 / 7 * 4,
  75.     },
  76. ];
  77.  
  78. function animateScroll() {
  79.     blocks.forEach(({elements, scrollDuration, start}) => {
  80.         let tween = new TimelineMax();
  81.  
  82.         elements.forEach(({$element, durationCoeff, params}) => {
  83.             tween = tween.to($element, 1 * durationCoeff, ...params, 0);
  84.         });
  85.  
  86.         new ScrollMagic.Scene({
  87.             triggerElement: '#trigger',
  88.             duration: scrollDuration,
  89.             offset: start,
  90.         })
  91.             .setTween(tween)
  92.             .addTo(controller);
  93.     });
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement