Advertisement
artemsemkin

Rhye template: class SectionList

Aug 10th, 2022 (edited)
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class SectionList extends ScrollAnimation {
  2.   _setAnimation() {
  3.     gsap.set(this.$listImages, {
  4.       opacity: 0,
  5.       scale: 1.1,
  6.       transformOrigin: 'center center'
  7.     });
  8.  
  9.     /* === Add this === */
  10.     SetText.setChars({
  11.       target: this.$el.find('.split-text[data-split-text-set="chars"]'),
  12.       autoAlpha: 1,
  13.       y: '100%'
  14.     });
  15.   }
  16.  
  17.   _animate() {
  18.     const self = this;
  19.  
  20.     self._createScene({
  21.       element: this.$el
  22.     });
  23.  
  24.     this.$listItems.each(function () {
  25.       const
  26.         $el = $(this),
  27.         tl = new gsap.timeline(),
  28.         $thumb = $el.find('.list-projects__cover img, .list-projects__thumbnail'),
  29.         $heading = $el.find('.list-projects__heading'),
  30.         offset = $thumb.is(':visible') ? '-=0.6' : '0';
  31.  
  32.       tl
  33.         .to($thumb, {
  34.           opacity: 1,
  35.           scale: 1,
  36.           duration: 1.2,
  37.         })
  38.         .add([
  39.           gsap.effects.animateWords($heading, {
  40.             duration: 0.9
  41.           }),
  42.           /* === Add this === */
  43.           gsap.effects.animateChars($heading, {
  44.             duration: 0.9,
  45.             stagger: distributeByPosition({
  46.               from: 'start',
  47.               amount: 0.2
  48.             }),
  49.           }),
  50.           gsap.effects.animateLines($el, {
  51.             excludeEl: '.js-change-text-hover__hover .split-text__line',
  52.           })
  53.         ], offset);
  54.  
  55.       self._createScene({
  56.         element: $el,
  57.         timeline: tl,
  58.         reveal: false
  59.       });
  60.     });
  61.   }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement