Wikitude ARchitect v2.0 API Documentation

Wikitude ARchitect > AR > Style
Filters

Class Style

Style options allow the customization of the appearance of various Drawables.

A Style is never created with new, it has to be created using JSON, as described in the example below.

Note that Drawable-types accept only a certain set of properties in Style. The accepted options are listed for each Drawable, other options are simply ignored.

When a Style is passed to a Drawable, the properties are passed by value, modifications on the Style object after applying it to a Drawable will not have any effect on the Drawable's style. Use drawable.style to later customize the Style for a specific Drawable.

Example:
//create a Style, red fill color, green outline
var myStyle = {fillColor : '#FF0000', outlineSize : 2, outlineColor : '#00FF00'};

//applying style options on creation of 2 circles var circle1 = new AR.Circle(40, {style : myStyle}); var circle2 = new AR.Circle(50, {style : myStyle});
//now, we change circle1's fill color to blue. circle2 will not change its color. circle1.style.fillColor = '#0000FF';

Properties

backgroundColor - string

The background color of the Drawable. Can be passed as hexadecimal RGB or RGBA values (see here for details on RGBA colorcoding). In case RGB is used, the alpha value is set to full opacity.
Default Value: #00000000 (transparent)

fillColor - string

The fill color of the Drawable. Can be passed as hexadecimal RGB or RGBA values (see here for details on RGBA colorcoding). In case RGB is used, the alpha value is set to full opacity.
Default Value: #000000FF (solid black)

fontStyle - string

The font style of the text. Valid values are specified in AR.CONST.FONT_STYLE.
Default Value: AR.CONST.FONT_STYLE.NORMAL

outlineColor - string

The fill color of the outline bounding the Drawable. Can be passed as hexadecimal RGB or RGBA values (see here for details on RGBA colorcoding). In case RGB is used, the alpha value is set to full opacity.
Default Value: #00000000 (transparent)

outlineSize - int

Defines the thickness of an outline which is printed from the boundary of the Drawable towards the inside.

Valid values are in the range between 0 and 128. A value of 0 means no outline, a value of 128 covers the entire Drawable.

Example:
var circle = new AR.Circle(20, {
  style : {
    fillColor : '#FFFFFF', //white circle
    outlineColor : '#000000' //black outline
  }
});

circle.style.outlineSize = 0; //no outline, circle appears fully white circle.style.outlineSize = 128; //outline fully covers the circle, circle appears fully black circle.style.outlineSize = 90; //circle appears half black (outer area), half white (inner area)
Default Value: 0

textColor - string

The text color. Can be passed as hexadecimal RGB or RGBA values (see here for details on RGBA colorcoding). In case RGB is used, the alpha value is set to full opacity.
Default Value: #000000FF (solid black)


Copyright © 2013 Wikitude GmbH. All rights reserved.