Advertisement
ArtSemkin

Untitled

Jul 22nd, 2020
2,117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ======================================================================== */
  2. /* 52. SectionContent */
  3. /* ======================================================================== */
  4. class SectionContent extends ScrollAnimation {
  5.     constructor({
  6.         target,
  7.         scope
  8.     }) {
  9.         super({
  10.             target,
  11.             scope
  12.         });
  13.     }
  14.     set() {
  15.         this.$headline = this.$el.find('.section__headline');
  16.         this.$trigger = this.$el.find('.section-content__inner');
  17.         this.$button = this.$el.find('.section-content__button');
  18.         this.$imageInner = this.$el.find('.section-content__image');
  19.         this.$socialItems = this.$el.find('.social__item');
  20.  
  21.         gsap.set(this.$headline, {
  22.             scaleX: 0
  23.         });
  24.  
  25.         gsap.set(this.$button, {
  26.             y: 30,
  27.             autoAlpha: 0
  28.         });
  29.  
  30.         gsap.set(this.$imageInner, {
  31.             scaleY: 1.5,
  32.             y: '33%',
  33.             transformOrigin: 'top center',
  34.             autoAlpha: 0,
  35.         });
  36.  
  37.         gsap.set(this.$socialItems, {
  38.             y: 30,
  39.             autoAlpha: 0
  40.         });
  41.     }
  42.     run() {
  43.         const tl = new gsap.timeline();
  44.  
  45.         tl
  46.             .animateWords(this.$el, {
  47.                 ease: 'power3.out',
  48.                 duration: 1.2,
  49.                 stagger: 0.04,
  50.             }, 'start')
  51.             .to(this.$socialItems, {
  52.                 y: 0,
  53.                 autoAlpha: 1,
  54.                 stagger: 0.05,
  55.                 duration: 0.6
  56.             }, '<0.2')
  57.             .animateLines(this.$el, {
  58.                 excludeEl: '.js-change-text-hover__hover .split-text__line',
  59.                 ease: 'power3.out',
  60.                 duration: 1.2,
  61.                 stagger: 0.06,
  62.             }, '<0.2')
  63.             .animateHeadline(this.$headline, 'start')
  64.             .to(this.$button, {
  65.                 duration: 0.6,
  66.                 y: 0,
  67.                 autoAlpha: 1
  68.             }, '<0.2');
  69.  
  70.         this._createScene({
  71.             element: this.$el,
  72.             timeline: tl,
  73.             customTrigger: this.$trigger
  74.         });
  75.  
  76.         if (this.$imageInner && this.$imageInner.length) {
  77.             const tlImage = new gsap.timeline();
  78.  
  79.             tlImage.to(this.$imageInner, {
  80.                 duration: 0.9,
  81.                 autoAlpha: 1,
  82.                 y: '0%',
  83.                 force3D: true,
  84.                 scaleY: 1,
  85.                 ease: 'power3.out',
  86.             });
  87.  
  88.             this._createScene({
  89.                 element: this.$imageInner,
  90.                 triggerHook: 1,
  91.                 reveal: false,
  92.                 timeline: tlImage,
  93.             });
  94.         }
  95.  
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement