Difference between revisions of "Image.rotate"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "<c>Image.rotate</c> sets the image to be drawn at 90 degree increments. All other degree values will be ignored. Positive or negative values as well as those that fall o...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<c>[[Image]].rotate</c> sets the image to be drawn at 90 degree increments.  All other degree values will be ignoredPositive or negative values as well as those that fall outside of 0 to 360 are valid so long as they are increments of 90 degrees.
+
<c>[[Image]].rotate</c> rotates an image in memory, in 90 degree increments.  All other degree values will print an error and have no effect on the imageValues that fall outside of 0 to 360 are valid so long as they are increments of 90 degrees.
  
 
=== Arguments ===
 
=== Arguments ===
Line 7: Line 7:
 
! Parameter Name !! Type !! Default Value !! Meaning
 
! Parameter Name !! Type !! Default Value !! Meaning
 
|-
 
|-
| ''degrees'' || number || 90 || rotates the image by 90 degree increments
+
| ''degrees'' || number || 90 || amount of counter-clockwise rotation to apply
 
|}  
 
|}  
  
Line 13: Line 13:
  
 
<ms>img = file.loadImage("/sys/pics/Wumpus.png")
 
<ms>img = file.loadImage("/sys/pics/Wumpus.png")
img.rotate(180)</ms>
+
img.rotate -90
 +
view img</ms>
 +
 
 +
After running the above code, <c>img</c> refers to a version of the standard Wumpus image that has been rotated 90° to the right.
  
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]
 
[[Category:Soda]]
 
[[Category:Soda]]

Latest revision as of 14:21, 18 January 2025

Image.rotate rotates an image in memory, in 90 degree increments. All other degree values will print an error and have no effect on the image. Values that fall outside of 0 to 360 are valid so long as they are increments of 90 degrees.

Arguments

Parameter Name Type Default Value Meaning
degrees number 90 amount of counter-clockwise rotation to apply

Example

img = file.loadImage("/sys/pics/Wumpus.png")
img.rotate -90
view img

After running the above code, img refers to a version of the standard Wumpus image that has been rotated 90° to the right.