Oxoscript turns into NanoPy - more infos

Math functions

pow

  pow(a:float, b:float)->float

Calculates the power (b) raised to the base number (a).

c = pow(a, b) # c = a^b

noise3D

  noise3D(x:float, y:float, z:float)->float

Returns a pseudo random value using the Perlin noise algorithm.

noise2D

  noise2D(x:float, y:float)->float

Returns a pseudo random value using the Perlin noise algorithm.

noise

  noise(x:float)->float

Returns a pseudo random value using the Perlin noise algorithm.

toFloat

  toFloat(a:long)->float

Converts an int number to a float number.

toInt

  toInt(a:float)->long

Converts a float number to an int type.

randomSeed

  randomSeed(seed:int)

Initializes the pseudo-random number generator with the int parameter passed as seed.

ms = getMillis()
randomSeed(ms)
random()

deg

  deg(rad:float)->float

Converts a value in radians to degrees.

rad

  rad(deg:float)->float

Converts a value in degree measure to radians.

atan

  atan(rad:float)->float

Calculates the arc tangent value of the radian parameter.

s = atan(PI)

acos

  acos(rad:float)->float

Calculates the arc cosine value of the radian parameter.

s = acos(PI)

asin

  asin(rad:float)->float

Calculates the arc sine value of the radian parameter.

s = asin(PI)

tan

  tan(rad:float)->float

Calculates the Tanges value of the Radiant parameter.

t = tan(PI)

random

  random(min:int,max:int)->int

Generates a random value between min and max (without max).

for i in 10:
    x = random(0,240)
    y = random(0,240)
    drawCircle(x,y,20)
update()

Note:
The upper number (max) is not included. So for a dice between 1 and 6, random(1, 6+1) must be used.

round

  round(n:float)->float

Rounds the value n to the integer value.

exp

  exp(n:float)->float

Exponential function:

e^n
e ~2.718...

log

  log(n:float)->float

Calculates the natural logarithm of n.

a = e^x
x = log a

map

  map(v:float,start1:float,stop1:float,start2:float,stop2:float)->float

Converts a value v of a value range start1/stop1 to the value range start2/stop2.

v = map(50,0,100,0,255) # 128

abs

  abs(a:float)->float

Calculates the absolute value of the number a.

a = abs(-1) # 1

lerp

  lerp(a:float,b:float,t:float t)->float

Calculates the linear interpolation between a and b for parameter t (or extrapolation if t is outside the range [0,1]).

floor

  floor(a:float)->float

Returns the largest integer that is less than or equal to x (i.e.: rounds down to the nearest integer).

ceil

  ceil(a:float)->float

Returns the smallest integer that is greater than or equal to x (i.e.: rounds up to the nearest integer).

max

  max(a:float,b:float)->float

Returns the higher value of the two numbers a and b.

c = max(100,200) # 200

min

  min(a:float,b:float)->float

Returns the lower value of the two numbers a and b.

c = min(100,200) # 100

cos

  cos(rad:float)->float

Calculates the Cosinuns value of the Radiant parameter.

c = cos(PI)

sqrt

  sqrt(a:float)->float

Calculates the square root of a.

b = sqrt(16)

sin

  sin(rad:float)->float

Calculates the sine value of the radian parameter.

s = sin(PI)

avg

  avg(a:float,b:float)->float

Returns the average of two numbers.

a = avg(100,200) # = 150