Author Topic: Label SpacingX & SpacingY -> float  (Read 4021 times)

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Label SpacingX & SpacingY -> float
« on: December 28, 2013, 05:16:25 AM »
Hello!
I was wondering, why dont you set spacingX propery from int->float
(Same in NguiText - remove RoundToInt: )
NGUIText.spacingY = Mathf.RoundToInt(mScale * mSpacingY);

With float properties it is possible create fancy text tween animations, like here: steamdefense.com (From main menu go to Options->Cast, when it is showing "Steam Defense" name)

Attaching TweenSpacing script
I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Label SpacingX & SpacingY -> float
« Reply #1 on: December 28, 2013, 05:00:55 PM »
You can still do this. Don't animate the spacing value directly. Animate some local value that will then RoundToInt and set the spacing value. If floats are used, printed text won't be pixel-perfect. It will be blurry.

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: Label SpacingX & SpacingY -> float
« Reply #2 on: December 29, 2013, 02:58:10 AM »
Even with local value - the problem stays, if i want a slow spacingX animation. If using RoundToInt - there are very visible steps, it special, when spacingX has big value. The only way to get slow animation - removing this RoundToInt. The text really is a bit blurry during animation, but animation looks great.

Have captured animation video (sorry for bad quality) - is it possible to make something like this without float values?
http://www.youtube.com/watch?v=zdVVs9rfDJ4#t=20
I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Label SpacingX & SpacingY -> float
« Reply #3 on: December 29, 2013, 06:17:25 PM »
Hmm... interesting. I'll give it some thought.