new MeteorShower(ctx)
MeteorShower.
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | undefined | The context |
Methods
clear() → {undefined}
Clear with the background color.
Returns:
- Type
- undefined
getRandColor() → {string}
Get a random color code for CSS.
Returns:
A RGB color code.
- Type
- string
getRandSpeed() → {string}
Get a random speed.
Returns:
A RGB color code.
- Type
- string
initialize() → {undefined}
Initialize a drawing property.
Returns:
- Type
- undefined
run() → {undefined}
Move the stars.
Returns:
- Type
- undefined
setBackcolor(backcolor) → {undefined}
Set the background color of canvas.
Parameters:
Name | Type | Description |
---|---|---|
backcolor |
number | string | A background color. |
Returns:
- Type
- undefined
setCount(count) → {undefined}
Set count of meteors.
Parameters:
Name | Type | Description |
---|---|---|
count |
number | A count of meteor. |
Returns:
- Type
- undefined
setHeight(height) → {undefined}
Set the height of canvas.
Parameters:
Name | Type | Description |
---|---|---|
height |
number | a canvas drawing height. |
Returns:
- Type
- undefined
setWidth(width) → {undefined}
Set the width of canvas.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | a canvas drawing width. |
Returns:
- Type
- undefined
start() → {undefined}
Get start the shooting star.
Returns:
- Type
- undefined
stop() → {undefined}
Stop the star moving.
Returns:
- Type
- undefined