API Reference

Every Lua function at your fingertips. Search, browse, and learn the complete Tiny API.

std std.all(table)

Iterate over values of a table. - If you want to iterate over keys, use `pairs(table)`. - If you want to iterate over index, use `ipairs(table)`. - If you want to iterate in reverse, use `rpairs(table)`.

Parameters
table table
std std.append(source, dest)

Append *all values* from the table `source` to the table `dest`.

Parameters
source table
dest table
function _draw()
    gfx.cls()
    local src = {1, 2, 3}
    local dst = {4, 5}
    local result = append(src, dst)
    for k,v in ipairs(result) do
        print(v, (k + 1) * 8, 8) 
    end
end
function _draw() gfx.cls() local src = {1, 2, 3} local dst = {4, 5} local result = append(src, dst) for k,v in ipairs(result) do print(v, (k + 1) * 8, 8) end end
std std.merge(source, dest)

Add *all key/value* from the table `source` to the table `dest`.

Parameters
source table
dest table
function _draw()
    gfx.cls()
    local src = {x = 1, y = 2, z = 3}
    local dst = {a = 4, b = 5}
    local result = merge(src, dst)
    local index = 1
    for k,v in pairs(result) do
        print(k..":"..v , index * 4 * 8, 8)
        index = index + 1
    end
end
function _draw() gfx.cls() local src = {x = 1, y = 2, z = 3} local dst = {a = 4, b = 5} local result = merge(src, dst) local index = 1 for k,v in pairs(result) do print(k..":"..v , index * 4 * 8, 8) index = index + 1 end end
std std.new(class, default)

Create new instance of a class by creating a new table and setting the metatable. It allow to create kind of Object Oriented Programming.

Parameters
class table
default table
local Player = {
    x = 128,
    y = 128,
    color = 8
}

function Player:draw()
    shape.rectf(self.x, self.y, 10, 10, self.color)
end

function _init()
    -- create a new player
    player = new(Player)
    -- create a new player with default vaules
    player2 = new(Player, {x = 200, y = 200, color = 9})
end

function _draw()
    gfx.cls()
    player:draw() -- call the draw method on the player instance.
    player2:draw() -- call the draw method on the player2 instance.
end
local Player = { x = 128, y = 128, color = 8 } function Player:draw() shape.rectf(self.x, self.y, 10, 10, self.color) end function _init() -- create a new player player = new(Player) -- create a new player with default vaules player2 = new(Player, {x = 200, y = 200, color = 9}) end function _draw() gfx.cls() player:draw() -- call the draw method on the player instance. player2:draw() -- call the draw method on the player2 instance. end
std std.print(str, x, y, color)

Print on the screen a string. Default color is the closest to white (#FFFFFF) in the palette. To ensure visibility, use a color that contrasts with the cls() background color.

Parameters
str string
x number
y number
color number
function _draw()
    gfx.cls()
    -- every character is a sprite 4x4 pixels.
    print("hello")
    print("world", 10, 8)
    print("how", 10, 16, 4)
    print("are", 28, 16, 5)
    print("you", 46, 16, 6)
    print("...", 64, 16, math.rnd(10))
end
function _draw() gfx.cls() -- every character is a sprite 4x4 pixels. print("hello") print("world", 10, 8) print("how", 10, 16, 4) print("are", 28, 16, 5) print("you", 46, 16, 6) print("...", 64, 16, math.rnd(10)) end
std std.rpairs(table)

Iterate over values of a table in reverse order. The iterator return an index and the value. The method is useful to remove elements from a table while iterating on it.

Parameters
table table
function _draw()
    gfx.cls()
    local data = {
        { name = "riri" },
        { name = "fifi" },
        { name = "loulou" }
    }

    local y = 0
    for index, key in rpairs(data) do
        print(index .. " - " .. key.name, 10, y)
        y = y + 10
    end
end
function _draw() gfx.cls() local data = { { name = "riri" }, { name = "fifi" }, { name = "loulou" } } local y = 0 for index, key in rpairs(data) do print(index .. " - " .. key.name, 10, y) y = y + 10 end end
console console.log(str)

Log a message into the console.

Parameters
str any
function _update()
    console.log("hello from the console")
    console.log("Log a value: ", tiny.frame)
    console.log("Log a table: ", ctrl.touch())
end
  
function _draw()
    gfx.cls()
    -- draw the mouse position.
    local pos = ctrl.touch()

    shape.line(pos.x - 2, pos.y, pos.x + 2, pos.y, 3)
    shape.line(pos.x, pos.y - 2, pos.x, pos.y + 2, 3) 
end
function _update() console.log("hello from the console") console.log("Log a value: ", tiny.frame) console.log("Log a table: ", ctrl.touch()) end function _draw() gfx.cls() -- draw the mouse position. local pos = ctrl.touch() shape.line(pos.x - 2, pos.y, pos.x + 2, pos.y, 3) shape.line(pos.x, pos.y - 2, pos.x, pos.y + 2, 3) end
ctrl ctrl.pressed(key)

Return true if the key was pressed during the last frame. When called without argument, return a table of all keys pressed during the last frame (values matching the keys lib), or false if no key was pressed. If you need to check that the key is still pressed, see `ctrl.pressing` instead.

Parameters
key number
local percent_a = 1
local percent_b = 1

function _update()
    percent_a = math.min(percent_a + 0.05, 1)
    percent_b = math.min(percent_b + 0.05, 1)

    if ctrl.pressed(keys.space) then
        percent_a = 0
    end
    
    if ctrl.pressing(keys.space) then
        percent_b = 0
    end

    local offset_a = juice.powIn2(0, 8, percent_a)
    local offset_b = juice.powIn2(0, 8, percent_b)

    gfx.cls()
    shape.rectf(64, 128 - 16, 32, 32, 7)
    shape.rectf(64, 128 - 32 + offset_a, 32, 32, 8)

    shape.rectf(32 + 128, 128 - 16, 32, 32, 7)
    shape.rectf(32 + 128, 128 - 32 + offset_b, 32, 32, 8)

    print("pressed", 64, 128 + 32)
    print("pressing", 32 + 128, 128 + 32)
end
local percent_a = 1 local percent_b = 1 function _update() percent_a = math.min(percent_a + 0.05, 1) percent_b = math.min(percent_b + 0.05, 1) if ctrl.pressed(keys.space) then percent_a = 0 end if ctrl.pressing(keys.space) then percent_b = 0 end local offset_a = juice.powIn2(0, 8, percent_a) local offset_b = juice.powIn2(0, 8, percent_b) gfx.cls() shape.rectf(64, 128 - 16, 32, 32, 7) shape.rectf(64, 128 - 32 + offset_a, 32, 32, 8) shape.rectf(32 + 128, 128 - 16, 32, 32, 7) shape.rectf(32 + 128, 128 - 32 + offset_b, 32, 32, 8) print("pressed", 64, 128 + 32) print("pressing", 32 + 128, 128 + 32) end
ctrl ctrl.pressing(key)

Return true if the key is still pressed.

Parameters
key number
local percent_a = 1
local percent_b = 1

function _update()
    percent_a = math.min(percent_a + 0.05, 1)
    percent_b = math.min(percent_b + 0.05, 1)

    if ctrl.pressed(keys.space) then
        percent_a = 0
    end
    
    if ctrl.pressing(keys.space) then
        percent_b = 0
    end

    local offset_a = juice.powIn2(0, 8, percent_a)
    local offset_b = juice.powIn2(0, 8, percent_b)

    gfx.cls()
    shape.rectf(64, 128 - 16, 32, 32, 7)
    shape.rectf(64, 128 - 32 + offset_a, 32, 32, 8)

    shape.rectf(32 + 128, 128 - 16, 32, 32, 7)
    shape.rectf(32 + 128, 128 - 32 + offset_b, 32, 32, 8)

    print("pressed", 64, 128 + 32)
    print("pressing", 32 + 128, 128 + 32)
end
local percent_a = 1 local percent_b = 1 function _update() percent_a = math.min(percent_a + 0.05, 1) percent_b = math.min(percent_b + 0.05, 1) if ctrl.pressed(keys.space) then percent_a = 0 end if ctrl.pressing(keys.space) then percent_b = 0 end local offset_a = juice.powIn2(0, 8, percent_a) local offset_b = juice.powIn2(0, 8, percent_b) gfx.cls() shape.rectf(64, 128 - 16, 32, 32, 7) shape.rectf(64, 128 - 32 + offset_a, 32, 32, 8) shape.rectf(32 + 128, 128 - 16, 32, 32, 7) shape.rectf(32 + 128, 128 - 32 + offset_b, 32, 32, 8) print("pressed", 64, 128 + 32) print("pressing", 32 + 128, 128 + 32) end
ctrl ctrl.touch(sprN)

Get coordinates of the current touch/mouse. If the mouse/touch is out-of the screen, the coordinates will be the last mouse position/touch. The function return those coordinates as a table {x, y}. A sprite can be draw directly on the mouse position by passing the sprite number.

Parameters
sprN number
function _draw()
  gfx.cls(2)
  p = ctrl.touch()
  print("coordinates: "..p.x .. "x"..p.y, 1, 1, 4)
  shape.rectf(p.x, p.y, 5,5, p.x + p.y)
end
function _draw() gfx.cls(2) p = ctrl.touch() print("coordinates: "..p.x .. "x"..p.y, 1, 1, 4) shape.rectf(p.x, p.y, 5,5, p.x + p.y) end
ctrl ctrl.touched(touch)

Return the position of the touch (as `{x, y}`)if the screen was touched or the mouse button was pressed during the last frame. `nil` otherwise. The touch can be : - 0: left click or one finger - 1: right click or two fingers - 2: middle click or three fingers If you need to check that the touch/mouse button is still active, see `ctrl.touching` instead.

Parameters
touch number
local circles = {}

function _update()
    local pos = ctrl.touched(0)
    if pos ~= nil then
        table.insert(circles, pos)
    end
end

function _draw()
    gfx.cls()
    local p = ctrl.touch()
    shape.circlef(p.x, p.y, 4, 8)
    for pos in all(circles) do 
        shape.circlef(pos.x, pos.y, 4, 9)
        print("("..pos.x .. ", "..pos.y..")", pos.x + 3, pos.y + 3)
    end
end
local circles = {} function _update() local pos = ctrl.touched(0) if pos ~= nil then table.insert(circles, pos) end end function _draw() gfx.cls() local p = ctrl.touch() shape.circlef(p.x, p.y, 4, 8) for pos in all(circles) do shape.circlef(pos.x, pos.y, 4, 9) print("("..pos.x .. ", "..pos.y..")", pos.x + 3, pos.y + 3) end end
ctrl ctrl.touching(touch)

Return the position of the touch (as `{x, y}`)if the screen is still touched or the mouse button is still pressed. `nil` otherwise. The touch can be : - 0: left click or one finger - 1: right click or two fingers - 2: middle click or three fingers

Parameters
touch number
function _draw()
    gfx.cls()
    local p = ctrl.touch()
    shape.circlef(p.x, p.y, 4, 8)

    local start = ctrl.touching(0)
    if start ~= nil then
        local pos = ctrl.touch()
        shape.line(start.x, start.y, pos.x, pos.y, 1)
        print("("..start.x .. ", "..start.y..")", start.x, start.y)
        print("("..pos.x .. ", "..pos.y..")", pos.x, pos.y)
    end
end
function _draw() gfx.cls() local p = ctrl.touch() shape.circlef(p.x, p.y, 4, 8) local start = ctrl.touching(0) if start ~= nil then local pos = ctrl.touch() shape.line(start.x, start.y, pos.x, pos.y, 1) print("("..start.x .. ", "..start.y..")", start.x, start.y) print("("..pos.x .. ", "..pos.y..")", pos.x, pos.y) end end
floppy floppy.get(name)

Load and get the content of the file name

Parameters
name string
floppy floppy.put(name, content)

Save the content into a local file, on desktop or in the local storage on the web platform.

Parameters
name string
content any
gfx gfx.camera(x, y)

Move the game camera.

Parameters
x number
y number
local x = 0
local y = 0

function _update()
    if ctrl.pressing(keys.left) then
        x = x - 0.5
    elseif ctrl.pressing(keys.right) then
        x = x + 0.5
    end

    if ctrl.pressing(keys.up) then
        y = y - 0.5
    elseif ctrl.pressing(keys.down) then
        y = y + 0.5
    end
    gfx.camera(math.floor(x), math.floor(y))
end

function _draw()
    gfx.cls(2)
    for x = 0 - 64, 256 + 64, 16 do
        for y = 0 - 64, 256 + 64, 16 do
            shape.line(x - 2, y, x + 2, y, 9)
            shape.line(x, y - 2, x, y + 2, 9)
        end
    end
    print("camera: ("..x..", "..y..")", 6, 6)
    
    shape.rect(0, 0, 256, 256, 1)
end
local x = 0 local y = 0 function _update() if ctrl.pressing(keys.left) then x = x - 0.5 elseif ctrl.pressing(keys.right) then x = x + 0.5 end if ctrl.pressing(keys.up) then y = y - 0.5 elseif ctrl.pressing(keys.down) then y = y + 0.5 end gfx.camera(math.floor(x), math.floor(y)) end function _draw() gfx.cls(2) for x = 0 - 64, 256 + 64, 16 do for y = 0 - 64, 256 + 64, 16 do shape.line(x - 2, y, x + 2, y, 9) shape.line(x, y - 2, x, y + 2, 9) end end print("camera: ("..x..", "..y..")", 6, 6) shape.rect(0, 0, 256, 256, 1) end
gfx gfx.clip(x, y, width, height)

Clip the draw surface (ie: limit the drawing area).

Parameters
x number
y number
width number
height number
function _init()
  c = {}
  for i=1,100 do
    table.insert(c, {x=math.rnd(256), y=math.rnd(256), c = math.rnd(1,12)})
end

end
function _draw()
  gfx.cls()
  local pos = ctrl.touch()
  -- set a clip area to crop circles
  gfx.clip(pos.x - 20, pos.y - 20, 40, 40)
  for circle in all(c) do
    shape.circlef(circle.x, circle.y, 10, circle.c)
  end
end
function _init() c = {} for i=1,100 do table.insert(c, {x=math.rnd(256), y=math.rnd(256), c = math.rnd(1,12)}) end end function _draw() gfx.cls() local pos = ctrl.touch() -- set a clip area to crop circles gfx.clip(pos.x - 20, pos.y - 20, 40, 40) for circle in all(c) do shape.circlef(circle.x, circle.y, 10, circle.c) end end
gfx gfx.cls(color)

Clear the screen. When called without arguments, clears with the color closest to black (#000000) in the palette. To ensure visibility, always draw with a color index DIFFERENT from the cls() color.

Parameters
color number
function _draw()
    if ctrl.pressed(keys.space) then
       gfx.cls()
    end

    print("Press space to clear the screen") 
    local pos = ctrl.touch()
    shape.circlef(pos.x, pos.y, 4, math.rnd())
end
function _draw() if ctrl.pressed(keys.space) then gfx.cls() end print("Press space to clear the screen") local pos = ctrl.touch() shape.circlef(pos.x, pos.y, 4, math.rnd()) end
gfx gfx.dither(pattern)

Apply a dithering pattern on every new draw call. The pattern is using the bits value of a 2 octet value. The first bits is the one on the far left and represent the pixel of the top left of a 4x4 matrix. The last bit is the pixel from the bottom right of this matrix.

Parameters
pattern number Dither pattern. For example: 0xA5A5 or 0x3030
function _draw()
    gfx.cls()
    gfx.dither()
    shape.circlef(30, 30, 30, 2)
    gfx.dither(0xA5A5) -- set a dithering pattern
    shape.circlef(50, 50, 30, 3)
    gfx.dither(0x0842) -- set another dithering pattern
    shape.circlef(70, 70, 30, 2)
end
function _draw() gfx.cls() gfx.dither() shape.circlef(30, 30, 30, 2) gfx.dither(0xA5A5) -- set a dithering pattern shape.circlef(50, 50, 30, 3) gfx.dither(0x0842) -- set another dithering pattern shape.circlef(70, 70, 30, 2) end
gfx gfx.draw_mode(mode)

Switch to another draw mode. - 0: default. - 1: drawing with transparent (ie: can erase part of the screen) - 2: drawing a stencil that will be use with the next mode - 3: drawing using a stencil test (ie: drawing only in the stencil) - 4: drawing using a stencil test (ie: drawing everywhere except in the stencil)

Parameters
mode number
local draw_stencil = 2
local draw_inside_stencil = 3
local draw_outside_stencil = 4

local outside = false

function _draw()
    if ctrl.pressed(keys.space) then
        outside = not outside
    end

    gfx.cls(3)

    gfx.draw_mode(draw_stencil)

    -- draw a circle in the middle of the screen
    shape.circlef(128, 128, 64, 1)
    
    if outside then
        gfx.draw_mode(draw_inside_stencil)
    else
        gfx.draw_mode(draw_outside_stencil)
    end
    
    -- draw the sprite sheet. only in the circle
    spr.sdraw()
    gfx.draw_mode()
end
local draw_stencil = 2 local draw_inside_stencil = 3 local draw_outside_stencil = 4 local outside = false function _draw() if ctrl.pressed(keys.space) then outside = not outside end gfx.cls(3) gfx.draw_mode(draw_stencil) -- draw a circle in the middle of the screen shape.circlef(128, 128, 64, 1) if outside then gfx.draw_mode(draw_inside_stencil) else gfx.draw_mode(draw_outside_stencil) end -- draw the sprite sheet. only in the circle spr.sdraw() gfx.draw_mode() end
gfx gfx.pal(a, b)

Change a color from the palette to another color.

Parameters
a number
b number
function _draw()
    gfx.cls()
    print("example", 10, 10, 2) -- print using the color index 2
    gfx.pal(2, 3) -- switch the text color to another color
    print("example", 10, 20, 2) -- print using the color index 2
    gfx.pal() -- reset the palette
    print("example", 10, 30, 2) -- print using the color index 2
end
function _draw() gfx.cls() print("example", 10, 10, 2) -- print using the color index 2 gfx.pal(2, 3) -- switch the text color to another color print("example", 10, 20, 2) -- print using the color index 2 gfx.pal() -- reset the palette print("example", 10, 30, 2) -- print using the color index 2 end
gfx gfx.pget(x, y)

Get the color index at the coordinate (x,y).

Parameters
x number
y number
function _draw()
   gfx.cls()
   local index = 0
   for x=0, 240, 16 do
     for y=0, 240, 16 do
        shape.rectf(x, y, 16, 16, index)
        index = index + 1
     end
   end

   local pos = ctrl.touch()
   local color = gfx.pget(pos.x, pos.y)
   if color ~= nil then 
     shape.rectf(0, 0, 80, 6, 13)
     print("color index: "..color)
   end


   shape.circlef(pos.x - 2, pos.y - 2, 4, 0)
end
function _draw() gfx.cls() local index = 0 for x=0, 240, 16 do for y=0, 240, 16 do shape.rectf(x, y, 16, 16, index) index = index + 1 end end local pos = ctrl.touch() local color = gfx.pget(pos.x, pos.y) if color ~= nil then shape.rectf(0, 0, 80, 6, 13) print("color index: "..color) end shape.circlef(pos.x - 2, pos.y - 2, 4, 0) end
gfx gfx.pset(x, y, color)

Set the color index at the coordinate (x,y).

Parameters
x number
y number
color number
function _draw()
   local pos = ctrl.touching(0)
   if pos ~= nil then
      -- set the pixel with the color 9 when the mouse is pressed
      local p = ctrl.touch()
      gfx.pset(p.x, p.y, 9)
   end
end
function _draw() local pos = ctrl.touching(0) if pos ~= nil then -- set the pixel with the color 9 when the mouse is pressed local p = ctrl.touch() gfx.pset(p.x, p.y, 9) end end
gfx gfx.to_sheet(sheet)

Transform the current frame buffer into a spritesheeet. - If the index of the spritesheet already exist, the spritesheet will be replaced - If the index of the spritesheet doesn't exist, a new spritesheet at this index will be created - If the index of the spritesheet is negative, a new spritesheet will be created at the last positive index.

Parameters
sheet any
function _draw()
    gfx.cls(1)
    -- draw a transparent circle (like a hole)
    shape.circlef(64, 128, 20, 0)
    -- keep the result as spritesheet 0
    gfx.to_sheet(0)

    gfx.cls(1)
    -- draw some circles
    shape.circlef(64, 108, 20, 8)
    shape.circlef(44, 128, 20, 9)
    shape.circlef(64, 148, 20, 10)
    shape.circlef(84, 128, 20, 11)

    -- draw over the circles
    -- the mask generated before.
    spr.sheet(0)
    spr.sdraw()
end
function _draw() gfx.cls(1) -- draw a transparent circle (like a hole) shape.circlef(64, 128, 20, 0) -- keep the result as spritesheet 0 gfx.to_sheet(0) gfx.cls(1) -- draw some circles shape.circlef(64, 108, 20, 8) shape.circlef(44, 128, 20, 9) shape.circlef(64, 148, 20, 10) shape.circlef(84, 128, 20, 11) -- draw over the circles -- the mask generated before. spr.sheet(0) spr.sdraw() end
juice juice.bounce(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.bounceIn(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.bounceOut(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.circle(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.circleIn(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.circleOut(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.elastic(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.elasticIn(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.elasticOut(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.exp10(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.exp5(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.expIn10(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.expIn5(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.expOut10(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.expOut5(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.linear(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.pow2(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.pow3(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.pow4(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.pow5(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.powIn2(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.powIn3(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.powIn4(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.powIn5(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.powOut2(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.powOut3(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.powOut4(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.powOut5(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.sine(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.sineIn(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.sineOut(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.swing(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.swingIn(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
juice juice.swingOut(start, end, progress)

Parameters
start number
end number
progress number Progress value. Needs to be between 0 (start of the interpolation) and 1 (end of the interpolation)
local center_x = 256 * 0.5
local center_y = 256 * 0.5
local width = 128

function _update()
    gfx.cls()
    shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2)
    shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2)

    
    for x = 0, width, 2 do
        local y = juice.##function##(0, 128, x / width)
        gfx.pset(
            center_x - 64 + x, center_y + 64 - y, 3
        )
    end

    local percent = (tiny.frame % 100) / 100
    local x = width * percent
    local y = juice.##function##(0, 128, percent)
    shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7)
    shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7)
    shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7)
    local name = "##function##"
    print(name, center_x - #name * 4 * 0.5, center_y + 92)
end

local center_x = 256 * 0.5 local center_y = 256 * 0.5 local width = 128 function _update() gfx.cls() shape.line(center_x - 64, center_y + 64, center_x + 64, center_y + 64, 2) shape.line(center_x + 64, center_y - 64, center_x + 64, center_y + 64, 2) for x = 0, width, 2 do local y = juice.##function##(0, 128, x / width) gfx.pset( center_x - 64 + x, center_y + 64 - y, 3 ) end local percent = (tiny.frame % 100) / 100 local x = width * percent local y = juice.##function##(0, 128, percent) shape.circlef(center_x - 64 + x, center_y + 64 - y, 4, 7) shape.rectf(center_x - 64 + x - 2, center_y + 64 + 8, 4, 4, 7) shape.rectf(center_x + 70, center_y + 64 - y, 4, 4, 7) local name = "##function##" print(name, center_x - #name * 4 * 0.5, center_y + 92) end
map map.cflag(cx, cy, layer)

Get the flag from a tile, using cell coordinates.

Parameters
cx number
cy number
layer any
map map.draw(index)

Draw map tiles on the screen.

Parameters
index any
map map.entities(a)

Table with all entities by type (ie: `map.entities["player"]`). ``` local entities = map.entities() local players = entities["Player"] for entity in all(players) do shape.rectf(entity.x, entity.y, entity.width, entity.height, 8) -- display an entity using a rectangle end [...] entity.fields -- access custom field of the entity ```

Parameters
a any
map map.flag(x, y, layer)

Get the flag from a tile, using screen coordinates.

Parameters
x number
y number
layer any
map map.from(arg1, arg2)

Convert cell coordinates cx, cy into map screen coordinates x, y.

Parameters
arg1 any
arg2 any
map map.layer(layer_index)

Get the list of layers from the actual level.

Parameters
layer_index any
map map.level(level)

Set the current level to use.

Parameters
level any
map map.to(x, y)

Convert screen coordinates x, y into map cell coordinates {cx, cy}. For example, coordinates of the player can be converted to cell coordinates to access the flag of the tile matching the player coordinates.

Parameters
x any
y any
math math.atan2(y, x)

Calculate the angle in radians between the positive x-axis and the point (x, y).

Parameters
y number
x number
math math.clamp(a, value, b)

Clamp the value between 2 values.

Parameters
a number The minimum value.
value number The value to be clamped.
b number The maximum value.
function _draw()
    gfx.cls()
    
    local pos = ctrl.touch()

    local x = math.clamp(60, pos.x, 256 - 60)
    
    gfx.dither(0xA5A5)
    shape.line(64, 129, 256 - 60, 129, 9)
    gfx.dither()
    shape.rect(60, 128, 4, 4, 9)
    shape.rect(256 - 60, 128, 4, 4, 9)
    shape.circlef(pos.x, pos.y, 2, 9)
    shape.circle(x, 129, 2, 8)
end
function _draw() gfx.cls() local pos = ctrl.touch() local x = math.clamp(60, pos.x, 256 - 60) gfx.dither(0xA5A5) shape.line(64, 129, 256 - 60, 129, 9) gfx.dither() shape.rect(60, 128, 4, 4, 9) shape.rect(256 - 60, 128, 4, 4, 9) shape.circlef(pos.x, pos.y, 2, 9) shape.circle(x, 129, 2, 8) end
math math.dst(x1, y1, x2, y2)

Compute the distance between two points.

Parameters
x1 number
y1 number
x2 number
y2 number
function _draw()
    gfx.cls()
    
    local pos = ctrl.touch()
    shape.line(pos.x, pos.y, 128, 128, 3)
    shape.circlef(128, 128, 2, 9)
    shape.circlef(pos.x, pos.y, 2, 9)

    -- midle of the line
    local x = (pos.x - 128) * 0.5
    local y = (pos.y - 128) * 0.5
    
    -- display dst
    local dst = math.dst(128, 128, pos.x, pos.y)
    print("dst: "..dst, 128 + x, 128 + y)
end
function _draw() gfx.cls() local pos = ctrl.touch() shape.line(pos.x, pos.y, 128, 128, 3) shape.circlef(128, 128, 2, 9) shape.circlef(pos.x, pos.y, 2, 9) -- midle of the line local x = (pos.x - 128) * 0.5 local y = (pos.y - 128) * 0.5 -- display dst local dst = math.dst(128, 128, pos.x, pos.y) print("dst: "..dst, 128 + x, 128 + y) end
math math.dst2(x1, y1, x2, y2)

Compute the distance between two points not squared. Use this method to know if an coordinate is closer than another.

Parameters
x1 number
y1 number
x2 number
y2 number
local a = {
    x = 10 + math.rnd(236),
    y = 10 + math.rnd(236)
}

local b = {
    x = 10 + math.rnd(236),
    y = 10 + math.rnd(236)
}

function _draw()
    gfx.cls()
    
    local pos = ctrl.touch()

    if math.dst2(pos.x, pos.y, a.x, a.y) > math.dst2(pos.x, pos.y, b.x, b.y) then
        -- b is closer
        shape.line(pos.x, pos.y, b.x, b.y, 3)
    else
        -- a is closer
        shape.line(pos.x, pos.y, a.x, a.y, 3)
    end
    shape.circlef(a.x, a.y, 2, 9)
    shape.circlef(b.x, b.y, 2, 9)
    shape.circlef(pos.x, pos.y, 2, 9)
end
local a = { x = 10 + math.rnd(236), y = 10 + math.rnd(236) } local b = { x = 10 + math.rnd(236), y = 10 + math.rnd(236) } function _draw() gfx.cls() local pos = ctrl.touch() if math.dst2(pos.x, pos.y, a.x, a.y) > math.dst2(pos.x, pos.y, b.x, b.y) then -- b is closer shape.line(pos.x, pos.y, b.x, b.y, 3) else -- a is closer shape.line(pos.x, pos.y, a.x, a.y, 3) end shape.circlef(a.x, a.y, 2, 9) shape.circlef(b.x, b.y, 2, 9) shape.circlef(pos.x, pos.y, 2, 9) end
math math.perlin(x, y, z)

Perlin noise. The random generated value is between 0.0 and 1.0.

Parameters
x number A value between 0.0 and 1.0.
y number A value between 0.0 and 1.0.
z number A value between 0.0 and 1.0.
function _draw()
    gfx.cls(8)

    gfx.dither(0x0001)
    local x = math.perlin(0.1, 0.2, tiny.frame / 100)
    local y = math.perlin(0.4, 0.5, tiny.frame / 100)
    shape.circlef(x * 256, y * 256, 64, 7)
end
function _draw() gfx.cls(8) gfx.dither(0x0001) local x = math.perlin(0.1, 0.2, tiny.frame / 100) local y = math.perlin(0.4, 0.5, tiny.frame / 100) shape.circlef(x * 256, y * 256, 64, 7) end
math math.rnd(a, b)

Generate random values

Parameters
a number
b number
local value = {}
function _update()
    table.insert(value, math.rnd(126))

    if(#value > 50) then
        table.remove(value, #value)
    end
end

function _draw()
    gfx.cls()
    local y = 0
    for v in all(value) do
        print("rnd: "..v, 4, y)
        y = y + 6
    end
end
local value = {} function _update() table.insert(value, math.rnd(126)) if(#value > 50) then table.remove(value, #value) end end function _draw() gfx.cls() local y = 0 for v in all(value) do print("rnd: "..v, 4, y) y = y + 6 end end
math math.roverlap(rect1, rect2)

Check if two (r)ectangles overlaps.

Parameters
rect1 table Rectangle as a table {x, y, with, height}.
rect2 table Rectangle as a table {x, y, with, height}.
math math.sign(number)

Return the sign of the number: -1 if negative. 1 otherwise.

Parameters
number number
function _draw()
    gfx.cls()
    local cos = math.cos(tiny.t)
    print("cos: "..cos)
    print("sign: "..math.sign(cos), 0, 8)

    shape.line(128, 128, 128 + cos * 128, 128, 9)
end
function _draw() gfx.cls() local cos = math.cos(tiny.t) print("cos: "..cos) print("sign: "..math.sign(cos), 0, 8) shape.line(128, 128, 128 + cos * 128, 128, 9) end
math math.huge

positive infinity value.

math math.pi

value of pi (~3.14)

notes notes.note(note_index)

Get the name of a note regarding the note index (ie: C0 = 0, Cs0 = 1, ...)

Parameters
note_index number
sfx sfx.instrument(a, b)

Access instrument using its index or its name.

Parameters
a any
b any
sfx sfx.save()

Save the actual music in the current sfx file.

sfx sfx.sequence(arg)

Access musical sequence using its index.

Parameters
arg any
sfx sfx.sfx(arg)

Access sfx using its index or its name.

Parameters
arg any
shape shape.circle(centerX, centerY, radius, color)

Draw a circle.

Parameters
centerX number
centerY number
radius number
color number
function _draw()
    gfx.cls()

    -- filled circle
    shape.circlef(20, 20, 20, 4)
    shape.circlef(30, 30, 20, 5)
    shape.circlef(40, 40, 20, 6)
    print("filled circle", 20, 10)

    -- non filled circle
    shape.circle(50, 70, 10, 7)
    shape.circle(60, 80, 10, 8)
    shape.circle(70, 90, 10, 9)
    print("non filled circle", 20, 65)

    shape.circle(80, 120, 15, 10)
    shape.circle(80, 140, 20, 16)
    shape.circle(80, 160, 30, 14)
    print("circle with different radius", 20, 115)

end
function _draw() gfx.cls() -- filled circle shape.circlef(20, 20, 20, 4) shape.circlef(30, 30, 20, 5) shape.circlef(40, 40, 20, 6) print("filled circle", 20, 10) -- non filled circle shape.circle(50, 70, 10, 7) shape.circle(60, 80, 10, 8) shape.circle(70, 90, 10, 9) print("non filled circle", 20, 65) shape.circle(80, 120, 15, 10) shape.circle(80, 140, 20, 16) shape.circle(80, 160, 30, 14) print("circle with different radius", 20, 115) end
shape shape.circlef(centerX, centerY, radius, color)

Draw a filled circle.

Parameters
centerX number
centerY number
radius number
color number
function _draw()
    gfx.cls()

    -- filled circle
    shape.circlef(20, 20, 20, 4)
    shape.circlef(30, 30, 20, 5)
    shape.circlef(40, 40, 20, 6)
    print("filled circle", 20, 10)

    -- non filled circle
    shape.circle(50, 70, 10, 7)
    shape.circle(60, 80, 10, 8)
    shape.circle(70, 90, 10, 9)
    print("non filled circle", 20, 65)

    shape.circle(80, 120, 15, 10)
    shape.circle(80, 140, 20, 16)
    shape.circle(80, 160, 30, 14)
    print("circle with different radius", 20, 115)

end
function _draw() gfx.cls() -- filled circle shape.circlef(20, 20, 20, 4) shape.circlef(30, 30, 20, 5) shape.circlef(40, 40, 20, 6) print("filled circle", 20, 10) -- non filled circle shape.circle(50, 70, 10, 7) shape.circle(60, 80, 10, 8) shape.circle(70, 90, 10, 9) print("non filled circle", 20, 65) shape.circle(80, 120, 15, 10) shape.circle(80, 140, 20, 16) shape.circle(80, 160, 30, 14) print("circle with different radius", 20, 115) end
shape shape.gradient(x, y, width, height, color1, color2, is_horizontal)

Draw a gradient using dithering, only from color c1 to color c2.

Parameters
x number
y number
width number
height number
color1 number
color2 number
is_horizontal boolean
function _draw()
    
 local c1 = 2
 local c2 = 3   

    gfx.cls(c1)
    shape.rectf(0, 256 - 16, 256, 16, c2)
    for x=0,240,16 do
        shape.gradient(x, 16 * math.cos(2 * 3.14 * (x / 256) + tiny.t * 2), 16, 256, c1, c2, false)
    end
      
end
function _draw() local c1 = 2 local c2 = 3 gfx.cls(c1) shape.rectf(0, 256 - 16, 256, 16, c2) for x=0,240,16 do shape.gradient(x, 16 * math.cos(2 * 3.14 * (x / 256) + tiny.t * 2), 16, 256, c1, c2, false) end end
shape shape.line(x0, y0, x1, y1, color)

Draw a line.

Parameters
x0 number
y0 number
x1 number
y1 number
color number
function _draw()
  gfx.cls()
  
  local i =0
  for x =16, 240, 16 do
    for y =16, 240, 16 do
      shape.line(x, y, 256 - x, 256 - y, i)
      i = i + 1
    end
  end
end
function _draw() gfx.cls() local i =0 for x =16, 240, 16 do for y =16, 240, 16 do shape.line(x, y, 256 - x, 256 - y, i) i = i + 1 end end end
shape shape.rect(x, y, width, height, color)

Draw a rectangle.

Parameters
x number
y number
width number
height number
color number
function _draw()
  gfx.cls()

  -- filled rectangle
  print("filled rectangle", 20, 10)
  shape.rectf(20, 20, 20, 20, 4)
  shape.rectf(30, 30, 20, 20, 5)
  shape.rectf(40, 40, 20, 20, 6)

  print("non filled rectangle", 20, 65)
  -- non filled rectangle
  shape.rect(50, 70, 20, 20, 7)
  shape.rect(60, 80, 20, 20, 8)
  shape.rect(70, 90, 20, 20, 9)

  print("rectangle with different width", 20, 115)
  shape.rect(20, 120, 30, 20, 10)
  shape.rect(20, 140, 40, 20, 12)
  shape.rect(20, 160, 60, 20, 13)

end
function _draw() gfx.cls() -- filled rectangle print("filled rectangle", 20, 10) shape.rectf(20, 20, 20, 20, 4) shape.rectf(30, 30, 20, 20, 5) shape.rectf(40, 40, 20, 20, 6) print("non filled rectangle", 20, 65) -- non filled rectangle shape.rect(50, 70, 20, 20, 7) shape.rect(60, 80, 20, 20, 8) shape.rect(70, 90, 20, 20, 9) print("rectangle with different width", 20, 115) shape.rect(20, 120, 30, 20, 10) shape.rect(20, 140, 40, 20, 12) shape.rect(20, 160, 60, 20, 13) end
shape shape.rectf(x, y, width, height, color)

Draw a filled rectangle.

Parameters
x number
y number
width number
height number
color number
function _draw()
  gfx.cls()

  -- filled rectangle
  print("filled rectangle", 20, 10)
  shape.rectf(20, 20, 20, 20, 4)
  shape.rectf(30, 30, 20, 20, 5)
  shape.rectf(40, 40, 20, 20, 6)

  print("non filled rectangle", 20, 65)
  -- non filled rectangle
  shape.rect(50, 70, 20, 20, 7)
  shape.rect(60, 80, 20, 20, 8)
  shape.rect(70, 90, 20, 20, 9)

  print("rectangle with different width", 20, 115)
  shape.rect(20, 120, 30, 20, 10)
  shape.rect(20, 140, 40, 20, 12)
  shape.rect(20, 160, 60, 20, 13)

end
function _draw() gfx.cls() -- filled rectangle print("filled rectangle", 20, 10) shape.rectf(20, 20, 20, 20, 4) shape.rectf(30, 30, 20, 20, 5) shape.rectf(40, 40, 20, 20, 6) print("non filled rectangle", 20, 65) -- non filled rectangle shape.rect(50, 70, 20, 20, 7) shape.rect(60, 80, 20, 20, 8) shape.rect(70, 90, 20, 20, 9) print("rectangle with different width", 20, 115) shape.rect(20, 120, 30, 20, 10) shape.rect(20, 140, 40, 20, 12) shape.rect(20, 160, 60, 20, 13) end
shape shape.triangle(x1, y1, x2, y2, x3, y3, color)

Draw a triangle using the coordinates of (x1, y1), (x2, y2) and (x3, y3) and color.

Parameters
x1 number
y1 number
x2 number
y2 number
x3 number
y3 number
color number
function tri(f, fill)
  local x1 = 128 + math.cos(f) * 64
  local y1 = 128 + math.sin(f) * 64

  local x2 = 128 + math.cos(f + math.pi * 1/3) * 64
  local y2 = 128 + math.sin(f + math.pi * 1/3) * 64

  local x3 = 128 + math.cos(f+ math.pi * 2/3) * 64
  local y3 = 128 + math.sin(f +math.pi * 2/3) * 64

  if fill then
    shape.trianglef(x3, y3, x2, y2, x1, y1, 8)
  else
    shape.triangle(x1, y1, x2, y2, x3, y3, 8)
  end
end

function _draw()
  gfx.cls()
  local f = tiny.frame * 0.01

  tri(f, false)
  tri(f*2, true)
end
function tri(f, fill) local x1 = 128 + math.cos(f) * 64 local y1 = 128 + math.sin(f) * 64 local x2 = 128 + math.cos(f + math.pi * 1/3) * 64 local y2 = 128 + math.sin(f + math.pi * 1/3) * 64 local x3 = 128 + math.cos(f+ math.pi * 2/3) * 64 local y3 = 128 + math.sin(f +math.pi * 2/3) * 64 if fill then shape.trianglef(x3, y3, x2, y2, x1, y1, 8) else shape.triangle(x1, y1, x2, y2, x3, y3, 8) end end function _draw() gfx.cls() local f = tiny.frame * 0.01 tri(f, false) tri(f*2, true) end
shape shape.trianglef(x1, y1, x2, y2, x3, y3, color)

Draw a filled triangle using the coordinates of (x1, y1), (x2, y2) and (x3, y3) and color.

Parameters
x1 number
y1 number
x2 number
y2 number
x3 number
y3 number
color number
function tri(f, fill)
  local x1 = 128 + math.cos(f) * 64
  local y1 = 128 + math.sin(f) * 64

  local x2 = 128 + math.cos(f + math.pi * 1/3) * 64
  local y2 = 128 + math.sin(f + math.pi * 1/3) * 64

  local x3 = 128 + math.cos(f+ math.pi * 2/3) * 64
  local y3 = 128 + math.sin(f +math.pi * 2/3) * 64

  if fill then
    shape.trianglef(x3, y3, x2, y2, x1, y1, 8)
  else
    shape.triangle(x1, y1, x2, y2, x3, y3, 8)
  end
end

function _draw()
  gfx.cls()
  local f = tiny.frame * 0.01

  tri(f, false)
  tri(f*2, true)
end
function tri(f, fill) local x1 = 128 + math.cos(f) * 64 local y1 = 128 + math.sin(f) * 64 local x2 = 128 + math.cos(f + math.pi * 1/3) * 64 local y2 = 128 + math.sin(f + math.pi * 1/3) * 64 local x3 = 128 + math.cos(f+ math.pi * 2/3) * 64 local y3 = 128 + math.sin(f +math.pi * 2/3) * 64 if fill then shape.trianglef(x3, y3, x2, y2, x1, y1, 8) else shape.triangle(x1, y1, x2, y2, x3, y3, 8) end end function _draw() gfx.cls() local f = tiny.frame * 0.01 tri(f, false) tri(f*2, true) end
sound sound.music(music_index, loop)

Play a music

Parameters
music_index number
loop boolean
sound sound.note(note_name, instrument_index)

Play a note by an instrument until it's stopped

Parameters
note_name string
instrument_index number
function _init()
    keys = {
        {note="E4", x=57, y=100, w=16, h=50},
        {note="Fs4", x=75, y=100, w=16, h=50},
        {note="Gs4", x=93, y=100, w=16, h=50},
        {note="A4", x=111, y=100, w=16, h=50},
        {note="B4", x=129, y=100, w=16, h=50},
        {note="Cs5", x=147, y=100, w=16, h=50},
        {note="Ds5", x=165, y=100, w=16, h=50},
        {note="E5", x=183, y=100, w=16, h=50}
    }
    active_notes = {}
end

function _update()
    local touch = ctrl.touching(0)

    for i, key in ipairs(keys) do
        if in_bounds(touch, key) then
            active_notes[i] = active_notes[i] or sound.note(key.note, 1)
        else
            active_notes[i] = active_notes[i] and active_notes[i].stop()
        end
    end
end

function _draw()
    gfx.cls()
    print("E MAJOR SCALE", 57, 84, 15)
    print("Click keys to play", 57, 92, 14)

    for i, key in ipairs(keys) do
        if active_notes[i] then
            shape.rectf(key.x, key.y, key.w, key.h, 15)
        else
            shape.rect(key.x, key.y, key.w, key.h, 14)
        end
    end
    local pos = ctrl.touch()
    shape.circlef(pos.x, pos.y, 2, 2)
end

function in_bounds(touch, key)
    return touch and touch.x >= key.x and touch.x < key.x + key.w and
           touch.y >= key.y and touch.y < key.y + key.h
end
function _init() keys = { {note="E4", x=57, y=100, w=16, h=50}, {note="Fs4", x=75, y=100, w=16, h=50}, {note="Gs4", x=93, y=100, w=16, h=50}, {note="A4", x=111, y=100, w=16, h=50}, {note="B4", x=129, y=100, w=16, h=50}, {note="Cs5", x=147, y=100, w=16, h=50}, {note="Ds5", x=165, y=100, w=16, h=50}, {note="E5", x=183, y=100, w=16, h=50} } active_notes = {} end function _update() local touch = ctrl.touching(0) for i, key in ipairs(keys) do if in_bounds(touch, key) then active_notes[i] = active_notes[i] or sound.note(key.note, 1) else active_notes[i] = active_notes[i] and active_notes[i].stop() end end end function _draw() gfx.cls() print("E MAJOR SCALE", 57, 84, 15) print("Click keys to play", 57, 92, 14) for i, key in ipairs(keys) do if active_notes[i] then shape.rectf(key.x, key.y, key.w, key.h, 15) else shape.rect(key.x, key.y, key.w, key.h, 14) end end local pos = ctrl.touch() shape.circlef(pos.x, pos.y, 2, 2) end function in_bounds(touch, key) return touch and touch.x >= key.x and touch.x < key.x + key.w and touch.y >= key.y and touch.y < key.y + key.h end
sound sound.sfx(sfx_index, loop)

Play a sfx.

Parameters
sfx_index number
loop boolean
spr spr.draw(sprN, x, y, flipX, flipY)

Draw a sprite.

Parameters
sprN number
x number
y number
flipX boolean
flipY boolean
function _init()
  id = 1
end

function _draw()
    if ctrl.pressed(keys.left) then
      id = id - 1
    elseif ctrl.pressed(keys.right) then
      id = id + 1
    end

    gfx.cls()
    print("sprite index "..id.. " (press left or right to change)", 50, 112)
    spr.draw(id, 120, 120)
end
function _init() id = 1 end function _draw() if ctrl.pressed(keys.left) then id = id - 1 elseif ctrl.pressed(keys.right) then id = id + 1 end gfx.cls() print("sprite index "..id.. " (press left or right to change)", 50, 112) spr.draw(id, 120, 120) end
spr spr.pget(x, y)

Get the color index at the coordinate (x,y) from the current spritesheet.

Parameters
x number
y number
function _draw()
    local pos = ctrl.touch()
    
    gfx.cls()
    
    spr.sdraw()
    shape.circlef(pos.x - 4, pos.y - 4, 8, 3)
    local color = spr.pget(pos.x, pos.y)
    if(color ~= nil) then
        print("index color: "..color, 7, 0)
        shape.rectf(0, 0, 6, 6, color)
        shape.circlef(pos.x - 4, pos.y - 4, 6, color)
    end
end
function _draw() local pos = ctrl.touch() gfx.cls() spr.sdraw() shape.circlef(pos.x - 4, pos.y - 4, 8, 3) local color = spr.pget(pos.x, pos.y) if(color ~= nil) then print("index color: "..color, 7, 0) shape.rectf(0, 0, 6, 6, color) shape.circlef(pos.x - 4, pos.y - 4, 6, color) end end
spr spr.pset(x, y, color)

Set the color index at the coordinate (x,y) in the current spritesheet.

Parameters
x number
y number
color number
function _draw()
    local pos = ctrl.touch()

    local touching = ctrl.touching(0)
    gfx.cls()

   spr.sdraw()

   if touching ~= nil then
      spr.pset(pos.x, pos.y, 9)
   end
   print("click to alter", 45, 96)
   shape.circle(64 + 8, 128 + 8, 32, 1)
   shape.circlef(128 + 8, 128 + 8, 32, 1)
   spr.draw(100, 128, 128)

   shape.circlef(pos.x, pos.y, 2, 3)
end

function _draw() local pos = ctrl.touch() local touching = ctrl.touching(0) gfx.cls() spr.sdraw() if touching ~= nil then spr.pset(pos.x, pos.y, 9) end print("click to alter", 45, 96) shape.circle(64 + 8, 128 + 8, 32, 1) shape.circlef(128 + 8, 128 + 8, 32, 1) spr.draw(100, 128, 128) shape.circlef(pos.x, pos.y, 2, 3) end
spr spr.sdraw(x, y, sprX, sprY, width, height, flipX, flipY)

S(uper) Draw a fragment from the spritesheet.

Parameters
x number screen x coordinate to draw the sprite (default 0)
y number screen y coordinate to draw the sprite (default 0)
sprX number x coordinate from the spritesheet (default 0)
sprY number y coordinate from the spritesheet (default 0)
width number width of the spritesheet to copy (default width of the spritesheet)
height number height of the spritesheet to copy (default height of the spritesheet)
flipX boolean flip on the x axis (default: false)
flipY boolean flip on the y axis (default: false)
function _draw()
    local pos = ctrl.touch()
    
    gfx.cls()
    
    spr.sdraw()
    shape.circlef(pos.x - 4, pos.y - 4, 8, 3)
    local color = spr.pget(pos.x, pos.y)
    if(color ~= nil) then
        print("index color: "..color, 7, 0)
        shape.rectf(0, 0, 6, 6, color)
        shape.circlef(pos.x - 4, pos.y - 4, 6, color)
    end
end
function _draw() local pos = ctrl.touch() gfx.cls() spr.sdraw() shape.circlef(pos.x - 4, pos.y - 4, 8, 3) local color = spr.pget(pos.x, pos.y) if(color ~= nil) then print("index color: "..color, 7, 0) shape.rectf(0, 0, 6, 6, color) shape.circlef(pos.x - 4, pos.y - 4, 6, color) end end
spr spr.sheet(spritesheetN)

Switch to another spritesheet. The index of the spritesheet is given by it's position in the spritesheets field from the `_tiny.json` file.The first spritesheet is at the index 0. It retuns the previous spritesheet. The spritesheet can also be referenced by its filename.

Parameters
spritesheetN any
local current = 0
function _update()
    local x = math.perlin((tiny.frame % 100) / 100, (tiny.frame % 100) / 100, (tiny.frame % 100) / 100)
    local y = math.perlin((tiny.frame  * 0.5 % 100) / 100, (tiny.frame % 100) / 100, (tiny.frame * 0.5 % 100) / 100)

    gfx.cls()
    shape.circlef(x * 256, y * 256, 10, 8)
    gfx.to_sheet("circle.png")
    
    gfx.cls()
    shape.rectf(x * 256, y * 256, 20, 20, 8)
    gfx.to_sheet("rect.png")

    if ctrl.pressed(keys.space) then
        current = (current + 1) % 2
    end
end

function _draw()
    if current == 0 then
        spr.sheet("circle.png")
    else
        spr.sheet("rect.png")
    end
    spr.sdraw()
end
local current = 0 function _update() local x = math.perlin((tiny.frame % 100) / 100, (tiny.frame % 100) / 100, (tiny.frame % 100) / 100) local y = math.perlin((tiny.frame * 0.5 % 100) / 100, (tiny.frame % 100) / 100, (tiny.frame * 0.5 % 100) / 100) gfx.cls() shape.circlef(x * 256, y * 256, 10, 8) gfx.to_sheet("circle.png") gfx.cls() shape.rectf(x * 256, y * 256, 20, 20, 8) gfx.to_sheet("rect.png") if ctrl.pressed(keys.space) then current = (current + 1) % 2 end end function _draw() if current == 0 then spr.sheet("circle.png") else spr.sheet("rect.png") end spr.sdraw() end
text text.font(index)

Select a font to use for text rendering. Call without arguments to reset to the default boot font.

Parameters
index number
function _draw()
    gfx.cls()
    -- Use the default boot font
    text.font()
    text.print("default font", 10, 10)

    -- Switch to the first custom font (index 0)
    text.font(0)
    text.print("custom font", 10, 30)

    -- Switch to a custom font by name
    text.font("big_font")
    text.print("big font", 10, 50)

    -- Reset to default
    text.font()
    text.print("back to default", 10, 70)
end
function _draw() gfx.cls() -- Use the default boot font text.font() text.print("default font", 10, 10) -- Switch to the first custom font (index 0) text.font(0) text.print("custom font", 10, 30) -- Switch to a custom font by name text.font("big_font") text.print("big font", 10, 50) -- Reset to default text.font() text.print("back to default", 10, 70) end
text text.print(args)

Print text on the screen using the currently selected font.

Parameters
args any
function _draw()
    gfx.cls()
    -- Print with default color (white)
    text.print("hello world", 10, 10)

    -- Print with a color index
    text.print("colored text", 10, 20, 9)

    -- Print multiline text
    text.print("line 1\nline 2\nline 3", 10, 40)
end
function _draw() gfx.cls() -- Print with default color (white) text.print("hello world", 10, 10) -- Print with a color index text.print("colored text", 10, 20, 9) -- Print multiline text text.print("line 1\nline 2\nline 3", 10, 40) end
text text.width(str)

Measure the width in pixels of a string using the currently selected font.

Parameters
str string
function _draw()
    gfx.cls()
    local msg = "hello"
    local w = text.width(msg)
    -- Center the text on screen
    local x = (256 - w) / 2
    text.print(msg, x, 120)
end
function _draw() gfx.cls() local msg = "hello" local w = text.width(msg) -- Center the text on screen local x = (256 - w) / 2 text.print(msg, x, 120) end
tiny tiny.exit(scriptIndex)

Exit the actual script to switch to another one. The next script to use is identified by it's index. The index of the script is the index of it in the list of scripts from the `_tiny.json` file.The first script is at the index 0.

Parameters
scriptIndex any
tiny tiny.dt

Delta time between two frame. As Tiny is a fixed frame engine, it's always equal to 1/60

tiny tiny.frame

Number of frames elapsed since the start of the game.

tiny tiny.height

Height of the game in pixels.

tiny tiny.platform

Current platform: 1 for desktop, 2 for web.

tiny tiny.t

Time elapsed since the start of the game.

tiny tiny.width

Width of the game in pixels.

vec2 vec2.add(x1, y1, x2, y2)

Add vector2 to another vector2

Parameters
x1 number
y1 number
x2 number
y2 number
function _init()
    gfx.camera(-128, -128)

    local v1 = vec2.create(32, 38)
    local v2 = vec2.create(20, 2)

    gfx.cls(1)
    print("v1", 2, 15, 10)
    shape.line(0, 0, v1.x, v1.y, 10)
    print("v2", 23, 3, 9)
    shape.line(0, 0, v2.x, v2.y, 9)

    local v3 = vec2.add(v1, v2)

    print("v1 + v2", 30, 15, 11)
    gfx.dither(0xAAAA)
    shape.line(0, 0, v3.x, v3.y, 11)
    gfx.dither()
end
function _init() gfx.camera(-128, -128) local v1 = vec2.create(32, 38) local v2 = vec2.create(20, 2) gfx.cls(1) print("v1", 2, 15, 10) shape.line(0, 0, v1.x, v1.y, 10) print("v2", 23, 3, 9) shape.line(0, 0, v2.x, v2.y, 9) local v3 = vec2.add(v1, v2) print("v1 + v2", 30, 15, 11) gfx.dither(0xAAAA) shape.line(0, 0, v3.x, v3.y, 11) gfx.dither() end
vec2 vec2.create(x, y)

Create a vector 2 as a table { x, y }.

Parameters
x number
y number
vec2 vec2.crs(x1, y1, x2, y2)

Cross product

Parameters
x1 number
y1 number
x2 number
y2 number
vec2 vec2.dot(x1, y1, x2, y2)

Dot product between two vectors

Parameters
x1 number
y1 number
x2 number
y2 number
function _init()
    angle = 0
end
function _update()

    if ctrl.pressing(keys.space) then
        angle = angle + 0.1
    end

    gfx.camera(-128, -128)

    local v1 = vec2.create(1, 0)
    local v2 = vec2.create(math.cos(angle), math.sin(angle))
    local dot = vec2.dot(v1, v2)
    
    local scl = vec2.scl(v1, dot)
    
    gfx.cls(1)
    
    local scaledv1 = vec2.scl(v1, 64)
    local scaledv2 = vec2.scl(v2, 64)
    local scaledv3 = vec2.scl(scl, 64)

    print("v1", 18, 5, 10)
    shape.line(0, 0, scaledv1.x, scaledv1.y, 10)
    print("v2", scaledv2.x + 5, scaledv2.y + 5, 11)
    shape.line(0, 0, scaledv2.x, scaledv2.y, 11)
    
    print("dot", scaledv3.x, 5, 9)
    shape.line(0, 0, scaledv3.x, scaledv3.y, 9)
end    
function _init() angle = 0 end function _update() if ctrl.pressing(keys.space) then angle = angle + 0.1 end gfx.camera(-128, -128) local v1 = vec2.create(1, 0) local v2 = vec2.create(math.cos(angle), math.sin(angle)) local dot = vec2.dot(v1, v2) local scl = vec2.scl(v1, dot) gfx.cls(1) local scaledv1 = vec2.scl(v1, 64) local scaledv2 = vec2.scl(v2, 64) local scaledv3 = vec2.scl(scl, 64) print("v1", 18, 5, 10) shape.line(0, 0, scaledv1.x, scaledv1.y, 10) print("v2", scaledv2.x + 5, scaledv2.y + 5, 11) shape.line(0, 0, scaledv2.x, scaledv2.y, 11) print("dot", scaledv3.x, 5, 9) shape.line(0, 0, scaledv3.x, scaledv3.y, 9) end
vec2 vec2.mag(x, y)

Calculate the magnitude (length) of a vector

Parameters
x number
y number
vec2 vec2.nor(x, y)

Normalize a vector

Parameters
x number
y number
function _update()
    gfx.cls(1)

    local v0 = vec2.create(43, 64)
    local v1 = vec2.nor(v0)
    
    
    print("vector     x: " .. v0.x .. " y: " .. v0.y)
    print("normalized x: " .. v1.x .. " y: " .. v1.y, 0, 8)
end 
function _update() gfx.cls(1) local v0 = vec2.create(43, 64) local v1 = vec2.nor(v0) print("vector x: " .. v0.x .. " y: " .. v0.y) print("normalized x: " .. v1.x .. " y: " .. v1.y, 0, 8) end
vec2 vec2.scl(x, y, scl)

Scale a vector

Parameters
x number
y number
scl number
function _init()
    gfx.camera(-128, -128)

    local v1 = vec2.create(32, 38)
    local v2 = vec2.scl(v1, 2)

    gfx.cls(1)
    print("v1 scaled", 8, 60, 11)
    gfx.dither(0xAAAA)
    shape.line(0, 0, v2.x, v2.y, 11)
    gfx.dither()
    print("v1", 18, 15, 10)
    shape.line(0, 0, v1.x, v1.y, 10)
end
function _init() gfx.camera(-128, -128) local v1 = vec2.create(32, 38) local v2 = vec2.scl(v1, 2) gfx.cls(1) print("v1 scaled", 8, 60, 11) gfx.dither(0xAAAA) shape.line(0, 0, v2.x, v2.y, 11) gfx.dither() print("v1", 18, 15, 10) shape.line(0, 0, v1.x, v1.y, 10) end
vec2 vec2.sub(x1, y1, x2, y2)

Subtract another vector from another vector

Parameters
x1 number
y1 number
x2 number
y2 number
function _init()
    gfx.camera(-128, -128)

    local v1 = vec2.create(32, 38)
    local v2 = vec2.create(20, 2)

    gfx.cls(1)
    print("v1", 18, 15, 10)
    shape.line(0, 0, v1.x, v1.y, 10)
    print("v2", 23, 3, 9)
    shape.line(0, 0, v2.x, v2.y, 9)

    local v3 = vec2.sub(v1, v2)

    print("v1 - v2", 0, 40, 11)
    gfx.dither(0xAAAA)
    shape.line(0, 0, v3.x, v3.y, 11)
    gfx.dither()
end
function _init() gfx.camera(-128, -128) local v1 = vec2.create(32, 38) local v2 = vec2.create(20, 2) gfx.cls(1) print("v1", 18, 15, 10) shape.line(0, 0, v1.x, v1.y, 10) print("v2", 23, 3, 9) shape.line(0, 0, v2.x, v2.y, 9) local v3 = vec2.sub(v1, v2) print("v1 - v2", 0, 40, 11) gfx.dither(0xAAAA) shape.line(0, 0, v3.x, v3.y, 11) gfx.dither() end
search_off No functions match your search.