Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Randomly rotate layer in specific increments

Guest
Mar 08, 2010 Mar 08, 2010

The random(x) expression is simple enough to randomly rotate a layer to any angle, but what if I want that angle to be to the nearest 45 degrees? So my layer would randomly rotate to any of the following angles: 0, 45, 90, 135, 180, 225, 270, 315, or 360 degrees.  Thanks, Jim

TOPICS
Expressions
4.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 09, 2010 Mar 09, 2010

This should give you what you're looking for:

Math.floor(random(8))*45

I didn't include 360 because that's the same as 0, but if you want it, just change the 8 to a 9.

Dan

Translate
Community Expert ,
Mar 09, 2010 Mar 09, 2010

This should give you what you're looking for:

Math.floor(random(8))*45

I didn't include 360 because that's the same as 0, but if you want it, just change the 8 to a 9.

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 09, 2010 Mar 09, 2010
LATEST

Dan, thank you for your help! Really appreciate the tip. Best, Jim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines