diff --git a/gleam.toml b/gleam.toml index 520e023..e36dacc 100644 --- a/gleam.toml +++ b/gleam.toml @@ -1,5 +1,5 @@ name = "p5js_gleam" -version = "2.0.0" +version = "2.0.1" target = "javascript" description = "A simple game library providing p5.js bindings for Gleam in a functional style to make basic games and animations. Heavily inspired by the Racket library 2htdp/universe" diff --git a/scripts/generate_p5.ts b/scripts/generate_p5.ts index c4a5477..11b8073 100644 --- a/scripts/generate_p5.ts +++ b/scripts/generate_p5.ts @@ -35,6 +35,7 @@ const elements = { ], fill: ["color_hex: String"], stroke: ["color_hex: String"], + noStroke: [], strokeWeight: ["weight: Int"], }; diff --git a/src/p5js_ffi.mjs b/src/p5js_ffi.mjs index 2d86bcf..4d71788 100644 --- a/src/p5js_ffi.mjs +++ b/src/p5js_ffi.mjs @@ -100,6 +100,11 @@ export function stroke(p, ...args) { return p; } +export function noStroke(p, ...args) { + p.noStroke(...args); + return p; +} + export function strokeWeight(p, ...args) { p.strokeWeight(...args); return p; diff --git a/src/p5js_gleam/bindings.gleam b/src/p5js_gleam/bindings.gleam index 57a6991..f9bcb95 100644 --- a/src/p5js_gleam/bindings.gleam +++ b/src/p5js_gleam/bindings.gleam @@ -90,6 +90,10 @@ pub fn fill(p: P5, color_hex: String) -> P5 @external(javascript, "../p5js_ffi.mjs", "stroke") pub fn stroke(p: P5, color_hex: String) -> P5 +/// A binding to the p5.js `noStroke` function. Takes a p5 instance and the function's arguments and returns the p5 instance. +@external(javascript, "../p5js_ffi.mjs", "noStroke") +pub fn no_stroke(p: P5) -> P5 + /// A binding to the p5.js `strokeWeight` function. Takes a p5 instance and the function's arguments and returns the p5 instance. @external(javascript, "../p5js_ffi.mjs", "strokeWeight") pub fn stroke_weight(p: P5, weight: Int) -> P5