All Projects → tomblind → unity-async-tweens

tomblind / unity-async-tweens

Licence: MIT, Unknown licenses found Licenses found MIT LICENSE Unknown LICENSE.meta
Tween Extension to Unity-AsyncRoutines

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to unity-async-tweens

Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+4212.5%)
Mutual labels:  coroutines, await
Concurrencpp
Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all
Stars: ✭ 340 (+2025%)
Mutual labels:  coroutines, await
Co2
A C++ await/yield emulation library for stackless coroutine
Stars: ✭ 278 (+1637.5%)
Mutual labels:  coroutines, await
ProtoPromise
Robust and efficient library for management of asynchronous operations in C#/.Net.
Stars: ✭ 20 (+25%)
Mutual labels:  coroutines, await
is-async-function
Is this a native `async function`?
Stars: ✭ 17 (+6.25%)
Mutual labels:  await
LetsChat
LetsChat is a Sample Messaging Android application built to demonstrate the use of Modern Android development tools - (Kotlin, Coroutines, Flow, Dagger-Hilt, Architecture Components, MVVM, Room, Testing, Coil, DataStore) and Firebase
Stars: ✭ 71 (+343.75%)
Mutual labels:  coroutines
M2A01 MuSimpron
Small yet powerful state machine coroutine library
Stars: ✭ 34 (+112.5%)
Mutual labels:  coroutines
of
🍬 Promise wrapper with sugar 🍬
Stars: ✭ 13 (-18.75%)
Mutual labels:  await
ws-promise
A tiny, Promise-based WebSocket protocol allowing request-response usage in ECMAScript
Stars: ✭ 20 (+25%)
Mutual labels:  await
hxasync
This library allows you to add "async" and "await" keywords in Python and JavaScript code almost the same way you would do it in the native code.
Stars: ✭ 21 (+31.25%)
Mutual labels:  await
MusicPlayer
Android music player example.
Stars: ✭ 20 (+25%)
Mutual labels:  coroutines
NewsReader
Android News Reader app. Kotlin Coroutines, Retrofit and Realm
Stars: ✭ 21 (+31.25%)
Mutual labels:  coroutines
DownloadX
Download tool based on kotlin and coroutine.
Stars: ✭ 111 (+593.75%)
Mutual labels:  coroutines
Simple-Note-App-with-Online-Storage
✍️ Simple Note Making App use Sqllite Room 🧰 for caching the notes and 📥 Firebase Database for online storage
Stars: ✭ 42 (+162.5%)
Mutual labels:  coroutines
ComposeMovie
Movie app that built with Jetpack Compose
Stars: ✭ 96 (+500%)
Mutual labels:  coroutines
helo
A simple and small low-level asynchronous ORM using Python asyncio.
Stars: ✭ 18 (+12.5%)
Mutual labels:  await
kmm
Rick & Morty Kotlin Multiplatform Mobile: Ktor, Sqldelight, Koin, Flow, MVI, SwiftUI, Compose
Stars: ✭ 52 (+225%)
Mutual labels:  coroutines
SketchwareManager
Coroutine-based library for managing Sketchware (Sketchware Pro/Studio) projects, collections and etc.
Stars: ✭ 54 (+237.5%)
Mutual labels:  coroutines
think-async
🌿 Exploring cooperative concurrency primitives in Python
Stars: ✭ 178 (+1012.5%)
Mutual labels:  coroutines
synchronicity
Synchronicity lets you interoperate with asynchronous Python APIs.
Stars: ✭ 41 (+156.25%)
Mutual labels:  await

Unity AsyncTweens

Tween Extension to Unity-AsyncRoutines

Basic Usage

using AsyncRoutines;
using AsyncTweens;

public class Foo : MonoBehaviour
{
    public RoutineManagerBehavior routineManager;

    public void Start()
    {
        routineManager.Run(Bar());
    }

    public async Routine Bar()
    {
        //Tween self to 1,1,0 over 2 seconds
        await Tween.Position.To(transform, new Vector3(1, 1, 0), 2);

        //Tween to a relative position from the current
        await Tween.Position.ToOffset(transform, new Vector3(-1, -1, 0), 2);

        //Tween from a position to the current
        await Tween.Position.From(transform, new Vector3(2, 2, 0), 2);
    }
}

Aside from position, there are built-in tweeners for other Transform properties (eulerAngles, localScale, etc...) and properties on other objects as well (SpriteRenderer.color, RectTransform.anchoredPosition, etc...).

Easings

Tweeners optionally take an easing function to control the speed throughout the animation. For convenience, a number of standard curves have built-in functions. You may also write your own custom easing function. Another option is to use a Unity AnimationCurve and pass its Evaluate method.

public class Foo : MonoBehaviour
{
    public AnimationCurve curve;

    public async Routine Bar()
    {
        //Built-in curve function
        await Tween.Position.To(transform, new Vector3(0, 0, 0), 2, Easing.QuadInOut);

        //Custom easing function
        await Tween.Position.To(transform, new Vector3(1, 1, 0), 2, MyCustomEasing);

        //AnimationCurve
        await Tween.Position.To(transform, new Vector3(2, 2, 0), 2, curve.Evaluate);
    }

    public static float MyCustomEasing(float i)
    {
        return i * i;
    }
}

You can also use the Easing type to enable setting the function from Unity's Inspector window.

public class Foo : MonoBehaviour
{
    public Easing easing; //Allows you to select a built-in easing function or set an animation curve

    public async Routine Bar()
    {
        await Tween.Position.To(transform, new Vector3(2, 2, 0), 2, easing);
    }
}

Custom Tweeners

More tweeners for common Unity properties will be added over time, but you can add your own easily.

using AsyncRoutines;
using AsyncTweens;
using UnityEngine.Tilemaps;

public class Foo : MonoBehaviour
{
    public static Tweener<Color, Tilemap> tilemapColorTweener = new Tweener<Color, Tilemap>(
        (tilemap) => tilemap.color, // getter
        (tilemap, color) => tilemap.color = color //setter
    );

    public Tilemap tilemap;

    public async Routine Bar()
    {
        await tilemapColorTweener.To(tilemap, Color.black, 1);
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].