Jump to content
Search Community

otka

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by otka

  1. otka

    Wiggle Effect

    jamiejefferson, can you help me how I should modify the code to work on an svg image element? I want to achieve exactly the same wiggle effect. Following what I read here, I wrapped the attributes in a attr{} object (see code below). But it's still not working. jQuery correctly selects the image elements but something must break then when I call TweenMax.to(element, duration, tweenProps); because I'm getting this error Uncaught TypeError: undefined is not a function. Here is my code: wiggle("image"); function wiggle(selector){ $(selector).each(function() { wiggleProp(this, 'x', 3 , 3); wiggleProp(this, 'y', -3, 3); }) } function wiggleProp(element, prop, min, max) { var duration = Math.random() * (.6 - .3) + .3; var tweenProps = { ease: Power1.easeInOut, onComplete: wiggleProp, onCompleteParams: [element, prop, min, max], attr: [], //line added autoCSS:false //line added }; tweenProps.attr[prop] = Math.random() * (max - min) + min; //edited TweenMax.to(element, duration, tweenProps); }
×
×
  • Create New...