Module P5.Sketch
type tThe sketch. P5 works in two "modes", either taking from the global window object or by passing in a specific "sketch" instance to be used. The latter is more powerful and allows you to have multiple sketches in the window, the only downside is you have to pass the
sketchto every single function call.Every function in this library has an option argument
?sketchwhich if left out then the global instance is used, otherwise function calls will use that call.
val call : t option -> string -> Jv.t array -> Jv.tCalls the method on the sketch instance if it exists or on the global instance if not
val get : t option -> string -> Jv.tval run : ?sketch:t -> ?setup:(unit -> unit) -> ?draw:(unit -> unit) -> unit -> unitRun your sketch
val with_sketch : ?id:string -> (t -> unit) -> unitwith_sketch ?id fnallows you to run p5.js in instance mode by providing you with a sketch object. Theidcan optionally specify the id of the parent container where the canvas will be created.