textmode.synth.js / shape
Function: shape()
ts
function shape(
sides?,
radius?,
smoothing?): SynthSource;Generate geometric shapes (polygons).
Parameters
| Parameter | Type | Description |
|---|---|---|
sides? | number | number[] | (ctx) => number | Number of sides (default: 3) |
radius? | number | number[] | (ctx) => number | Radius of the shape (default: 0.3) |
smoothing? | number | number[] | (ctx) => number | Edge smoothing amount (default: 0.01) |
Returns
Example
javascript
const t = textmode.create({
width: window.innerWidth,
height: window.innerHeight,
plugins: [SynthPlugin],
});
t.layers.base.synth(shape(6, 0.35, 0.02).rotate(() => t.secs));
t.windowResized(() => {
t.resizeCanvas(window.innerWidth, window.innerHeight);
});
@codex{ai-generated}Replace it with your own sketch, claim the credit, and climb the leaderboard.↗ View sketch on GitHub