Learn · KidLisp.com

red

Type a color. The screen fills with it.

red, circle

Commas chain commands. Set a color, then draw.

wipe black, ink lime, box 40 40 80

Wipe the screen, pick a color, draw a shape — all in one line.

ink (? red blue lime), circle (wiggle w) (wiggle h) 20

Randomness and motion are built in. Every frame picks a new color and wiggles.

(repeat 50 i
  (ink (? red blue lime))
  (circle (wiggle w) (wiggle h) 8))

Loops make patterns. Fifty random circles in three lines.

wipe navy, ink rainbow, 1s (blur 1), circle 80 60 (* (sin f) 30)

Time, blur, and math — code runs every frame so things move on their own.

( )

118 functions to explore. Type something and press play.

Loading function popularity data...

Syntax

; Comments start with semicolon
(function-name arg1 arg2 ...)

; Shorthand comma syntax
purple, ink, line, blur 5

; Variables & functions
(def x 10)
(later star x y (ink "yellow") (circle x y 20))
(star 100 100)

; Loops
(repeat 50 i (circle (wiggle w) (wiggle h) 10))

Shorthand: w = width, h = height, f = frame. ? = random, ... = cycle values.

Identifiers: no dashes (parsed as subtraction). Use my_var not my-var.

Drawing

FunctionUsageDescription
wipe(wipe color)Clear screen
ink(ink color [alpha])Set draw color
line(line x1 y1 x2 y2) or (line)Line (random if no args)
box(box x y w h)Rectangle
circle(circle x y radius)Circle
tri(tri x1 y1 x2 y2 x3 y3)Triangle
plot(plot x y)Single pixel
flood(flood x y)Flood fill
shape(shape pts... "fill")Polygon
fill/outline(fill) / (outline)Shape mode

Colors

Named: red, blue, lime, navy, etc. (all CSS colors, no quotes needed)
RGB: (ink 255 0 0) — With alpha: (ink red 128)
Special: rainbow, zebra, erase
Gradients: fade:red-blue-black, fade:zebra-rainbow-zebra:direction

Math

FunctionUsageDescription
+ - * / %(+ a b c...)Arithmetic
sin cos tan(sin x)Trigonometry
random / ?(? a b c)Random pick
wiggle(wiggle amount)Random ±amount/2
min max abs(min a b)Comparison
sqrt pow(sqrt x)Power/root
floor ceil round(floor x)Rounding

System

width/w, height/h — canvas size. frame/f — frame count. clock — UTC time. pi — π. (fps rate) — set frame rate.

Control Flow

FunctionUsageDescription
def(def x 10)Variable
later(later fn params body)Define function
if(if cond then else)Conditional
once(once expr)Run once only
repeat/bunch(repeat n i expr)Loop
?/choose(? a b c)Random pick
...(... a b c)Cycle over time
now(now var value)Update variable

Timing

1s              ; after 1 second
2s...           ; cycle every 2 seconds
0.5s!           ; once after 0.5s
0.1s            ; every 0.1 seconds (fast)

(0.25s (wipe (... red yellow blue)))  ; cycle bg color
(1s (blur 1))                         ; periodic blur

Pixel Transforms

FunctionUsageDescription
scroll(scroll dx dy)Translate with wrapping
zoom(zoom factor)Scale from center
spin(spin angle)Rotate
suck(suck strength)Vortex displacement
blur(blur amount)Gaussian blur
contrast(contrast amount)Adjust contrast
sort(sort)Sort pixels by brightness
bake(bake)Commit to background
pan/unpan(pan dx dy)Camera movement

Images, Text & Media

FunctionUsageDescription
paste(paste url x y [scale])Paste image (URLs can be unquoted)
stamp(stamp url x y)Paste centered
write(write text x y)Draw text
tape(tape !CODE x y w h)Embed video

Audio

mic, amplitude, melody, overtone, noise, speaker

3D

cube, form, trans (move, scale, spin), cubespin, cubepos, cubescale, camrot, camspin

Embedding & Navigation

($codeId)              ; execute another piece
($codeId x y w h alpha) ; embed with position/size/alpha
(jump "piece")          ; navigate to piece
(jump $id)              ; navigate to cached piece

Loading top hits...