Z.ImageTexture
Description
Section titled “Description”The Z.ImageTexture object represents an image file loaded for use as a texture on an object.
The following formats are supported:
- PNG
- JPEG
Both dimensions of the image file must be an even power-of-two number of pixels in size, for example 512px x 256px. ZapWorks Studio automatically resizes images that are dragged into the Media Library in order to meet this criteria.
The following recommendations are made to minimize download times and CPU usage:
- Prefer JPEG for images that don’t require transparency
- Don’t use textures above 1024px by 1024px in size
- Use an image compacting utility, such as ImageOptim
Most functions that accept Z.ImageTexture arguments can also accept filenames directly and will automatically create a Z.ImageTexture object. Use Z.ImageTexture directly when it is necessary to control texture parameters (e.g. position, or wrap).
Example
Section titled “Example”var mytexture = Z.ImageTexture("snakes.png");mytexture.scale([0.5, 0.5]);mytexture.wrap(Z.Texture.Wrap.clamp);
var myplane = Z.Object("plane.aro");myplane.skin(mytexture);