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
xthe x coordinate of the left border of the imageNumber0
ythe y coordinate of the top border of the imageNumber0
srcthe url of the image contentString""
widththe width of the imageNumber100
heightthe height of the imageNumber100
bounds the bounding rectangle of the imageRectangle

Properties inherited from Mark

propertyexplanationtypedefault value
id the unique id of the imageString
type the type of the imageString“image”
dataScopethe data scope of the imageDataScopeundefined
opacitythe opacity value of the image (between 0 and 1)Number1
visibilitywhether the image is visible (“visible” or “hidden”)String“visible”

Methods inherited from Mark

methodexplanationreturn type
contains(x, y)whether this mark contains a point
x (Number): x coordinate of the point
y (Number): y coordinate of the point
Boolean
getScene()returns the scene in which this mark residesScene
duplicate()returns a copy of this markText