@revideo/2d / components / DrawHooks
Interface: DrawHooks
Defined in: 2d/src/lib/components/Code.ts:57
Describes custom drawing logic used by the Code node.
Properties
token
token:
DrawTokenHook
Defined in: 2d/src/lib/components/Code.ts:73
Custom drawing logic for individual code tokens.
Example
token(ctx, text, position, color, selection) {
const blur = map(3, 0, selection);
const alpha = map(0.5, 1, selection);
ctx.globalAlpha *= alpha;
ctx.filter = `blur(${blur}px)`;
ctx.fillStyle = color;
ctx.fillText(text, position.x, position.y);
}