Skip to content

Commit 35c8124

Browse files
committed
update docs
1 parent e4a9529 commit 35c8124

1 file changed

Lines changed: 46 additions & 30 deletions

File tree

content/runal.md

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ You're missing a specific method or feature? Feel free to [open an issue](https:
191191
### Properties
192192

193193
#### c.width
194-
Returns the width of the canvas in cells.
194+
Returns the width of the canvas.
195195

196196
#### c.height
197-
Returns the height of the canvas in cells.
197+
Returns the height of the canvas.
198198

199199
#### c.framecount
200200
Number of frames rendered since the beginning.
@@ -229,6 +229,28 @@ Resizes the canvas.
229229

230230
<hr class="separator"/>
231231

232+
### Control
233+
234+
#### c.loop()
235+
Starts the draw loop if stopped.
236+
237+
#### c.noLoop()
238+
Stops the draw loop if started.
239+
240+
#### c.redraw()
241+
Forces one frame render in noLoop mode.
242+
243+
#### c.fps(fps)
244+
Sets the desired frames per second.
245+
246+
#### c.push()
247+
Saves the current drawing state (stroke, fill, background, rotate, translate, scale).
248+
249+
#### c.pop()
250+
Restores the last saved drawing state (stroke, fill, background, rotate, translate, scale).
251+
252+
<hr class="separator"/>
253+
232254
### Colors
233255

234256
For every color arguments (see [Draw](#draw), you can set 2 types of color values:
@@ -333,28 +355,6 @@ Draws a Bezier curve using four control points.
333355

334356
<hr class="separator"/>
335357

336-
### Control
337-
338-
#### c.loop()
339-
Starts the draw loop if stopped.
340-
341-
#### c.noLoop()
342-
Stops the draw loop if started.
343-
344-
#### c.redraw()
345-
Forces one frame render in noLoop mode.
346-
347-
#### c.fps(fps)
348-
Sets the desired frames per second.
349-
350-
#### c.push()
351-
Saves the current drawing state (stroke, fill, background, rotate, translate, scale).
352-
353-
#### c.pop()
354-
Restores the last saved drawing state (stroke, fill, background, rotate, translate, scale).
355-
356-
<hr class="separator"/>
357-
358358
### Math
359359

360360
All JavaScript [Math](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math) namespace objects are usable.
@@ -369,7 +369,7 @@ Returns the euclidean distance between two points (x1, y1) and (x2, y2).
369369

370370
<hr class="separator"/>
371371

372-
### Randomness
372+
### Random
373373

374374
#### c.random(min, max)
375375
Returns a random float between min and max.
@@ -382,14 +382,27 @@ Sets the seed for random number generation.
382382
### Noise
383383

384384
#### c.noise1D(x)
385-
Generates 1D Perlin noise for a given input.
385+
Generates 1D Perlin noise (float number, range [0, 1]) for a given input.
386386

387387
#### c.noise2D(x, y)
388-
Generates 2D Perlin noise for a given (x, y) coordinate.
388+
Generates 2D Perlin noise (float number, range [0, 1]) for a given (x, y) coordinate.
389389

390390
#### c.noiseSeed(seed)
391391
Sets the seed for noise generation.
392392

393+
#### c.loopAngle(duration)
394+
Returns the angular progress (in radians, range [0, 2π]) through a looping cycle of given duration in seconds.
395+
396+
#### c.noiseLoop(angle, radius)
397+
Returns a noise value (range [0, 1]) by sampling the noise on a circular path of the given radius. Angle is the loop angle in radians, from 0 to 2π. You can use [loopAngle](#c-loopangle-duration) for the angle value to control the loop duration.
398+
This is useful for creating cyclic animations or evolving patterns that repeat perfectly after one full loop.
399+
400+
#### c.noiseLoop1D(angle, radius, x)
401+
Returns a 1D noise value (range [0, 1]) that loops as the angle progresses. It samples a 2D noise space using the given radius and combines it with a horizontal offset.
402+
403+
#### c.noiseLoop2D(angle, radius, x, y)
404+
Returns a 2D noise value (range [0, 1]) that loops as the angle progresses. It samples a circular path in 2D noise space, offset by the (x, y) coordinates.
405+
393406
<hr class="separator"/>
394407

395408
### Transform
@@ -405,13 +418,16 @@ Scales the drawing context by the given factor.
405418

406419
<hr class="separator"/>
407420

408-
### Export
421+
### Image
409422

410-
#### c.saveCanvas(filename)
423+
#### c.saveCanvasToPNG(filename)
411424
Exports the current canvas to an image file (png).
412425

426+
#### c.saveCanvasToGIF(filename, duration)
427+
Exports the current canvas to an animated gif file for a given duration (in seconds).
428+
413429
#### c.savedCanvasFont(path)
414-
Sets a custom font (tff) file used for rendering text characters in exported images generated via _SaveCanvas()_.
430+
Sets a custom font (tff) file used for rendering text characters in exported images generated via _SaveCanvasTo...()_ methods.
415431

416432
### Log
417433

0 commit comments

Comments
 (0)