Texture swap animator

From Unify Community Wiki
Revision as of 20:53, 10 January 2012 by NCarter (Talk | contribs)

Jump to: navigation, search

Author: Eric Haines (Eric5h5)

Description

This script animates a texture on an object by using a series of frames. You can give it a framerate to determine the speed of the animation.

Usage

Attach this script to an object, then set the size of the Frames array and drag all the frames of the animation onto the appropriate slots. Set FramesPerSecond to the desired framerate.

TextureSwapAnimator.js

var frames : Texture2D[];
var framesPerSecond = 10.0;
 
function Update () {
	var index : int = Time.time * framesPerSecond;
	index = index % frames.Length;
	renderer.material.mainTexture = frames[index];
}
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox