Z.ImageTexture

Inherits from Z.Texture

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

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);

Provided by Z.ImageTexture

Constructor

Z.ImageTexture(...) Constructs a new Z.ImageTexture object.

Functions

source( ) Gets the filename or URL of the image file.
source(...) Sets the filename or URL of the image file.

Inherited from Z.Texture

Enumerations

Channel A color channel of a texture.
Mipmap The mipmapping mode for textures.
Wrap The wrap mode for textures.

Functions

mipmap( ) Gets the mipmapping mode of the texture.
mipmap(...) Sets the mipmapping mode of the texture.
position( ) Gets the position offset of the texture.
position(...) Sets the position offset of the texture.
rotation( ) Gets the rotation of the texture.
rotation(...) Sets the rotation of the texture.
scale( ) Gets the scale of the texture.
scale(...) Sets the scale of the texture.
size( ) Gets the size of the texture.
wrap( ) Gets the wrap mode of the texture.
wrap(...) Sets the wrap mode of the texture.

Inherited from Z.Base

Functions

emit(...) Calls the handler functions attached to an event.
hasTag(...) Returns true if this object has the specified tag.
off(...) Removes a handler function from an event.
on(...) Attaches a handler function to an event.
one(...) Attaches a single-use handler function to an event.
pushTag(...) Adds a tag to this object.
removeTag(...) Removes a tag from this object.
tags( ) Gets an array of the tags that this object belongs to.
tags(...) Sets the array of the tags that this object belongs to.
zapcode branded_zapcode i