Jump to content
Search Community

Vibrate / Shake effect?

zumajoe test
Moderator Tag

Recommended Posts

Thanks for the tip, I played with the roughEase a bit- I think i will need more time to experiment with it because I found an easier solution that worked for me. However my only problem is that TweenMax seems to be sticking on the first time it runs the tween... (i have the function running from a button release). On the 2nd click it plays fine, lag/hang. Is there some sort of initializing I should be doing?

 

A portion of my AS2 code:

 

import com.greensock.*;
import com.greensock.plugins.*;
import com.greensock.easing.*;

TweenPlugin.activate([TransformMatrixPlugin, ColorMatrixFilterPlugin, VisiblePlugin, EndArrayPlugin]);

function invalidTween(item:MovieClip):Void {

TweenMax.to(item,0.3,{colorTransform:{redMultiplier:3}, delay:0.1});
TweenMax.to(item,0.5,{colorTransform:{redMultiplier:1}, ease:Quad.easeInOut, delay:0.5});
TweenMax.to(item,0.1,{repeat:2, _y:item._y+(1+Math.random()*2), _x:item._x+(1+Math.random()*2), delay:0.1, ease:Expo.easeInOut});
TweenMax.to(item,0.1,{_y:item._y+(Math.random()*0), _x:item._x+(Math.random()*0), delay:0.3, onComplete:onFinishTween, ease:Expo.easeInOut});
if (TweenMax.isTweening(item)) {
	trace("HEY WE ARE TWEENING OK?");
	search_mc.enabled = false;
	search_mc.gotoAndStop(1);

}

function onFinishTween() {
	trace("finished");
	search_mc.enabled = true;
}

}

Link to comment
Share on other sites

Looks like you're using a nested function for the onComplete - nested functions are almost always a BAD idea because they get deleted as soon as the parent function finishes running. So the tween ends up trying to call a function that doesn't exist anymore.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...