June 29, 2018
Delaying a function in Captivate’s Javascript window
Comments
(1)
June 29, 2018
Delaying a function in Captivate’s Javascript window
Newbie 5 posts
Followers: 0 people
(1)

Hello, I’m working on a project in Captivate 2017 and have a slide where I’d like an object to animate in, I am animating it in the javascript window (the on enter action of the slide) and I have it written like:

var keyframes = [
{
transform:’scale0.4)’
},
{
transform:’scale1)’
}
];
var options =
{
delay: 1000,
endDelay: 0,
duration: 500,
easing: ‘ease-out’,
}

I’d like it to animate on it’s own (not based on user interaction), but not until after a second or so.  With the delay in the options variable that works, however I’d like the object to not be visible until the animation starts.  I tried writing something like:

cp.hide(‘bar’);

function playAnim(f,g,e){
cp.enable(f);
g();
pAnim = e.animate(keyframes, options);
pAnim.play();
}

function unhideBar(){
cp.show(‘bar’);
}

setTimeout(playAnim(‘bar’,unhideBar,barc), 1000);

but the setTimeout method does not seem to be working? (I’ve never used setTimeout before so I’m not sure if I’m using it correctly).

I also previously tried writing it as window.setTimeout …. but that didn’t work either.

Any advice is much appreciated, thanks!

1 Comment
2018-06-30 07:39:32
2018-06-30 07:39:32

Why not put it in an advanced action, using the Delay command? I never understand why users like to complicate a workflow when it can be done in a simple way.

Like
()
Add Comment