Problem:
Hi, I want to make an object pulse in Javascript.
I manage to make the object pulse once in the speed I want it to pulse but I cannot make it pulse several times. I thought I made add this as part of the options parameter. But it doesn’T seem to be that way.
There’s no option for repeating the effect.
You can use “callback” option, or JS functions such as setTimeout, setInterval to do that.
Below is an example using “callback” option:
var pulseTimes = 3; // pulse 3 times
var currentPulseTimes = 0;
function pulseCallback() {
++currentPulseTimes;
if (currentPulseTimes < pulseTimes) // do next pulse
this.animate(AP.EffectType.PULSE, 500, {callback: pulseCallback});
}
// first pulse
prez.object('HelpEmoji').animate(AP.EffectType.PULSE, 500, {callback: pulseCallback});