Create fast and beautiful animations using the free iTween tool.


● Download the free iTween tool here:
https://assetstore.unity.com/packages/tools/animation/itween-84?aid=1100l4p9k

● iTween documentation:
http://www.pixelplacement.com/itween/documentation.php

● Other free Asset Packages at the Unity Assets Store:
https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k
(Asset links sponsored by Unity)


Cube script:

/*   .-------.                             .--.    .-------.     .--.            .--.     .--.        
     |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
     |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
     |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
     Author: Oxmond Tutorials / www.oxmond.com  */


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Cube : MonoBehaviour {

    public float animationTime = 1.0f;
    public iTween.EaseType easetype;

    private bool jumpReady = true;

	void Update () {
        if (Input.GetKeyDown(KeyCode.Space) && jumpReady == true) CubeJump();	
	}

    void CubeJump() {
        jumpReady = false;
        iTween.MoveTo(this.gameObject, iTween.Hash("y", 3.5, "time", 0.4, "easetype", "easeOutSine"));		
        iTween.MoveTo(this.gameObject, iTween.Hash("y", 0, "time", 0.4, "easetype", "easeInSine", "delay", 0.4));		
        iTween.RotateTo(this.gameObject, iTween.Hash("z", transform.rotation.eulerAngles.z - 90, "time", 0.8, "easetype", "easeOutQuint", "oncomplete", "SetJumpReady"));		
    }

    void SetJumpReady() {
        jumpReady = true;
    }
}

Obstacle script:

/*   .-------.                             .--.    .-------.     .--.            .--.     .--.        
     |       |--.--.--------.-----.-----.--|  |    |_     _|--.--|  |_.-----.----|__|---.-|  |-----.
     |   -   |_   _|        |  _  |     |  _  |      |   | |  |  |   _|  _  |   _|  |  _  |  |__ --|
     |_______|__.__|__|__|__|_____|__|__|_____|      |___| |_____|____|_____|__| |__|___._|__|_____|
     Author: Oxmond Tutorials / www.oxmond.com  */

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Obstacle : MonoBehaviour {

void Start () {
        iTween.MoveTo(this.gameObject, iTween.Hash("x", -6.5, "time", 1.4, "easetype", "linear", "looptype", "pingpong"));
    }
}