You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/runal.md
+46-30Lines changed: 46 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -191,10 +191,10 @@ You're missing a specific method or feature? Feel free to [open an issue](https:
191
191
### Properties
192
192
193
193
#### c.width
194
-
Returns the width of the canvas in cells.
194
+
Returns the width of the canvas.
195
195
196
196
#### c.height
197
-
Returns the height of the canvas in cells.
197
+
Returns the height of the canvas.
198
198
199
199
#### c.framecount
200
200
Number of frames rendered since the beginning.
@@ -229,6 +229,28 @@ Resizes the canvas.
229
229
230
230
<hrclass="separator"/>
231
231
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
+
<hrclass="separator"/>
253
+
232
254
### Colors
233
255
234
256
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.
333
355
334
356
<hrclass="separator"/>
335
357
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
-
<hrclass="separator"/>
357
-
358
358
### Math
359
359
360
360
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).
369
369
370
370
<hrclass="separator"/>
371
371
372
-
### Randomness
372
+
### Random
373
373
374
374
#### c.random(min, max)
375
375
Returns a random float between min and max.
@@ -382,14 +382,27 @@ Sets the seed for random number generation.
382
382
### Noise
383
383
384
384
#### 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.
386
386
387
387
#### 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.
389
389
390
390
#### c.noiseSeed(seed)
391
391
Sets the seed for noise generation.
392
392
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
+
393
406
<hrclass="separator"/>
394
407
395
408
### Transform
@@ -405,13 +418,16 @@ Scales the drawing context by the given factor.
405
418
406
419
<hrclass="separator"/>
407
420
408
-
### Export
421
+
### Image
409
422
410
-
#### c.saveCanvas(filename)
423
+
#### c.saveCanvasToPNG(filename)
411
424
Exports the current canvas to an image file (png).
412
425
426
+
#### c.saveCanvasToGIF(filename, duration)
427
+
Exports the current canvas to an animated gif file for a given duration (in seconds).
428
+
413
429
#### 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.
0 commit comments