Skip to main content

Posts

Showing posts with the label c#

Simple Easing Functions for Unity

Super simple, fast and easy to use tweening functions for unity which incorporates optimised Robert Penner's equations. Functions taken from https://github.com/sole/tween.js/blob/master/src/Tween.js and converted for unity by  Fonserbc  /  https://gist.github.com/Fonserbc/3d31a25e87fdaa541ddf#file-easing-cs -------------------------------------------- using UnityEngine;   /* * Functions taken from Tween.js - Licensed under the MIT license * at https://github.com/sole/tween.js */ public class Easing {   public static float Linear ( float k ) { return k; } public class Quadratic { public static float In ( float k ) { return k*k; } public static float Out ( float k ) { return k*( 2f - k); } public static float InOut ( float k ) { if ((k *= 2f ) < 1f ) return 0.5f *k*k; return - 0.5f *((k -= 1f )*(k - 2f ) - 1f ); } ...