Library of
Pouya Kary

TextKit Basic

CanvasView

Initializing

In TextKit, A CanvasView is an implementation of the ViewProtocol that lets you compose multiple ViewProtocols together. You can add any view, anywhere inside (or even outside of the canvas) and in any z-index you wish for.

ts
const hello =
new TextKit.LineView( "Hello, World", renderer, {
color: "red"
})
 
const canvas =
new TextKit.CanvasView(
VIEW_PORT_WIDTH, VIEW_PORT_HEIGHT, renderer
)
 
canvas.add( hello,
0, // X
0, // Y
0, // Z or Z-index
)
 
ts
const hello =
new TextKit.LineView( "Hello, World", renderer, {
color: "red"
})
 
const canvas =
new TextKit.CanvasView(
VIEW_PORT_WIDTH, VIEW_PORT_HEIGHT, renderer
)
 
canvas.add( hello,
0, // X
0, // Y
0, // Z or Z-index
)