Most visited

Recently visited

AnimatedTexture

public class AnimatedTexture
extends Texture

java.lang.Object
   ↳ com.viro.core.Texture
     ↳ com.viro.core.AnimatedTexture


AnimatedTexture plays animated GIF images from local or remote sources. AnimatedTexture extends from Texture, so it can be used with any Material for display on any geometry. To make an AnimatedTexture for rendering GIF images on a Quad, for example, use:

 AnimatedTexture animTexture = new AnimatedTexture(...);
 Material material = new Material();
 material.setDiffuseTexture(animTexture);

 Quad quad = new Quad(1, 1);
 quad.setMaterials(Arrays.asList(material));

Summary

Nested classes

interface AnimatedTexture.OnLoadComplete

Callback interface for responding to an AnimatedTexture's lifecycle events. 

Public constructors

AnimatedTexture(ViroContext context, Uri uri, AnimatedTexture.OnLoadComplete listener)

Construct a new AnimatedTexture that will play the animation given the provided URI.

Public methods

void dispose()

Release native resources associated with this AnimationTexture.

boolean getLoop()

Return true if the animated texture is currently set to loop after finishing playback.

boolean isLoading()

Return true if the animation is loading.

boolean isPaused()

Return true if the animation is paused.

boolean isPlaying()

Return true if the AnimatedTexture is currently playing.

void pause()

Pauses the animated texture.

void play()

Plays the animated texture.

void setLoop(boolean loop)

Set to true to make the AnimatedTexture automatically loop to the beginning when playback finishes.

Public constructors

AnimatedTexture

AnimatedTexture (ViroContext context, 
                Uri uri, 
                AnimatedTexture.OnLoadComplete listener)

Construct a new AnimatedTexture that will play the animation given the provided URI. If a AnimatedTexture.OnLoadComplete is provided, its success or failure callbacks will be triggered once the image data has been loaded.

Parameters
context ViroContext

uri Uri

listener AnimatedTexture.OnLoadComplete

Public methods

dispose

void dispose ()

Release native resources associated with this AnimationTexture.

getLoop

boolean getLoop ()

Return true if the animated texture is currently set to loop after finishing playback.

Returns
boolean True if loop is enabled.

isLoading

boolean isLoading ()

Return true if the animation is loading.

Returns
boolean True if the animation is loading.

isPaused

boolean isPaused ()

Return true if the animation is paused. The video can be played by invoking play().

Returns
boolean True if the animation is paused.

isPlaying

boolean isPlaying ()

Return true if the AnimatedTexture is currently playing. This returns false if the animation is loading or paused.

Returns
boolean True if the animation is playing.

pause

void pause ()

Pauses the animated texture.

play

void play ()

Plays the animated texture. The animation automatically restarts if had previously ended and loop is set to true.

setLoop

void setLoop (boolean loop)

Set to true to make the AnimatedTexture automatically loop to the beginning when playback finishes.

Parameters
loop boolean: True to loop.

Hooray!