import type p5 from "p5"; import type { P5WritableMethods } from "./p5-methods"; /** * Function object to be passed to `new p5()`. * This will assign several methods (such as `setup`/`draw`) to `p`. */ export type Sketch = (p: p5) => void; /** * Object that defines a p5.js sketch and will be passed to `createSketch()`. * It should contain particular `p5` methods with `p5` instances added as * the first argument, e.g.: * * ``` * setup: (p) => { p.createCanvas(400, 400); }, * draw: (p) => { p.background(220); } * ``` */ export type SketchDef = { [T in keyof P5WritableMethods]?: ( p: p5, ...args: Parameters ) => ReturnType; };