canvasCheatSheet

# canvasCheatSheet

# Canvas Element

Attributes

Name Type Default
width unsigned 300
height unsigned 150

Methods

Return Name
string toDataURL( [Optional] string type, [Variadic] any args)
Object getContext(string contextId)

# 2D Context

Attributes

Name Type
canvas HTMLCanvasObject[readonly]

Methods

Return Name
void save()
void restore()

# Transformation

Methods

Return Name
void scale(float x, float y)
void rotate(float angle)
void translate(float x, float y)
void transform( float m11, float m12, float m21, float m22, float dx, float dy)
void setTransform( float m11, float m12, float m21, float m22, float dx, float dy)

# Image Drawing

Methods

Return Name
void drawImage( Object image, float dx, float dy, [Optional] float dw, float dh)
void drawImage( Object image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)

# Compositing

Attributes

Name Type Default
globalAlpha float 1.0
globalCompositeOperation string source-over

# Line Style

Attributes

Name Type Default
lineWidth float 1.0
lineCap string butt

1658465713386

1658465728745

1658465737902

1658465749118

1658465758554

上次更新: 2022/7/25 下午12:50:39