Author Topic: Animated UISlider  (Read 5307 times)

gummyb3ar

  • Guest
Animated UISlider
« on: April 28, 2012, 01:11:39 AM »
Is there a way to use animated sprites with the UISlider? Also, is it possible to change how the end of the slider (that moves)? For instance, normally it makes a hard edge at the end, is there a way to change it to a softer edge? I was just wondering if its possible with the current implementation or if I'll have to make some of my own tweaks to the UISlider.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Animated UISlider
« Reply #1 on: April 28, 2012, 01:13:20 AM »
Just change the foreground to use a sprite, or a sliced sprite that doesn't have a border on the right-hand side and you will get the soft edge. Attach UISpriteAnimation to the slider to animate it (or just do it yourself by changing the sprite's spriteName.

gummyb3ar

  • Guest
Re: Animated UISlider
« Reply #2 on: April 28, 2012, 01:23:32 PM »
Thanks for the reply. Just to be sure, I add the UISpriteAnimation to the Foreground and Background of the slider right? And one more question, is there currently anyway for NGUI to tween the 5 or so frames of the animation I make?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Animated UISlider
« Reply #3 on: April 28, 2012, 09:47:31 PM »
That's what UISpriteAnimation does. Give all 5 of your sprites a name that begins with the same syntax, for example "My Animation 0", "My Animation 1", etc. Then on the UISpriteAnimation specify "My Animation" as the prefix.

gummyb3ar

  • Guest
Re: Animated UISlider
« Reply #4 on: April 28, 2012, 11:22:32 PM »
Hmm yeah that's what I've done, but it just cycles through the 5 frames. I guess I'm asking if there's a way to smooth out the motion between each frame?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Animated UISlider
« Reply #5 on: April 28, 2012, 11:23:43 PM »
Smooth it out? You mean fade one in while another is fading out? You'd have to code it yourself.