Lean Transition allows you to smoothly animate GameObject and Component settings from their current values, to new values.
Transitions can be as simple as fading menus in and out, to complex sequences with many different branches.
Transitions can be set up in the editor, as well as from code, using exactly the same procedure!
First, add transition components to your GameObject. If you click the Add Component button and type in "Transition", you will see a list of all available components. For example, the Transform.localPosition Transition (LeanTransformLocalPosition) component can be added to your GameObject, allowing you t alter the Transform component's localPosition setting.
Next, you must begin the transition. This can be done using many different methods:
First, you must use the Lean.Transition namespace. Put this at the top of your source file:
using Lean.Transition;
This namespace includes all the extension methods for you to use.
Next, simply replace your normal code with transition variants. For example:
// Instantly change our transform component's localPosition to 10, 10, 10
transform.localPosition = new Vector3(10, 10, 10);
Can be turned into:
// Gradually change our transform component's localPosition to 10, 10, 10 over 0.5 seconds
transform.localPositionTransition(new Vector3(10, 10, 10), 0.5f);
It's as simple as that!
Ease functions allow you control how a value transitions from its original value to its target value.
The advanced list of ease functions contains most ease methods commonly seen in other software, though their names may be hard to understand. You can view more information online on sites like THIS.
Simply add the LeanJoin component between them.
You must call the JoinTransition() method between them. For example:
transform.
localPositionTransition(new Vector3(10, 10, 10), 0.5f).
JoinTransition().
localPositionTransition(new Vector3(1, 1, 1), 0.5f);
Instead of connecting transitions with the LeanJoin component, use the LeanJoinDelay component.
Instead of calling the JoinTransition() method, use the JoinDelayTransition() method. For example:
transform.
localPositionTransition(new Vector3(10, 10, 10), 0.5f).
JoinDelayTransition(5.0f).
localPositionTransition(new Vector3(1, 1, 1), 0.5f);
Instead of connecting transitions with the LeanJoin component, use the LeanJoinInsert component.
Instead of calling the JoinTransition() method, use the JoinInsertTransition() method. For example:
transform.
localPositionTransition(new Vector3(10, 10, 10), 0.5f).
JoinInsertTransition(gameObjectWithTransitions).
localPositionTransition(new Vector3(1, 1, 1), 0.5f);
The JoinDelay and JoinInsert features are same as Delay and Insert, except they automatically have a Join placed at the start and end.
Instead of connecting transitions with the LeanJoinInsert component, you can manually add the LeanJoin and LeanInsert components.
Instead of connecting transitions with the LeanJoinDelay component, you can manually add the LeanJoin and LeanDelay components.
Instead of calling the JoinDelayTransition() method, you can manually call the JoinTransition() and DelayTransition() methods.
Instead of calling the JoinInsertTransition() method, you can manually call the JoinTransition() and InsertTransition() methods.
By default, all transitions are executed in Update, using Unscaled Time.
To change this, simply modify the settings of the LeanTransition component in your scene. If your scene doesn't contain this component, then make a new GameObject and add it.
Insert the LeanTime() component into your transition, and all transitions after it will use the specified time.
Simply call the TimeTransition() method, and all transitions after it will use the specified time.
You can add the LeanEvent component into your transition, and make the event call a custom function.
Simply call the EventTransition() method, and the specified action will be invoked after the specified time. For example:
transform.EventTransition(() => Debug.Log("Hello World!"), 1.0f);
Here's a list of all my other assets, please check them out!
You can also view this list on my Asset Store page.
Rapidly develop your game with consistent input across desktop & mobile using Lean Touch. This lightweight asset comes with many modular components, allowing you to customize them to your exact project needs!
Lean Touch+ is an extension to the popular Lean Touch asset, adding many more example scenes.
Lean Localization is a localization library that's designed to be as simple to use as possible for both designers, and programmers.
Quickly optimize the performance of your games using Lean Pool. Within minutes you can use this lightweight asset to preload, recycle, and limit the spawning of your prefabs.
Quickly polish your games using Lean Transition. This asset allows you to easily tween or animate almost anything in your game, making it transition smoothly.
Lean GUI is a colllection of components that extend Unity's GUI system, allowing you to rapidly enhance the user experience (UX) of your game's UI.
Lean GUI Shapes allows you to quickly add lines, rounded boxes, polygons, and much more to your GUI!
Lean Texture allows you quickly modify textures in your project with a range of filters, pack them together into channels, and much more!
Lean Texture+ is an extension to Lean Texture, adding many new types of texture modification tools!
Paint all your objects using Paint in 3D - both in game, and in editor. All features are optimized with GPU accelerated texture painting, so you can enjoy consistent performance, even if you paint your objects one million times!
FLOW allows you to add large scale interactive fluids to your scene - all highly optimized using GPU acceleration.
Unlock the full potential of your 2D games using Destructible 2D, this asset allows you to quickly convert all your boring solid sprites into fully destructible ones!
Quickly make the space scene of your dreams using Space Graphics Toolkit. This huge collection of space effects can be customized and combined in any way you like, allowing you to quickly make realistic or fantasy worlds. Each feature has been heavily optimized to run on almost any device and platform.
Enhance your space scenes using this large pack of high detail volumetric planets. These planets are finished using the powerful planet features from Space Graphics Toolkit (not required).
Unity sounds only emanate from a single point source. This is great for explosions and footsteps, but quite often you need something more advanced. Volumetric Audio is an easy to use package that allows you to define boxes, spheres, capsules, paths, or meshes that sounds can emanate from.
Added transition builder tool.
Added Stop demo scene.
Added Skip demo scene.
Added Repeat demo scene.
Added LeanGameObjectPool.GetClones method.
Renamed LeanAnimation component to LeanManualAnimation.
Renamed LeanTransition.CurrentHead property to PreviousState.
Renamed vector element transitions (e.g. from "positionTransitionX" to "positionTransition_x").
Added LeanAnimationRepeater.RemainingCount setting.
Removed LeanAnimationOnce component (use LeanAnimationRepeater instead).
Fixed transition players starting with a Speed of 0.
Zero duration transitions now instantly execute.
Added advanced ease types.
Moved main build to Unity 2018.4.13f1.
Simplified LeanPlayer code.
Added per-transition settings to LeanPlayer.
Transitions with quaternions now show euler angles in inspector.
JoinDelay Transition (LeanJoinDelay) now accepts a negative delay time.
All nested transitions now begin after the last transition in the parent completes.
Updated component documentation link.
Renamed auto fill button to fill.
Fill button is now always visible for component that can be filled.
Added Time demo scene.
Added Transform.position.x transition.
Added Transform.position.y transition.
Added Transform.position.z transition.
Added Material float transition.
Added Material color transition.
Added Material vector transition.
Added transition class name to component path name.
Organized transition component names into folders.
Fixed transition timing implementation.
Fixed auto fill button not appearing for transitions without targets.
Added Time.timeScale transition.
Updated common library code.
Fixed issue where transitions wouldn't stop when exiting play mode.
Updated Common library code.
Updated demo scene design.
Added Transform.position transition.
Fixed bug when adding multiple events to the same object.
Allowed LeanPlayer.Speed to be toggled off.
This is the base class for all transition methods.
Each time this transition method registers a new state, it will be stored here.
This will take the input linear 0..1 value, and return a transformed version based on the specified easing function.
This allows you to get the current Target value, or an aliased override.
This class allows you to reference Transforms whose GameObjects contain transition components.
If these transition components define TargetAlias names, then this class will also manage them in the inspector.
This stores a list of all Transforms containing transitions that will be played, and their settings.
This method will begin all transition entries.
This is the base class for all transition states. When you register a transition (e.g. LeanTransformLocalPosition), it will return an instance of this class, allowing it to be updated by the transition manager.
The transition will complete after this many seconds.
The current amount of seconds this transition has been running (-1 for pending Begin call).
If this transition is chained to another, then this tells you which must finish before this can begin.
If this transition is chained to another, then this tells you which will begin after this finishes.
If this is enabled then the current transition will no longer update, but will otherwise act as normal and not be removed. This is so any transition chain can still work as expected.
This tells you how many seconds remain until this state completes.
If you want this transition to begin after another completes, then call this method.
This will instantly skip this transition to its final state.
This will instantly skip this transition to its final state, and all others joined to it.
This will stop this transition at its current position.
This will stop this transition at its current position, and all others joined to it.
This class stores additional base data for transitions that modify a target UnityEngine.Object (most do).
This is the target of the transition. For most transition methods this will be the component that will be modified.
This component updates all active transition methods, both in game, and in the editor.
This allows you to set where in the game loop animations are updated when timing = LeanTime.Default.
This stores a list of all active and enabled LeanTransition instances in the scene.
This property gives you the first DefaultTiming instance value.
This tells you how many transitions are currently running.
After a transition state is registered, it will be stored here. This allows you to copy it out for later use.
If you want the next registered transition state to automatically begin after an existing transition state, then specify it here.
This allows you to change where in the game loop all future transitions in the current animation will be updated.
This allows you to change the transition speed multiplier of all future transitions in the current animation.
This allows you to change the alias name to UnityEngine.Object association of all future transitions in the current animation.
This method will return the specified timing, unless it's set to Default, then it will return UnscaledTime.
This method works like GetTiming, but it won't return any unscaled times.
If you failed to submit a previous transition then this will throw an error, and then submit them.
This will reset any previously called CurrentTiming calls.
This will reset any previously called CurrentQueue calls.
This will reset any previously called CurrentSpeed calls.
This will reset the CurrentTiming, CurrentQueue, and CurrentSpeed values.
This will submit any previously registered transitions, and reset the timing.
This will begin all transitions on the specified GameObject, all its children, and then submit them.
If you failed to submit a previous transition then this will also throw an error.
This will begin all transitions on the specified GameObject, and all its children.
This will begin all transitions on the specified Transform, and all its children.
This method returns all TargetAliases on all transitions on the specified Transform.
How do the ease functions work?
How do I combine transitions to make a sequence?
How do I add a delay between transitions?
How do I insert transitions to save time?
How do I delay or insert without joining?
How do I change the transition timing?
How do I perform a custom action?