Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. jQuery(document).ready(
  2.  
  3. function JsonAnimation(DivIdAndPath) { animContainer = document.getElementById(DivIdAndPath); /*id of div animation is draw in*/
  4.  
  5. var contentAnimation = {
  6. container: animContainer,
  7. renderer: 'svg',
  8. loop: true,
  9. autoplay:false,
  10. autoloadSegments: false,
  11. path: '/wp-content/json/DivIdAndPath.json'// path to your data.json file you rendered from AE
  12.  
  13. };
  14.  
  15. var anim;
  16.  
  17. anim = bodymovin.loadAnimation(contentAnimation );
  18.  
  19. animContainer.addEventListener("mouseover", playAnim);
  20. animContainer.addEventListener("mouseleave", stopAnim);
  21.  
  22. function playAnim(){ anim.play(); }
  23. function stopAnim(){ anim.stop(); }
  24.  
  25. }
  26. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement