Increasing animation speed

Folks,

As part of a preloader I have a 19 frame movieclip of a 3d star rotating created in swift 3D, it rotates above a normal load bar that shows progress. Currently the star is a separate clip from the loadbar and just rotates as the movie loads, how can I tie the two in together so that the rotation speed of the star gets faster as the movie loads. I have an idea how to do this using tweens but because the star is not animated using tweens, swift generates 19 different frames I’m a bit stuck.

Any help as usual greatly appreciated.

Mhunki

i’d go for something like:


  var t=_root.star;
  var num = 0;
  t.num += Math.round(percentloaded/10);  // you will have to supply the percent loaded variable
  if (num>19) {num -= 19}
  t.gotoAndPlay(num)

Run that on your preloader loop, and it will rotate the star faster for every 10% that’s loaded.

Now, I could be totally wrong here, but I think that would work. That’s how I’d do it, anyway.

Well I tried this

onClipEvent (load) {
this.stop();
var t= _root.star
var num = 0;
loadedbytes = _root.getBytesLoaded();
t.num += Math.round(loadedbytes/10);
if (num>19) {num -= 19}
t.gotoAndPlay(num)
}

Animation plays, but smoothly, doesn’t accelerate.

where you have GetBytesLoaded, you should have a percentage of the total loaded so far.

I can’t remember the AS for it off the top of my head though.

but basically, it should be:

loadedbytes = totalsize/loaded so far

oops!

also,

t.num += Math.round(loadedbytes/10);

should be

num += Math.round(loadedbytes/10);

my bad :frowning:

Even so, feeding the GetBytesLoaded variable into that would produce unexpected results. The number you use should be in the range 0-100. (ie. a percentage)

If I remember, I’ll see if I can knock out an example when I get home to my lair.

Well, I tried this, still progressing as a normal animation though.

onClipEvent (load) {
var t= _root.star
var num = 0;
loadedbytes = _root.getBytesLoaded();
totalbytes = _root.getBytesTotal();
percent = _root.getBytesLoaded*100/_root.getBytesTotal
num += Math.round(percent/10);
if (num>19) {num -= 19}
t.gotoAndPlay(num)
}

thanks for your help btw

Hi
I am not a perfectionsist in Flash nor I did not get the swift 3D but I have some suggestion, hope it might help u.

Now u said u have a loader which I am supposing that it is a small animation clip which changes as it enter each frame. Now I understand that you want the star to move quickly as this loader proceeds furthur. So as the loader moves ahead capture the frame number and give that to the star. As the frame number increases set the frame rate.
Example:
Now loader is in 1st keyframe. send frame number to star movieclip. say star frame rate is 1 fps. now when loader moves to 2nd frame keep sending the frame number value to star and set the frame rate of star to say 2fps now. Continue this as far as u want.

Now I am not sure whether I really answered your question but this is what I understood, If I am wrong please let me know

sapna

OK, try this then:


onClipEvent(load) {
 var t= _root.star
 var num = 0;
 totalbytes = _root.getBytesTotal();
}
onClipEvent(EnterFrame) {
 loadedbytes = _root.getBytesLoaded();
 percent = _root.getBytesLoaded*100/_root.getBytesTotal
 num += Math.round(percent/10);
 if (num>19) {num -= 19}
 t.gotoAndPlay(num)
}

you had all the code in a ‘load’ function, but the second part should be in an EnterFrame function. I should have made this clearer.

If it still doesn’t work, is there any chance you could post up the .fla?