A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Random rotation...

  1. #1
    Senior Member
    Join Date
    Jun 2001
    Posts
    219

    Random rotation...

    I've got a movie clip animation and I want it to start at a random rotation between 0 and 360 degrees.

    I don't want it to continue to rotate, but just start the animation rotated anywhere between 0 and 360 degrees.

    Can anyone tell me how to do that?

    Thanks.

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    movieClipName._rotation=random(360)+1;

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Senior Member
    Join Date
    Jun 2001
    Posts
    219
    Thanks Pellepiano!

    How could I make it so it just rotates between 90 and 180 degrees? Would that be possible?

    Thanks again!

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Then it could not start randomly between 0 and 360, right?

    So you just need a rotation from 90 to 180?

    Cant you just tween the movieclip rotation then?

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Senior Member
    Join Date
    Jun 2001
    Posts
    219
    Sorry Pellepiano, I meant, start randomly between 90 and 180 degrees. Sorry about that.

  6. #6
    Modulator Katnap Kaos's Avatar
    Join Date
    Nov 2003
    Location
    A shoebox outside of SM Megamall
    Posts
    149

    Try This

    This should work if you put it into the actual MC.


    code:

    onClipEvent(load){
    this._rotation = random(90)+90;
    }

    Last edited by Katnap Kaos; 12-23-2004 at 05:16 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center