Cannon.Misc.Color
y-lohse edited this page Dec 29, 2012
·
6 revisions
Cannon.Misc.color instances are objects that represent a simple color. The main advantage is that you can modify any of the red, green, blue or alpha values easily and independently. They are supported all accross the framework, so you can seamlessly use them as values for fillStyle or strokeStyle for example.
Red value, between 0 and 255. Default is 0.
Green value, between 0 and 255. Default is 0.
Blue value, between 0 and 255. Default is 0.
Alpha value, between 0 and 1. Default is 1.
- s:String : string to check
Checks if the provided string matches any of the supported color formats. Those are
- rgba(r, g, b, a)
- rgb(r, g, b)
- #000
- #000000
- r:Integer
- g:Integer
- b:Integer
- a:Float : optionnal
- color:String : can be a 3 or 6 digit hexadecimal number, a rgba() representation of a color or a rgb() representation of a color.
Creates a new Color.
Converts the Cannon.Misc.Color into a plain text rgba value.