Janet + Raylib Demos

WebAssembly builds using Jaylib (Janet bindings for Raylib, experimentally using Raylib v6) — gitlab.com/kreels/jaylib-wasm
... Done with help from DeepSeek!

Core 28

Basic Window

"Congrats! You created your first window!" — the classic raylib hello-world example.

window

Delta Time

Frame-rate-independent vs frame-rate-dependent movement comparison. Scroll to change FPS, press R to reset.

timing

Input Keys

Move a ball with arrow keys. Simple keyboard input demo using IsKeyDown.

keyboard

Input Mouse

Ball follows cursor, click buttons to change color. Press H to toggle cursor visibility.

mouse

Mouse Wheel

Scroll to move a box up and down. Displays the current Y position.

mouse

Gamepad

Visualize gamepad input with Xbox, PS3, and generic controller layouts. Left/Right to switch gamepads.

input

Gestures

Touch gesture detection and logging. Detects tap, double-tap, hold, drag, swipe, pinch in/out.

touch

Input Multitouch

Multi-touch input tracking. Touch the screen in multiple places to see numbered circles appear at each touch point.

touch

2D Camera

Free 2D camera with player movement, zoom, and rotation. Scroll to zoom, A/S to rotate, R to reset.

camera

2D Camera Mouse Zoom

Two mouse zoom modes: wheel-based or right-click drag. Left-click to pan, zoom toward cursor point.

camera mouse

2D Camera Platformer

Side-scrolling platformer with 5 camera modes: center follow, clamp, smooth, landing-even, and bounds-push.

camera platformer

2D Camera Split Screen

Two-player split screen with independent cameras. W/S/A/D vs arrow keys on a shared grid world.

camera multiplayer

Input Virtual Controls

D-Pad virtual controller with touch and mouse support. Move the player with on-screen buttons.

touch mouse

3D Camera Mode

Basic 3D camera with perspective projection. A red cube with wireframe on a grid, showcasing 3D rendering fundamentals.

3D camera

Basic Screen Manager

Simple screen state machine with LOGO, TITLE, GAMEPLAY, and ENDING screens. Press ENTER or tap to advance.

state-machine

3D Camera Free

Free 3D camera with mouse look, scroll to zoom, click+drag to pan. Red cube on grid with controls overlay.

3D camera

3D Camera First Person

First-person camera with 4 switchable modes (free, FPS, third-person, orbital). Random columns in a walled arena.

3D camera

World Screen

3D-to-2D projection: 3D cube with 2D label hovering above it. Demonstrates GetWorldToScreen coordinate mapping.

3D coordinate-mapping

3D Camera FPS

Manual FPS camera implementation with physics, head bobbing, crouching, and mouse look. Checkerboard floor with towers.

3D camera fps

3D Camera Split Screen

Two-player split screen in 3D. Player 1 (W/S) and Player 2 (UP/DOWN) move through a grid of cube trees.

3D camera multiplayer

Input Actions

Abstract input actions system mapping keys and gamepad buttons. TAB toggles between WASD and Arrow key schemes.

input gamepad

Random Values

Generates and displays a new random integer every 2 seconds. Simple demo of randomness and frame counting.

random

Scissor Test

Restricts rendering to a mouse-following rectangular region. Press S to toggle scissor mode on/off.

scissor

Window Flags

Toggle window states (fullscreen, resizable, undecorated, etc.) and watch a bouncing ball. Timed flag cycling mode.

window flags

Window Letterbox

Render-to-texture scaling with letterboxing. Resize the window and see the game view scale with virtual mouse tracking.

window scaling

Storage Values

Persistent score storage using IndexedDB. Save/load values that survive page reloads. R for random, ENTER to save, SPACE to load.

storage persistence

3D Picking

First-person camera with ray casting. Click to shoot a ray and detect collision with a 3D cube. Right-click toggles cursor.

3D camera ray-picking

Drop Files

Drag and drop files onto the window to register their paths. Each dropped file path is listed with alternating row highlights.

input drag-and-drop
Shapes 16

Analog Clock

Smooth analog clock with hour, minute, and second hands. Pure shapes — circles and lines, no external assets.

2D math

Collision Area

Moving box collides with a mouse-controlled box. Visual collision rectangle, pause with SPACE.

2D collision

Following Eyes

Two eyes track the mouse cursor. Irises stay within the sclera bounds using circle collision checks.

2D math

Mouse Trail

Fading trail of circles follows the mouse cursor. Demonstrates position-history arrays and color fading.

2D fade

Ball Physics

Physics simulation with up to 5000 balls. Grab and throw with mouse, scroll to change gravity, middle-click to shake.

2D physics

Kaleidoscope

Draw with symmetry — 6-fold kaleidoscope mirroring. Undo, redo, and reset your patterns.

2D drawing

Double Pendulum

Chaotic double pendulum with fading trail rendered to an offscreen texture. Beautiful physics simulation.

2D physics trail

Digital Clock

Dual-mode clock — toggle between analog and 7-segment digital display. Pure shapes, no external assets.

2D shapes

Clock of Clocks

Time displayed as 144 mini analog clock faces with smooth animated transitions. Space toggles 12/24h mode.

2D shapes animation

Simple Particles

Procedural particle system with WATER, SMOKE, and FIRE types. LEFT/RIGHT to switch, UP/DOWN for emission rate, mouse to move emitter.

2D particles

Lines Drawing

Draw rainbow lines on a canvas — Left mouse to draw, Right to erase, Middle to clear. Scroll to change thickness.

2D drawing render-texture

Penrose Tile

Animated Penrose tiling via Lindenmayer (L-system) turtle graphics. UP/DOWN adjusts generations (0-4).

2D math l-system

Starfield Effect

Classic 2D starfield flying through space. Space toggles lines/circles, mouse wheel adjusts speed.

2D stars

Math Angle Rotation

Fixed angle lines (0°, 30°, 60°, 90°) with a rotating HSV-colored line. Demonstrates trig and angle math.

2D math trigonometry

Lines Bezier

Drag start/end points with mouse to shape a cubic Bezier curve. Points enlarge on hover, turn red while dragging.

2D bezier

Top Down Lights

Dynamic 2D lighting with shadow volumes. Drag light #1, right-click to add lights, V to toggle debug view.

2D lighting shadows
Textures 14

Background Scrolling

Parallax scrolling with three layers (background, midground, foreground) moving at different speeds.

2D parallax

Blend Modes

Cycle through blend modes (alpha, additive, multiplied, add-colors) with textured foreground/background.

2D blending

Polygon Drawing

Textured polygon with continuous rotation. Uses custom immediate-mode rlgl draw function.

2D rlgl

Sprite Animation

Classic Scarfy running animation from a 6-frame spritesheet. Adjust frame speed with left/right arrows.

2D spritesheet animation

Clipboard Image

Paste images from clipboard with Ctrl+V. Click to place, R to reset. Up to 20 images at once.

2D clipboard texture

Image Text

Draw text onto an image using custom font rendering. Space toggles font atlas view.

2D text font

Image Processing

9 image effects: grayscale, tint, invert, contrast, brightness, blur, flip vertical/horizontal. Click or arrow keys to select.

2D image effects

Textured Curve

Road texture mapped along a cubic bezier curve using rlgl quads. Drag control points, +/- for width, LEFT/RIGHT for segments.

2D bezier rlgl

Tiled Drawing

Texture tiling with pattern and color palette selection. Scale and rotation controls for the tiled output.

2D tiling pattern

Sprite Explosion

Click to trigger an explosion sprite-sheet animation with sound. Cycles through frames on a 5×5 grid.

2D sprites audio

Bunny Mark

Benchmark: spawn thousands of textured, tinted bunnies with physics. Hold mouse to spawn, P to pause.

2D benchmark batching

Image Generation

Procedural textures: linear/radial/square gradients, checked, white noise, and cellular noise.

2D procedural noise

SrcRec DstRec

DrawTexturePro with source/destination rectangles and rotation. Scarfy sprite rotated around its center point.

2D rotation spritesheet

Fog of War

2D tilemap with fog-of-war visibility. Arrow keys to move the player, smooth bilinear fog via render texture.

2D tilemap render-texture
Text 8

Font Loading

Load and render both BMFont (AngelCode) and TTF fonts. Hold SPACE to toggle between them.

fonts text

Font Filters

Compare point, bilinear, and trilinear texture filtering on a scaled TTF font. Scroll to change size, 1/2/3 to switch filter.

fonts filtering

Format Text

Score, hiscore, lives, and elapsed-time display using Janet's string/format for text formatting.

text formatting

Unicode Ranges

Dynamic glyph loading for Latin, Greek, Cyrillic, CJK, and more. Press 1-4 to add codepoint ranges.

fonts unicode

Font SDF

Signed Distance Field font rendering for crisp text at any scale. Hold SPACE to compare with default font.

fonts sdf shader

Sprite Fonts

Eight free sprite fonts included with raylib, each with its designer credit and unique color.

fonts sprite

Codepoints Loading

Load a font atlas containing only the glyphs needed for Japanese text. Toggle between atlas view and rendered text.

fonts unicode utf-8

3D Drawing

Render 2D text in 3D space with wave animation effects. Orbital/free camera, alpha discard shader, cube clicking.

3D text rlgl shader
Models 20

Mesh Picking

3D ray casting with mesh-level collision. Hover over the tower model to see per-triangle hit detection.

3D collision ray-picking

Rotating Cube

Simple textured cube rotating around a tilted axis. Built from generated mesh using DrawModelEx.

3D model

Cubicmap Rendering

3D maze generated from a 2D cubicmap image. Orbit the camera around the model with minimap overlay.

3D model orbital

First Person Maze

Navigate a maze in first-person with WASD and mouse. Collision detection using pixel data from the cubicmap.

3D camera collision

Geometric Shapes

3D geometric shapes: cubes, spheres, cylinders, capsules, and cones with wireframe overlays on a grid.

3D shapes

Yaw Pitch Roll

WWI plane model with independent yaw, pitch, and roll controls. Uses matrix-based Euler angle rotation.

3D model rotation

Orthographic Projection

Toggle between perspective and orthographic 3D views. Spacebar switches projection mode. Shows various 3D shapes.

3D camera projection

Skybox Rendering

First-person view inside a cubemap skybox. Panoramic skybox with grid floor, shader-based cubemap rendering.

3D shader cubemap

Heightmap Rendering

3D terrain generated from a heightmap image. Orbital camera with minimap showing the source image.

3D model terrain

Textured Cube

Textured cubes drawn with rlgl immediate-mode vertex data. Shows full-texture and region-textured cubes.

3D rlgl texture

Animation Timing

Robot model with 20+ animations. Switch between animations, adjust playback speed, pause/resume with keyboard controls.

3D animation model

Animation Blending

Blend smoothly between two robot animations. Two animation slots with keyboard-controlled blending transition.

3D animation blending

Mesh Generation

Cycle through 8 procedurally-generated 3D meshes: plane, cube, sphere, hemisphere, cylinder, torus, knot, and poly.

3D procedural

Box Collisions

3D collision detection between boxes and spheres. Move the player cube with arrow keys — turns red on contact.

3D collision

IQM Loading

Animated IQM model (Guy) with orbital camera. Demonstrates loading and playing IQM model animations in 3D.

3D animation iqm

M3D Loading

Animated M3D model (CesiumMan) with orbital camera. Cycle through the model's animations with LEFT/RIGHT.

3D animation m3d

Decals

Place decals on a 3D character model with mouse clicks. Ray collision on mesh triangles, right-click to orbit camera.

3D model decals ray-picking

Loading Vox

MagicaVoxel (.vox) models with a voxel-lighting shader and four point lights. Click to cycle models, WASD and middle mouse to move the camera.

3D model voxel lighting

RLGL Solar System

Sun, Earth, and Moon orbits rendered with rlgl immediate-mode vertex data. Low-level pseudo-OpenGL 1.1 style drawing.

3D rlgl solar-system

Loading GLTF

Animated glTF robot model with skeletal animations. Orbital camera; use LEFT/RIGHT keys to switch between animations.

3D model gltf animation
Shaders 13

Shaders Demo

3D scene with post-processing shaders. Church model, torus, and 12 GLSL fragment shaders to cycle through.

3D shaders

Basic PBR

Physically-based rendering with a car and floor. Albedo, metalness, normal, and emission maps. Toggle 4 point lights with keys 1-4.

3D shader pbr lighting

Model Shader

Watermill model with grayscale shader applied. Free 3D camera, demonstrates applying custom shaders to models.

3D shader model

Texture Outline

Shader-based outline effect on a texture. Scroll mouse wheel to change outline thickness in real-time.

2D shader outline

Simple Mask

Mask shader blending a plasma texture with an animated mask across three procedural models. First-person camera.

3D shader mask

Texture Waves

Wavy distortion shader applied to a tiled space texture.

2D shader wave

Fog Rendering

Exponential fog effect with three procedural models (torus, cube, sphere). Up/Down to adjust fog density.

3D shader fog lighting

Normal Map Rendering

Tangent-space normal mapping on a spinning plane. WASD to move light, N to toggle normal map on/off.

3D shader normal-map lighting

Cel Shading

Toon-shaded car model with an inverted-hull outline. Z toggles cel shading, C toggles the outline, Q/E adjust toon band count.

3D shader toon outline

Depth Rendering

Visualizes the depth buffer as a grayscale image. Free 3D camera with WASD/mouse controls.

3D shader depth

Shadowmap Rendering

Directional light shadow mapping with PCF filtering. Arrow keys rotate the light, animated robot model.

3D shader shadow

Mesh Instancing

10,000 instanced cubes rendered with a single draw call. Orbital camera, lighting shader.

3D shader instancing

Game of Life

Conway's Game of Life running on the GPU. Space to pause, 1-9 to load patterns, drag to pan, wheel to zoom.

shader GPU simulation cellular-automata
Audio 7

Audio Effects

Music streaming with real-time LPF and delay effects. Play/pause/stop controls.

audio streaming

Sound Loading

Load and play WAV and OGG sound files with keyboard triggers.

audio sound

Module Playing

Play XM tracker music with pitch control and animated circle visuals.

audio music

Music Stream

MP3 music streaming with pan, volume, and progress controls. Pause/resume and restart support.

audio streaming music

Sound Multi

Play up to 10 sound aliases from a single source. See which slots are active and queued.

audio sound alias

Raw Audio Stream

Procedural sine wave generation with real-time frequency and pan controls. Includes waveform visualization.

audio procedural waveform

Sound Positioning

3D spatialized audio with a free camera and orbiting sound source. Distance attenuation and stereo panning.

audio 3D spatial
Extra 3

Cosmic

2D particle animation with smooth circle motion and FPS display. Pure code, no external assets.

2D particles

SQLite Demo

In-browser SQLite3 database via OPFS + Web Worker. Run SQL queries directly in the browser.

storage sqlite

Easings Ball

Animated ball using Robert Penner easing functions. Elastic, cubic, and fade transitions in sequence.

easing animation

In the spirit of Mulga Bill, with fond memories of Dad who always encouraged me to give it a go.