undoTransform

undoTransform()

This will undo the last call to scale, translate, rotate, transform or setTransform. If there is no transformation to undo, then this will silently do nothing.

/* 
 * Draws multiple circles across the screen,
 * of varying sizes.
 */

onEachFrame() do |delta|
    fill( :green )
    setColor( :white )
    
    translate( 0, getScreenHeight()*0.6 )
    
    10.times() do |i|
        scale( 3 * (i/10) )
        
        fillCircle( 0, 0, 20, true )
        
        undoTransform()
        
        translate( 65, 0 )
    end
end

This includes undoing calls to 'transform' and 'setTransform'.

See also

clearTransforms