public void update(int deltaTime) {

		stateTime += deltaTime;
		// Animate animation
		if (animating) {
			// Cycles through each image in animation
			while (stateTime > timeBtwnImages) {

				stateTime -= timeBtwnImages;
				currentIndex++;
				
				if (currentIndex >= images.length) {
					onAnimationComplete();
					
				}

				// Calculate width of image
				width = (int) (animation.get(currentIndex).width);
				height = (int) (animation.get(currentIndex).height);
			}

			main.image(animation.get(currentIndex), x, y, width * scale, height
					* scale);
			// Traditional Button Rendering
		} else if (images != null) {
			main.image(images[currentIndex], x, y, width * scale, height
					* scale);
		} else {
			main.fill(r, g, b);
			main.stroke(0);

			main.rect(bounds.x, bounds.y, bounds.width, bounds.height);

			main.fill(0);
			main.textAlign(PConstants.CENTER);
			main.text(text, bounds.x + bounds.width / 2, bounds.y + bounds.height / 2 +  5);
		}

	}