playMaker

Author Topic: Animated status bar?  (Read 6130 times)

jess84

  • Hero Member
  • *****
  • Posts: 515
Animated status bar?
« 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)
« Last Edit: January 05, 2014, 09:38:35 PM by jess84 »

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Animated status bar?
« Reply #1 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

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Animated status bar?
« Reply #2 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"?

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Animated status bar?
« Reply #3 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.

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Animated status bar?
« Reply #4 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

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Animated status bar?
« Reply #5 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

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Animated status bar?
« Reply #6 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?

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Animated status bar?
« Reply #7 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

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Animated status bar?
« Reply #8 on: December 15, 2013, 12:28:05 PM »
thanks, you're a star... all sorted!

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Animated status bar?
« Reply #9 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.



How would I approach this? I'm guessing it's a hell of a lot more complex than the horiztonal one?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animated status bar?
« Reply #10 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

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Animated status bar?
« Reply #11 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.