How to show and animate a hidden project after clicking a button

Problem:
after clicking a button i want to show an object and animate it at the same time, for example with pulsate or flash

ActivePresenter version: 9.3.0 - 64-bit build

OS: Win11

Notes:

Here is how I would approach this task.

Apply an Execute JavaScript onClick action to the button.

// show the desired object
// Object name is circle - change as appropriate
prez.object("circle").show();

// Apply the pulse animation to the desired object
// Animation lasts for duration of 2 seconds
// Change object name and time as desired
prez.object("circle").animate(AP.EffectType.PULSE,2000);

Below is a project for your review.
Project made with v9.1.2
showPulse.approj (280 KB)

Hope this helps.

Hi,

Thanks for your support, Greg.
Here’s an alternative way to achieve this without using code, only with the app’s built-in features:

  1. Apply an animation to the object (via the Animations tab).
  2. Hide the object (right-click > Initially Hidden).
  3. Add a Show Object action to the button’s On Click event.

Regards,

Hello gregs, thank you for your help. What is the extension for repeatedly displaying the animation? For example, pulsing 3 times in a row? Thx and BR

@mem - Well - one way might be by adding a couple of timed events.

// show the desired object
// Object name is circle - change as appropriate
prez.object("circle").show();

// Apply the pulse animation to the desired object
// Animation lasts for duration of 2 seconds
// Change object name and time as desired
prez.object("circle").animate(AP.EffectType.PULSE,2000);

// Execute another pulse at 2 seconds when the first finished
 setTimeout(function() {
    prez.object("circle").animate(AP.EffectType.PULSE,2000);
},2000);

// Execute another pulse at 4 seconds when the second finished
setTimeout(function() {
    prez.object("circle").animate(AP.EffectType.PULSE,2000);
},4000);