Visual timer? Like CUT THE ROPE

Hey everyone I’m looking to make a simple time based animation, in which a circle (or a clock) is fully coloured, and eventually as time passes by, it gets empty.

A concrete example would be the stars from “cut the rope” which have a timer on them.

(Watch from 20s Onwards)

Please let me know.

Currently, I’m able to destroy the star after a set amount of time using a coroutine and waitforseconds.

Please tell me how I’d get that visual effect to work, thanks!

You could use an animated sprite, and when the animation ends you destroy the object, you would have to create it in photoshop or GIMP.

You can have a script on your clock/circle which has an output, this output can then be used to animate the colour or position of the clock/circle. Hope this helps, here is a simple script that you can use:

using UnityEngine;
using System.Collections;

public class Timer : MonoBehaviour {

	public float timer = 5;
	public float timeleft;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		timeleft = timer - Time.time;

		if(timer <= Time.time)
			Destroy(gameObject);
	}
}