Advertisement
artemsemkin

Untitled

Aug 24th, 2020 (edited)
1,629
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* ======================================================================== */
  2. /* 55. SliderLetters */
  3. /* ======================================================================== */
  4. var SliderLetters = function ($scope) {
  5.  
  6.   var
  7.     $SVGLetters = $('.vector-letters'),
  8.     $letters = $SVGLetters.find('.vector-letter'),
  9.     $menuItems = $scope.find('.menu-overlay a'),
  10.     tl = new TimelineMax();
  11.  
  12.   if (!$SVGLetters.length || !$letters.length) {
  13.     return;
  14.   }
  15.  
  16.   /** insert this **/
  17.   /////////////////////////////////////////////
  18.   TweenMax.set($letters[0], {
  19.     morphSVG: $letters.filter('#vector-X') // modify to the letter as you need: #vector-B, #vector-H, etc
  20.   });
  21.   /////////////////////////////////////////////
  22.  
  23.   hoverMenuitems();
  24.  
  25.   function hoverMenuitems() {
  26.  
  27.     $menuItems.each(function () {
  28.  
  29.       var
  30.         $current = $(this),
  31.         currentLetter = $current.data('letter'),
  32.         targetLetter = $letters.filter('#vector-' + currentLetter);
  33.  
  34.       $current
  35.         .on('mouseenter touchstart', function () {
  36.           tl
  37.             .clear()
  38.             .to($letters[0], 0.6, {
  39.               morphSVG: targetLetter,
  40.               ease: Expo.easeInOut
  41.             });
  42.         });
  43.  
  44.     });
  45.  
  46.   }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement