P5.js Mobile Interaction Examples

Interactive examples demonstrating mobile device capabilities with p5.js

Getting Started

Blank Template

Basic setup from the README - a starting point for your own projects

Web Editor → View Code

Touch Interactions

01. Basic Touch

Detect touch events and track duration

Launch Example → Web Editor →
02. Touch Zones

Screen divided into 4 interactive zones

Launch Example → Web Editor →
03. Touch Count

Count simultaneous touch points

Launch Example → Web Editor →
04. Touch Distance

Measure distance between two touches

Launch Example → Web Editor →
05. Touch Angle

Calculate angle between two touch points

Launch Example → Web Editor →

Device Motion

01. Orientation

Basic device orientation detection

Launch Example → Web Editor →
02. Rotational Velocity

Calculate rotation speed using sensors

Launch Example → Web Editor →
03. Acceleration

Display device acceleration data

Launch Example → Web Editor →

Audio Input

01. Microphone Level

Visualize audio input with threshold

Launch Example → Web Editor →

Audio Playback

01. Sound Basic

Play/pause audio with touch control

Launch Example →
02. Volume by Touches

Control audio volume with multiple touches

Launch Example →

Interactive GIF Examples

Fetch

Touch-controlled corgi fetching animation

Launch Example → View Code
Roll

Tilt-controlled pencil rolling animation

Launch Example → View Code
Fly

Acceleration-controlled airplane window

Launch Example → View Code

UX Comparison Examples

Button vs Shake Detection

Compare clicking a button vs shaking your device to trigger actions

Launch Example → View Code
Button vs Movement Detection

Compare button clicks vs device movement for interaction control

Launch Example → View Code
Button vs Orientation

Compare button interface vs device orientation for control

Launch Example → View Code
Sliders vs Device Rotation

RGB color control: traditional sliders vs device rotation

Launch Example → View Code
Sliders vs Device Acceleration

RGB color control: traditional sliders vs device acceleration

Launch Example → View Code
Slider vs Microphone

Volume control: traditional slider vs microphone input level

Launch Example → View Code
Slider vs Multi-Touch

Value control: single slider vs multiple finger touches

Launch Example → View Code
Slider vs Distance

Value control: traditional slider vs finger distance measurement

Launch Example → View Code
Slider vs Angle Control

Value control: linear slider vs multi-touch angle detection

Launch Example → View Code