Jump to content
Search Community

NUcreative

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by NUcreative

  1. Hello,

    I am having issues after using the .call() to use a custom function (which play a sound). I always get Cannot tween a null target after in the console log.

    Can you help me understand why? Thanks

     

    // Sounds for the ANIMATIONS are collected in an Object
    var sounds = {
       'creakingWood' : new Audio("../public/assets/sounds/077562105.mp3")
    };
    
    // Function to play the Sounds
    function playSound(i) {
       sounds[i].play();
    }
    
    // Rotate to the left
    $( "#caveSign1, #Sign4, #Sign8_1_").hover(
      function() {
        signAnimation
        .call(playSound('creakingWood'))
        .to($( this ), 1, {rotation: -8, ease: Power1.easeOut, transformOrigin:"50% 50%"});
        $(this).css('cursor','pointer');
    },function() {
       signAnimation
       .to($( this ), 1, {rotation: 0, ease: Power1.easeOut, transformOrigin:"50% 50%"});
       $(this).css('cursor','default');
       }
    );

     


    The .call() is working but the .to() is not. If I swap them both works but I wish I was able to put the .call() function in between parts of the animations. Sorry, I am not an expert of GreenSock just taking hover another web developer.

     

    Thanks

×
×
  • Create New...