Skip to content

textmode.synth.js / osc

Function: osc()

ts
function osc(
   frequency?, 
   sync?, 
   offset?): SynthSource;

Generate oscillating patterns using sine waves.

Parameters

ParameterTypeDescription
frequency?number | number[] | (ctx) => numberFrequency of the oscillation (default: 60.0)
sync?number | number[] | (ctx) => numberSynchronization offset (default: 0.1)
offset?number | number[] | (ctx) => numberPhase offset (default: 0.0)

Returns

SynthSource

Example

javascript
const t = textmode.create({
	width: window.innerWidth,
	height: window.innerHeight,
	plugins: [SynthPlugin],
});

t.layers.base.synth(osc(8, 0.1, 1.2).kaleid(5).color(0.9, 0.2, 1.1));

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