Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.85 KB | None | 0 0
  1.         $('.ani').each(function() {
  2.             var split1 = new SplitText('.txt', {type:"chars, words"});
  3.             var split2 = new SplitText('.hover', {type:"chars, words"});
  4.             var numChars1 = split1.words.length;
  5.             var numChars2 = split2.words.length;
  6.  
  7.             for(var i = 0; i < numChars2; i++){
  8.                 TweenMax.set(split2.chars[i], {
  9.                     y: 30 * Math.random()
  10.                 });
  11.             }
  12.  
  13.             $(this).mouseover(function(){
  14.                 for(var i = 0; i < numChars1; i++){
  15.                     TweenMax.to(split1.chars[i], 1, {
  16.                         y: -30 * Math.random(),
  17.                     }, .055 );
  18.                 }
  19.                 TweenMax.staggerTo(split2.chars, 0.3, {
  20.                     y: 0
  21.                 }, .055 );
  22.             });
  23.  
  24.             $(this).mouseleave(function(){
  25.                 TweenMax.staggerTo(split1.chars, 0.3, {
  26.                     y: 0
  27.                 }, .055 );
  28.                 for(var i = 0; i < numChars2; i++){
  29.                     TweenMax.to(split2.chars[i], 1, {
  30.                         y: 30 * Math.random(),
  31.                     }, .055 );
  32.                 }
  33.             });
  34.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement