canvas

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package canvas provides constructors and methods for the HTML <canvas> element.

The <canvas> HTML element provides a drawable region for rendering graphics, animations, and visualizations using JavaScript. Used with the Canvas 2D API for 2D graphics or WebGL for 3D rendering. Content within the canvas element serves as fallback for browsers that don't support canvas. Essential for data visualisation, games, image manipulation, and real-time graphics.

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen  = []byte("<canvas")
	TagClose = []byte("</canvas>")

	AttrHeight = []byte(" height=\"")
	AttrWidth  = []byte(" width=\"")
)

Byte constants for HTML rendering.

Functions

func New

func New(nodes ...node.Node) *element

New creates a new canvas element with child nodes for fallback content. Example: canvas.New(text.Text("Your browser does not support canvas.")) Renders: <canvas>Your browser does not support canvas.</canvas>

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL