textmode.filters.js / VignetteOptions
Interface: VignetteOptions
Configuration options for the 'vignette' filter.
Darkens the edges and corners of the image, drawing focus to the center. Useful for creating a cinematic look or highlighting central content.
Example
javascript
const t = textmode.create({
width: window.innerWidth,
height: window.innerHeight,
plugins: [FiltersPlugin],
});
let video;
t.setup(async () => {
video = await t.loadVideo('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
video.play();
video.loop();
video.characters(' .:-=+*#%@');
});
t.draw(() => {
t.background(0);
if (video) {
t.image(video, t.grid.cols, t.grid.rows);
}
const wobble = Math.sin(t.secs * 2);
t.layers.base.filter('vignette', {
amount: 0.5 + wobble * 0.2,
softness: 0.5,
roundness: 0.5 + wobble * 0.15,
});
});
t.windowResized(() => {
t.resizeCanvas(window.innerWidth, window.innerHeight);
});