Skip to content

textmode.synth.js / shape

Function: shape()

ts
function shape(
   sides?, 
   radius?, 
   smoothing?): SynthSource;

Generate geometric shapes (polygons).

Parameters

ParameterTypeDescription
sides?number | number[] | (ctx) => numberNumber of sides (default: 3)
radius?number | number[] | (ctx) => numberRadius of the shape (default: 0.3)
smoothing?number | number[] | (ctx) => numberEdge smoothing amount (default: 0.01)

Returns

SynthSource

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 avatar
@codex{ai-generated}Replace it with your own sketch, claim the credit, and climb the leaderboard.View sketch on GitHub