Each tutorial teaches one idea with short sketches you can copy and run. The code on every page is executed when the site is built, and every image is a real render from Kiln. New to Kiln? Start with Getting started.
Here is a taste of what the tutorials cover, all in one sketch:
import mathimport kilndef draw(): kiln.background(14, 14, 22)# Noise and colour: a field of circles tinted by hue.for i inrange(24):for j inrange(10): n = kiln.noise(i *0.15, j *0.15) kiln.fill(kiln.Color.from_hsb(150+80* n, 160, 255, 150)) kiln.circle(20+ i *25, 20+ j *25, 3+9* n)# Blending: additive light. kiln.blend(kiln.Blend.ADD)for k, (r, g, b) inenumerate(((255, 60, 40), (40, 200, 90), (60, 90, 255))): kiln.fill(r, g, b, 200) kiln.circle(470+34* k, 120+18* (k %2), 60) kiln.blend(kiln.Blend.ALPHA)# Transforms: a ring of rotated rounded rectangles.with kiln.transform(): kiln.translate(150, 150)for k inrange(12): kiln.rotate(math.radians(30)) kiln.fill(kiln.Color.from_hsb(k *21, 200, 255)) kiln.rect(40, -6, 50, 12, radius=6)# Custom shapes: a star with a round hole. kiln.fill(255, 210, 120)with kiln.shape(close=True):for k inrange(10): a = math.radians(k *36-90) r =70if k %2==0else30 kiln.vertex(330+ r * math.cos(a), 160+ r * math.sin(a)) kiln.next_contour(close=True)for k inrange(16): a = math.radians(k *22.5) kiln.vertex(330+12* math.cos(a), 160+12* math.sin(a))# Text. kiln.fill(255, 255, 255) kiln.text("made with kiln", 20, 288, scale=2)show(draw, size=(620, 300))
The pixel font (labels, highlights, an FPS counter, text on a circle), then TrueType: the bundled Inter weights, measuring and centring, line height, turned text and a type ring.
kiln.Gui: sliders, toggles, buttons, colour pickers, XY pads, ranges, knobs, choices, text fields, monitors and folders that tune your sketch while it runs; presets, and how panels and your mouse code coexist.
kiln.agents: a population as arrays, senses, steering forces and a behaviour tree that decides for every agent at once; a flock that runs from the mouse, then hunters and prey.
Food Fields that agents eat and that grow back; genes, metabolize, reproduce and die, so traits evolve under selection; rays, batched Brains and next_generation, so foragers’ brains evolve to find food.