daveg
New Member
Posts: 8
|
Post by daveg on Aug 20, 2013 18:51:34 GMT
I know how to make an item visible, set the opacity, etc. in a script:
ScriptIDName.Visible = true; ScriptIDName.Opacity = 50;
What I want to do is to fade-in an item over time with a script. Do I use Javascript SetInterval()?
I'll try that, but is there a better way?
Thanks! -dave
|
|
daveg
New Member
Posts: 8
|
Post by daveg on Aug 20, 2013 19:09:10 GMT
I guess Javascript intervals and timeouts are not supported in Hippo Animator, so that didn't work.
I'm thinking of using GetTime() in a loop.
|
|
daveg
New Member
Posts: 8
|
Post by daveg on Aug 20, 2013 19:25:11 GMT
And this didn't work. In five seconds it just makes the opacity 100 all at once instead of 10% every 1/2 second. Is there a force refresh command I can do every time I change the opacity?
img_bb.Visible = true; img_bb.Opacity = 0;
var d = new Date(); var curTime = d.getTime();
while (img_bb.Opacity < 100) { var d = new Date(); var newTime = d.getTime(); if ( (newTime - curTime) > 500) { img_bb.Opacity = img_bb.Opacity + 10; curTime = newTime; } }
|
|
|
Post by Hippani on Aug 21, 2013 8:13:41 GMT
Movie->On Update is called every time the movie updates, so there is no intervals, just use the On update script event.
var Speed=1; ScriptIDName.Opacity = GetTime()*Speed;
It's much easier than you think.
* This would assume your movie is 100 frames long.
Even better would be:
var StartFrame=0,EndFrame=12; var Time=GetTime(); if(Time>=StartFrame&&Time<=EndFrame){ ScriptIDName.Opacity = 100*((Time-StartTime)/(EndFrame-StartTime)); }
|
|
|
Post by Hippani on Aug 21, 2013 8:16:19 GMT
If you don't know, GetTime() is like GetFrame() except, GetFrame() might return 10 a whole number, e.g. Frame 10 is being show, where as GetTime() could return 10.2036 which is the exact time being show in the movie.
|
|