Rotate

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

rotate(node_id, degrees)
rotate(node_id, degrees, anchor_x, anchor_y, anchor_z)

rotate is used to rotate an image, txt or canvas object. The object will be rotated around the center of the object, unless a custom anchor point is provided.

Return value

This function won't return a value.

Arguments

# Argument Type Description
1 node_id ID Node identifier. This number can be obtained by calling functions like img_add, txt_add or canvas_add.
2 degrees Number Number of degrees to rotate the object to. This value may be larger than 360, the modulus will be used in that case.
3 anchor_x Number (Optional) Rotate around this X coordinate.
4 anchor_y Number (Optional) Rotate around this Y coordinate.
5 anchor_z Number (Optional) Rotate around this Z coordinate.

Example

-- Load and display text and images
myimage1 = img_add_fullscreen("myimage1.png")

-- Rotate myimage1 to 90 degrees
rotate(myimage1, 90 )

-- This will also rotate the image to 90 degrees (450-360)
rotate(myimage1, 450)