Class: Color

ov. Color

new ov.Color()

webgl/ov-Color.js, line 165

顏色類別,有以下建構子

Example

new ov.Color([255, 255, 255]);//效能最好
new ov.Color([255, 255, 255, 1.0]);//效能最好
new ov.Color("#ffffff");
new ov.Color("ffffff");
new ov.Color("#ffffffff");
new ov.Color("ffffffff");
new ov.Color("rgb(255, 255, 255)");
new ov.Color("rgba(255, 255, 255, 1.0)");
new ov.Color("green");
new ov.Color(255, 255, 255);
new ov.Color(255, 255, 255, 1.0);

Methods

toHex(pattern)

webgl/ov-Color.js, line 305

轉換成16進制字串

Name Type Description
pattern String

格式("RGB"、"RGBA"、"ARGB")

Example

var color = new ov.Color(255, 127, 0, 0.5);
color.toHex("RGB");//"#ff7f00"
color.toHex("RGBA");//"#ff7f007f"
color.toHex("ARGB");//"#7fff7f00"

toRGB()

webgl/ov-Color.js, line 329

轉換成rgb()格式字串

Example

var color = new ov.Color(255, 127, 0, 0.5);
color.toRGB();//"rgb(255, 127, 0)"

toRGBA()

webgl/ov-Color.js, line 339

轉換成rgba()格式字串

Example

var color = new ov.Color(255, 127, 0, 0.5);
color.toRGBA();//"rgba(255, 127, 0, 0.5)"