Author Topic: Best way to randomize a Tween animation?  (Read 3576 times)

MKingery

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
    • Persional Blog
Best way to randomize a Tween animation?
« on: February 17, 2014, 06:59:46 PM »
Hey all - artist here so be gentle.

Im looking to find out what (if any) options i have to tweak NGUI's built in tweens into allowing animation variations.

For example when i close a popup i want it to fall away which is easy enough - but adding a rotation tween that randomly picked between 30 and -30 degrees would be icing on the cake. Ideally the curve editor would play out as it does in the Particle System where i can specify a random between 2 constants or 2 curves.

Is this possible without coder intervention? assuming the answer is no - what would be the best ways for me to go about pitching this to code?

Thank you all - hope this is clear enough!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best way to randomize a Tween animation?
« Reply #1 on: February 18, 2014, 09:57:43 AM »
Nope, anything that involves random behaviour has to be coded.
  1. Vector3 euler = new Vector3(0f, 0f, Random.Range(-30f, 30f));
  2. TweenRotation.Begin(targetObject, duration, Quaternion.Euler(euler));

MKingery

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
    • Persional Blog
Re: Best way to randomize a Tween animation?
« Reply #2 on: February 18, 2014, 10:37:51 AM »
understandable and thank you!