Syntax
setStyle(style)
setStyle(style, layer)
Parameters
- style
- An object that contains visual styles.
- layer (Optional)
- A drawing layer or an array of drawing layers to apply visual styles to.
- If this argument is omitted, visual styles will be applied to Core.prototype.front and Core.prototype.back.
Return value
none
Visual styles
An object with the following properties. All properties are optional and only those specified apply.
- fill
- The color that fills the background of graphic elements. The initial value of the default element is white.
- stroke
- The color of lines and outlines of graphic elements. The initial value of the default element is black.
- stroke-width
- Width of lines and outlines of graphic elements. The initial value of the default element is 1. You can pass the return value of BasicCreator.prototype.getWidth() as is.
In addition to these, you can set attributes available on the <svg> graphic elements.
Examples
const core = new jmotion.Core("#board");
const style = {
    "stroke": "blue",
    "stroke-width": 3,
};
core.setStyle(style);