Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: jess84 on December 13, 2013, 05:22:10 PM

Title: Animated status bar?
Post by: jess84 on December 13, 2013, 05:22:10 PM
Hi,

So I want to have a status bar representing a cooldown timer on my GUI.

Ideally I'd like it to be a gradient filling up from red to green over say a 5 second period.

I'm not really sure where to start with this though. Any ideas? I'm assuming something like this has been discussed before, but I couldn't find anything (other than related to levelloading)
Title: Re: Animated status bar?
Post by: phannDOTde on December 13, 2013, 07:12:54 PM
easyiest way to to the "scale" is using a Sprite and scale it from 0-1. As you can setup the Pivot at the Sprite Corner you dont have to re-adjust the position while scaling. Color change can be done with color interpolation i think.

greets
Peter
Title: Re: Animated status bar?
Post by: jess84 on December 14, 2013, 06:26:04 PM
thanks for the reply.

I don't quite get it though - how am I supposed to link the scaling to my timer? and which scale to use? "scale GUI"?
Title: Re: Animated status bar?
Post by: jess84 on December 14, 2013, 06:28:58 PM
Do you know if anyone has shared (or even documented) how'd they've done this on the forum? It seems like a pretty standard thing - but a few searched didn't throw up any examples.
Title: Re: Animated status bar?
Post by: phannDOTde on December 15, 2013, 01:05:42 AM
Here I made you a simple Sample of what I meant. An Left anchored Gauge changing fillings and color over 5 Seconds.  Hope that helps. If you need to change the Pivot change it at the Sprite Inspector.

greets
Peter
Title: Re: Animated status bar?
Post by: phannDOTde on December 15, 2013, 01:06:54 AM
Forgot to mention - To make it a gradient instead of plain color you may have to change the graphics I used
Title: Re: Animated status bar?
Post by: jess84 on December 15, 2013, 01:21:16 AM
Thanks! That worked perfectly using my cooldown float :)

One (noob) question though... how would I get that to work as a GUI item on my HUD, rather than being an object within the 3D scene?
Title: Re: Animated status bar?
Post by: phannDOTde on December 15, 2013, 05:08:30 AM
I prefer 3D Items - just attache it to you camera if you want to keep it in place
Title: Re: Animated status bar?
Post by: jess84 on December 15, 2013, 12:28:05 PM
thanks, you're a star... all sorted!
Title: Re: Animated status bar?
Post by: jess84 on January 05, 2014, 09:38:15 PM
I thought I'd post a follow-up query here instead of posted a new thread;

If I want an animated status bar in a circular shape instead; 
E.g.

(http://www.hatchingdisaster.com/meter.png)

How would I approach this? I'm guessing it's a hell of a lot more complex than the horiztonal one?
Title: Re: Animated status bar?
Post by: jeanfabre on January 06, 2014, 08:41:25 AM
Hi,

 NGUI has a circular gauge in its toolbox so that would be sorted.

Else, yes, indeed it will be a lot more involving.

I would contact this author to see if his primitives can do truncated shapes like this circular gauge.
https://www.assetstore.unity3d.com/#/content/7382

bye,

 Jean
Title: Re: Animated status bar?
Post by: phannDOTde on January 08, 2014, 06:56:15 AM
easyiest way I could think of would be to do this in an 20 Frame long 2D animation and interpolate between Spritesnumbers somehow.