Jump to content
Search Community

Pulsing effect!

raivispurins test
Moderator Tag

Recommended Posts

I tried to use a greensock tweening class, for creating a pulsing object. The pulsing means, that it`s glow to 40 to 40 px blur, but after it goes back to 0px position.

 

The code i use is something like this:

 

function glow(evt:Event):void{
for (var i:Number = 0; i < 2; i++) {
}
if (i>2){
i--;
}
}
TweenMax.to(map_b, 1.5, {dropShadowFilter:{color:0xff0000, alpha:i, blurX:60, blurY:60, strength:10, angle:0, distance:0}});

 

But something is`n working, or maybe my code is wrong, or you can`t point me how to create looping with tween. Thank you in advance!

Link to comment
Share on other sites

TweenMax tweens have a repeat property:

 

TweenMax.to(mc, 1, {x:100, repeat:-1, yoyo:true});

 

if mc has a starting x of 0 it will tween from 0 to 100 and back to 0 indefinitely.

 

from http://www.greensock.com/tweenmax

 

repeat : int – Number of times that the tween should repeat. To repeat indefinitely, use -1.

 

repeatDelay : Number – Amount of time in seconds (or frames for frames-based tweens) between repeats.

 

yoyo : Boolean – Works in conjunction with the repeat property, determining the behavior of each cycle. When yoyo is true, the tween will go back and forth, appearing to reverse every other cycle (this has no affect on the “reversed” property though). So if repeat is 2 and yoyo is false, it will look like: start – 1 – 2 – 3 – 1 – 2 – 3 – 1 – 2 – 3 – end. But if repeat is 2 and yoyo is true, it will look like: start – 1 – 2 – 3 – 3 – 2 – 1 – 1 – 2 – 3 – end.

Link to comment
Share on other sites

I still don`t get it, It should work as you said to me, but not this time.

 

the code:

 

map_b.addEventListener(Event.ENTER_FRAME, glow);

function glow(evt:Event): void{
TweenMax.to(map_b, 1.75, {glowFilter:{color:0x990000, alpha:1, blurX:30, blurY:30, strength:2.5, quality:3, repeat:10, yoyo:true}});
}

 

It glows only once and nothing happens. Even if I use the tween without enterframe event, it only work once.

Link to comment
Share on other sites

do not use your Tween in an ENTER_FRAME handler. that will recreate it over and over and over and it will never have time to play.

 

the only problem in your code is that you put the repeat and yoyo properties in where the glowFilter props are

 

 

TweenMax.to(map_b, 1.75, { glowFilter:{color:0x990000, alpha:1, blurX:30, blurY:30, strength:2.5, quality:3}, repeat:10, yoyo:true });

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...