tan

.tan()

Returns the tangent of this number.

This value is taken as being a radian.

val = angle.tan()

.tan( min, max )

The tangent of this value is found, and then multiplied against the min/max given. The min/max describe a range for the tangent to be within, and the tangent of this number is multiplied against that.

The min and max do not set the upper bounds, but are more of a multiplier to increase or decrease the natural range of the tangent.

Advanced Example

Draws neon snakes moving in a sandtimer outline.

angle = 0.toRadians()

onEachFrame() do |delta|
    fill( :black )
    
    angle = angle + delta/30
    
    setColor( :pink )
    setBlend( :add )
    
    125.times( 0.8 ) do |i|
        angle2 = angle + i.toRadians()
        
        x = getScreenWidth()/2 + 200*angle2.sin()
        y = getScreenHeight()/2 + 50*angle2.tan()
        
        setColor( :pink, 0.25 )
        fillCircle( x, y, 36, true )
        
        setColor( :white, 0.15 )
        fillCircle( x, y, 5, true )
    end
end

See also

cos - sin - atan - atan2