x_position and y_position
In OSL you can also read the position of the draw cursor as x and y co-ordinates. They are normalised to the center of the current frame/window based on the current context that the draw cursor is acting in.
set_x 0
change_x 10
log x_position
// 10This allows you to save the position of the cursor to return to later, for example:
// go somewhere random
goto random(-100, 100) random(-100, 100)
// save the random position
x = x_position
y = y_position
// go somewhere random
goto random(-100, 100) random(-100, 100)
// return to the original position
goto x yThese variables are accessible in every context and cannot be overwritten with other data.
x_position
returns the current position of the draw cursor on the x axis
y_position
returns the current position of the draw cursor on the y axis
Last updated