Image

extends Mark

The Image class represents an image mark. To create an Image object, use the mark method in the Scene class, for example:

    let img = scene.mark("image", {x: 50, y: 100, width: 20, height: 20, src: "icon.png"});

Properties

propertyexplanationtypedefault value
heightthe height of the imageNumber100
srcthe url of the image contentString
widththe width of the imageNumber100
xthe x coordinate of the left border of the imageNumber0
ythe y coordinate of the top border of the imageNumber0

Properties inherited from Mark

propertyexplanationtypedefault value
bounds the bounding rectangle of the imageRectangle
dataScopethe data scope of the imageDataScopeundefined
fillColorthe fill color of the imageColorundefined
id the unique id of the imageString
opacitythe opacity value of the image (between 0 and 1)Number1
strokeColorthe stroke color of the imageColorundefined
strokeDashthe dashes and gaps for the image strokeStringundefined
strokeWidththe stroke width of the image in pixelsNumberundefined
type the type of the imageString“image”
visibilitywhether the image is visible (“visible” or “hidden”)String“visible”

Methods

methodexplanationreturn type
resize(width, height)change the width and height of the image
width (Number): width
height (Number): height
void