Unity Itween



Using iTween animations in your Unity game
Need to script an animation in Unity, but can not remember exactly how? Look no further. Here is an overview of the most used iTween animation features.

So was is iTween exactly?
iTween is a great script animation framework which you can download for free from the Unity Asset Store
With iTween you can move, rotate, fade, scale, control variables, colors and more!

  • Unity, C#, and iTween. Ask Question Asked 3 years, 11 months ago. Active 3 years, 11 months ago. Viewed 832 times 0. I have a script which makes an object rotate when you click on it. I would like to see if adding iTween to it would improve the motion, but where should I add it?
  • ITween is a tweening kit for Unity that is in the same style as TweenLite, Tweener and others in the tween format that is common for flash tween libraries in Actionscript 3. This library is available in javascript and C# for Unity 3d Projects and is quite fast and solid.

If you are new to Unity/iTween or scripting I strongly recommend that you watch the video tutorial first – otherwise, just have fun with the examples. You’ll find iTween download links etc. at the bottom of this page.

Basic MOVE animation:

For example, I was having issues rotating exactly 90 degrees when using Unity's built-in transform.Rotate. I was getting 90.00001 or 89.99999 degrees a lot and after rotating for a few times, it would add up that inaccuracy, which isn't very good if you need to rotate both, accurately and a lot of times. Unity UI Elements Move Animation Using iTween. Ask Question Asked 2 years, 5 months ago. Active 2 years, 5 months ago. Viewed 3k times 0. I was using iTween for giving animation to each main menu elements. But animation not get played as per desire thinking, something different is running so I become confused about this for a solution. Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.

Basic SCALE animation:

Basic FADE animation:

Basic ROTATE animation:

Using EASE IN/EASE OUT:

Get a list of all the easeTypes in the Inspector:

Using ONCOMPLETE after animation:

DELAY the animation:

Create animation LOOPS:

Tween a variable:

STOP tweens/animations:

Links:

πŸ€“ Stay sharp! Subscribe to Oxmond Tutorials!
https://bit.ly/SubscribeOxmondTutorials

βœ… Download iTween (yes, it’s free):
https://assetstore.unity.com/packages/tools/animation/itween-84?aid=1100l4p9k

βœ… Download 2D Game Starter Assets from the video tutorial above:
https://assetstore.unity.com/packages/2d/environments/2d-game-starter-assets-24626?aid=1100l4p9k

🎱 More Free Assets from the Unity Assets Store:
https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k

πŸ˜·πŸ‘• Need a face mask / funny developer T-shirt? Drop by my merchandise shop and get a 20% DISCOUNT on your first purchase by using the discount code YOUTUBE. Just follow this link:
https://shop.oxmond.com/discount/YOUTUBE

Some links might be affiliate links. Any support is truly appreciated so we can keep on making high quality content πŸ™‚

It can be obtained on the official website: https://itween.pixelplacement.com/index.php

Let's try to simulate a small area for our tests.
First of all, connect iTween-package from the Asset store: https://www.assetstore.unity3d.com/en/ , we should see something something like that:

Create a new scene with such content:

Cube - is the object that we are going to animate. Now we move on iTween. Create a new script component type C # at our facility. Fill method Start:

Run and see the result.

Let's Let us examine the script line by line.

Method RotateFrom used to rotate an object. Unlike RotateTo and RotateBy, RotateFrom used to initialize the specified rotation angle and rotate to their original condition. Method, like most others, has an overload. You can use a short or long version:

We pass gameObject - an object that is the current script. In order not to write something like:

Unity Itween Tutorial

We use iTween.Hash - Express version of Hashtable. As we pointed arguments y = 90.0f, is equivalent (if x and z are zero, of course)

The rotation, which begins our rotation.

Time that should be spent for animation. There are similar argument called 'speed', in his case does not indicate the time, but
the rate at which the animation will be held. The last argument, which we pointed it easetype = iTween.EaseType.easeInExpo. easetype waveform is to be used for interpolation. Here is a graphical representation of curves:

Move From similar to the previous one, it should be understood simply used instead of the rotation movement.

ShakePosition used in this case in order to implement the 'shaking' the camera. This method makes you move an object by decreasing amplitude, does not use interpolation, the object will appear at random points in the designated part of him. There is a new argument called 'delay', it is quite important option animation is used to specify the number of seconds that must elapse before the start of the animation.

Color To smoothly change the color of an object over time.

ScaleTo, changes the size of the object.

RotateBy reminds RotateFrom, necessary in cases where the object you want to deploy more than 360 degrees (although in this case we could have done by RotateTo). Suppose we have indicated z = 2.0f, it would mean that the object must turn twice around the Z axis for a certain period of time.

MoveTo, probably, the main method of the whole class iTween. He moves the object to the specified coordinates in the allotted time. The interpolation is based on all the same easetype, which you already know.

Itween Path

CameraFadeAdd creates a new object that is used to simulate the blackout. The depth varies from the current value of the specified arguments. The following overload:

If no Texture2D, will be used black color.
From what I have described, there are few more important things. For example, in the arguments, you can specify the method that will be invoked upon the occurrence of some event. Let's say:

We used a new method arguments MoveTo:

Unity

shorthand, relevant 'x', 5.0f, 'y', 1.0f, 'z', 0.0f

At the end of the animation (or iteration of the loop animation) method is called with the specified name.

Type animation. In this case, indicate the normal cycle, the animation will be played endlessly, at the beginning of each animation object will be moved to the starting position.
On this, perhaps, done. Thank you for your attention.

Unity Itween

All data posted on the site represents accessible information that can be browsed and downloaded for free from the web.

https://habrahabr.ru/post/220837/

Dotween Itween