"매 sketch 는 setup() + draw() 의 loop". 2001 Casey Reas + Ben Fry @ MIT Media Lab 에서 시작된 creative coding language. 매 visual artist + designer + educator 를 위한 minimal API. 매 2026 현재 p5.js (JavaScript port) 가 web-first default.
매 핵심
매 모델
setup(): 매 once 실행 — canvas size, initial state.
draw(): 매 frame 실행 (default 60fps) — render loop.
mousePressed / keyPressed: 매 event callback.
frameCount, millis(): 매 time-based animation primitive.
매 변형
Processing (Java): 매 desktop, 매 OpenGL access, 매 .pde sketch.
p5.js: 매 web-native JS port — Lauren McCarthy, 2014. 매 modern default.
Processing.py: 매 Python mode (deprecated 2024, py5 successor).
py5: 매 Processing 4 + Java17 backend, 매 Python frontend. 매 Jupyter integration.
매 응용
Generative art (Casey Reas 의 Process series).
Data visualization (Ben Fry, Visualizing Data 책).
Live coding / VJing (Hydra adjacency).
Interactive installations (museums, galleries).
Education — 매 first programming language for 비-CS major.
// Claude Opus 4.7 generates sketch from prompt → eval as p5 sketch
// 매 modern workflow: prompt → code → live edit
constresponse=awaitfetch('/api/claude',{method:'POST',body:JSON.stringify({prompt:'circular spirograph with 7-fold symmetry'})});constcode=awaitresponse.text();newFunction('p',code)(p5Instance);
언제: 매 sketch idea → code, 매 stuck on math (rotation, easing), 매 shader GLSL 의 starter.
언제 X: 매 final aesthetic decision — 매 LLM 의 generative output 의 generic. 매 artistic intent 의 human.
❌ 안티패턴
draw() 안 heavy work: 매 60fps 의 깨짐. preload / setup 의 사용.
Global mutable state spaghetti: 매 small sketch 에서 OK, 매 large 의 class structure.
NOLOOP forget: 매 static image 의 noLoop() 의 사용 — 매 CPU 의 절약.
Pixel-by-pixel without loadPixels(): 매 250x slow. 매 typed array 의 사용.