canvas

package
v0.0.0-...-0c3320d Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

type Canvas struct {
	// contains filtered or unexported fields
}

Canvas element and data

func NewCanvas

func NewCanvas(id string, fps time.Duration, background string, maxparticles int, particleConfig particles.Config) *Canvas

NewCanvas initializes a Canvas element

func (*Canvas) AppendElement

func (c *Canvas) AppendElement()

AppendElement append the canvas element to the body

func (*Canvas) Background

func (c *Canvas) Background()

Background fills the background with color

func (*Canvas) Clear

func (c *Canvas) Clear()

Clear clears the canvas

func (*Canvas) Draw

func (c *Canvas) Draw()

Draw draws elements in the canvas

func (*Canvas) DrawConnection

func (c *Canvas) DrawConnection(p1, p2 *particles.Particle)

DrawConnection draws a line between two vectors

func (*Canvas) DrawParticle

func (c *Canvas) DrawParticle(particle *particles.Particle)

DrawParticle draws elements in the canvas

func (*Canvas) Fullscreen

func (c *Canvas) Fullscreen()

Fullscreen set the size of the canvas as the size of the window

func (*Canvas) ListenEvents

func (c *Canvas) ListenEvents()

ListenEvents add events listener, such as: resize

func (*Canvas) Render

func (c *Canvas) Render()

Render renders via requestAnimationFrame

func (*Canvas) Size

func (c *Canvas) Size(width, height int)

Size sets a size for the canvas

func (*Canvas) Start

func (c *Canvas) Start()

func (*Canvas) Stop

func (c *Canvas) Stop()

Stop stops the rendering

Jump to

Keyboard shortcuts

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