ImageMeshColor
require(["esri/geometry/support/ImageMeshColor"], function(ImageMeshColor) { /* code goes here */ });
esri/geometry/support/ImageMeshColor
ImageMeshColor is a type of mesh color that represents an image mapped to the mesh by its uv vertex attributes. ImageMeshColor instances can be used with the MeshComponent.material.color property. Images can be referred to either by url or directly by data ( image element, canvas element or ImageData).
var meshColorByUrl = new ImageMeshColor({
url: "./image.png"
});
var mesh = Mesh.createBox(location, {
material: {
color: meshColor
}
});
var meshColorByCanvas = new ImageMeshColor({
data: canvasElement
});
var meshWithCanvasMaterial = Mesh.createBox(location, {
material: {
color: meshColorByCanvas
}
});
// Mesh colors support autocasting within a mesh material constructor
var meshWithAutocastMaterial = Mesh.createSphere(location, {
material: {
color: {
type: "image",
url: "./image.png"
}
}
});
// Mesh materials also support additional advanced autocasting types
// such as a Canvas element. In this case the canvas element will be
// available in the ImageMeshColor.element property.
var meshWithCanvasAutocastMaterial = Mesh.createSphere(location, {
material: {
color: canvasElement
}
});
// Here meshWithCanvasAutocastMaterial.material.color is an ImageMeshColor
// instance with its data property set canvasElement
- See also:
Constructors
- new ImageMeshColor(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
HTMLImageElement | HTMLCanvasElement | ImageData | A direct reference to the image data. more details | more details | ImageMeshColor | |
String | The name of the class. more details | more details | Accessor | |
Boolean | Indicates whether the image data should be interpreted as being semi-transparent. more details | more details | ImageMeshColor | |
String | For ImageMeshColor the type is always | more details | ImageMeshColor | |
String | The url to the image resource. more details | more details | ImageMeshColor |
Property Details
- Since: ArcGIS API for JavaScript 4.9
A direct reference to the image data. The image data can be an image element, canvas element or ImageData.
The data property is mutually exclusive with the url property, setting the data will clear the url (if there is one).
- Since: ArcGIS API for JavaScript 4.7
The name of the class. The declared class name is formatted as
esri.folder.className
.
- transparentBooleanSince: ArcGIS API for JavaScript 4.9
Indicates whether the image data should be interpreted as being semi-transparent. The default value is automatically derived when the data property contains a canvas element or an ImageData object. In all other cases it defaults to
false
.- Default Value:undefined
- typeStringreadonly
For ImageMeshColor the type is always
image
.
- urlString
The url to the image resource. This can either be a remote url (absolute or relative) or a data url.
The url property is mutually exclusive with the data property, setting the url will clear the data (if there is one).
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
ImageMeshColor | Creates a deep clone. more details | more details | ImageMeshColor |
Method Details
- clone(){ImageMeshColor}
Creates a deep clone.
Returns:Type Description ImageMeshColor A deep clone of the object that invoked this method.