GithubHelp home page GithubHelp logo

jeffreylanters / unity-tweens Goto Github PK

View Code? Open in Web Editor NEW
582.0 13.0 39.0 2.41 MB

An extremely light weight, extendable and customisable tweening engine made for strictly typed script-based animations for user-interfaces and world-space objects optimised for all platforms.

License: MIT License

C# 100.00%
unity animation tweens easing

unity-tweens's Introduction

stars followers sponsors

Hello there, thanks for checking out my GitHub profile! My name is Jeffrey Lanters, born and currently living in The Netherlands. Although I initially started my studies in game development and design, I eventually fell in love with application and web development, leading me to discover the incredible open-source community. Which now, I take great pride in contributing to both game and application development within.

In recent years, I co-founded my own studio; Hulan, where we combine our passion for technology and design to create a diverse range of products. Our creations includes everything from serious games to dashboards, and from virtual reality experiences to artificial intelligence applications. Feel free to come by if you're nearby!

日本のゲームへの愛から、私は2022年に日本語の勉強を始めました。私はまだお気に入りのRPGを字幕なしでプレイするには長い道のりがありますが、それは見逃したくない冒険です!自由に日本語で話しかけてください。英語やオランダ語でも構いませんよ!そして、良いゲームのおすすめがあればいつでも歓迎します。

Feel free to use any of my modules. If you're using any of these modules for production purposes, please consider sponsoring me to support my open-source projects. It means the world to me and truly enables me to continue doing what I love. Your support is immensely appreciated! Thank you!

Raccoon Charlie

unity-tweens's People

Contributors

alexmeesters avatar bajtix avatar jeffreylanters avatar sam-ln avatar stefankohl-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unity-tweens's Issues

overshoot parameter?

Describe the bug
A clear and concise description of what the bug is.

What exactly is the parameter for the SetOvershooting function?

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

URP VolumeWeightTween

Describe the bug
VolumeWeightTween.cs throws an error when using URP

To Reproduce
Steps to reproduce the behavior:

  1. Happens right after installation on latest URP, Unity 2021.1.17f1

Additional context
This issue is most likely caused by a missing '{' in the script.

Tween/Driver script added even after Stop game in Editor during async method (actually Unity's limitation)

Describe the bug
If adding Tween as part of an async method, and stopping the game while it's still running, the async method will keep running, possibly running tweens and adding dirty Tween Driver components on game objects in the scene, that will stay and be saved in the scene.

Sometimes, you'll also see error messages about runtime script on that game object, it's related to the Driver leftover, as removing it removes the error messages.

GameObject (named 'Team Logo Text (TMP)') references runtime script in scene file. Fixing!

Unfortunately, this is due to a limitation of Unity that will keep running all async methods after Stop in Editor, as they are not really controlled, and the user may want to use this behaviour for Tool functionality in the Editor.

See: https://forum.unity.com/threads/non-stopping-async-method-after-in-editor-game-is-stopped.558283/

Since there is not much to do to stop this behaviour without adding code on the project itself (see the 2 workarounds in the thread above), I'm only suggestion to, at least, check for if (Application.isPlaying) before adding a component to the game object, the only effect that really bothers me after stopping the game. Obviously, I put more complex stuff in my async method, that will run too and I may have troubles anyway, but at least I'll be able to avoid the unwanted runtime components sticking to my game objects and being saved in my scene.

To avoid extra code in Builds, you may surround the isPlaying check with #if UNITY_EDITOR

Tested with Graphic Alpha Tween only.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project with package "git+https://github.com/jeffreylanters/unity-tweens"
  2. Create script SplashScreenManager with multiple tweens chained:
using System.Threading.Tasks;
using UnityEngine;

using ElRaccoone.Tweens;

/// Splash Screen Manager
public class SplashScreenManager : MonoBehaviour
{
    [Header("Scene references")]
    
    [Tooltip("Team logo")]
    public GameObject teamLogo;


    private async void Start()
    {
        await PlaySplashScreenSequence();
    }

    private async Task PlaySplashScreenSequence()
    {
        // fade-in
        await teamLogo.TweenGraphicAlpha(1f, 1f).SetFrom(0f).Await();
        await Task.Delay(Mathf.RoundToInt(1000 * 1f));
        // fade-out
        await teamLogo.TweenGraphicAlpha(0f, 1f).Await();
    }
}
  1. Add it to some SplashScreenManager game object
  2. Create Image (it will automatically be added on a Canvas) "TeamLogo" and set a dummy sprite like "Background" on it, just so it's visible.
  3. Run the game, and try to stop the game at different moments. If you stop if right after fade-in is over (after 1s), it should pop a Driver (meant for the following fade-out) on TeamLogo, that sticks in the scene.

Expected behavior
No Driver should be added outside Play

(or they should be removed automatically by some editor script; they probably are on game quit actually, it's just that another one is re-added afterwards)

Screenshots

image

and if you repeat the operation:

image

Desktop (please complete the following information):

  • OS: Linux Ubuntu
  • Unity: 2021.1.14f1
  • Tween code version: v1.11.1

Additional context
I'm testing my splash screen as you may have guessed, after seeing many errors on runtime scripts I spot the issue.

Workaround
Use coroutines instead of async methods...

Can I tween any public property of any MonoScripts instead of modify the tween lib?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

How to get reference of a Tween?

say i start a tween animation with the following code:
transform.TweenSpriteRendererAlpha(0.65f, 2).SetFrom(0).SetPingPong().SetInfinite().SetEaseSineInOut();
how do i find a reference of this tween and later on in time cancel the tween using .cancel()???

thanks in advance, great tool

Incorrect Tween Duration

Describe the bug
Depending on the chosen duration for a tween, the time passes faster or slower than expected, causing the tween to finish too soon or too late.

To Reproduce
Attach any tween to a GameObject with a duration different from 1.
View the tween in the "Tweens" window.
The time within the tween will pass 5x slower if a duration of 5 seconds was chosen, totalling a run time of 25 seconds.

Additional context
The behaviour is caused by this line.

var timeStep = deltaTime / duration;

I'll create a pull request with a fix shortly.

Errors on install

After installing via git link I get:

Library\PackageCache\nl.jeffreylanters.tweens@c4f2322175\Runtime\Core\TweenEngine.cs(6,66): error CS8124: Tuple must contain at least two elements.

Library\PackageCache\nl.jeffreylanters.tweens@c4f2322175\Runtime\Core\TweenEngine.cs(6,67): error CS1526: A new expression requires (), [], or {} after type

Unity 2020.3.24f

360 rotation tween functions don't work.

Describe the bug
360 rotation tweens doesn't seem to be working.

To Reproduce
Steps to reproduce the behavior:

  1. Create an object in the scene.
  2. run TweenLocalRotationX function on it, eg:
gameObject.TweenLocalRotationX(360f, 1f).SetEaseBackIn()

Expected behavior
Object should rotate 360 degrees around x Axis over 1000ms.

Screenshots
N/A

Desktop (please complete the following information):

Smartphone (please complete the following information):
N/A

Additional context
N/A

Please add a ease function for evulating a customized curve instead of fixed one of inner ease function.

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Extend TweenRotation with Quaternion parameter

Is your feature request related to a problem? Please describe.
I want to TweenLocalRotation to an old rotation, but the Quaternion rotation doesn't fit the Vector3 parameter.

Describe the solution you'd like
TweenLocalRotation(Quaternion to, ...)

Describe alternatives you've considered
Manually arrange and convert all values?

Awaitable tweens

Tweens 3.0 looks shiny! It'd be nice if it still supports Tasks like it did in 2.0 though. Completion handlers are okay but they break the logic flow a bit 🌵

TweenGraphicAlpha doesnt work for animators using Image module

Describe the bug
For some reason TweenGraphicAlpha doesnt work for image renderers rendering a sprite animation.

To Reproduce
Steps to reproduce the behavior:

  1. use sprite animation on Image module, call TweenGraphicAlpha on the gameobject.

Expected behavior
the sprite animation should fade in or fade out depending on argument of TweenGraphicAlpha

Desktop (please complete the following information):

  • Windows Editor, Unity 2018.4.8f1

Replace Yield with Await, and add Yield for coroutines

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Rename "definitions.asmdef" assembly definition with name easier to search

Is your feature request related to a problem? Please describe.
When referencing this package's assembly from another assembly, the "definitions" file is hard to search. Intuitively you would type things like "Tween" or "ElRaccoone" in the asset search bar, but because it searches by asset file name, not package nor assembly name, it would not find it.

Describe the solution you'd like
Rename "definitions.asmdef" into one of these:
a. "nl.elraccoone.tweens.asmdef" (matches assembly name, rigorous)
b. "Elraccoone Tweens.asmdef" (readable name, just enough to distinguish it from other tweens)
c. "Tweens.asmdef" (matches folder name, but not distinguishable from other tweens - although projects rarely combine two tween systems)

With solutions a. and b., searching :elraccoone" or "tween(s)" will work. With c., only searching "tween(s)" will work.

Describe alternatives you've considered
Alternatives are described in a. b. c. already.
The current workaround is to search "definitions" instead, but for new users it's hard to guess, they'd have to open the package folder and check the asmdef file themselves.

Additional context
Screenshots

Trying to search with "elrac":

image

Searching with "defini":

image

Note the assembly name (currently domain-style) on the left side. In other projects, it matches the asmdef file name.

Add TweenAnchorMin/Max

Is your feature request related to a problem? Please describe.
I wanted to animate the Anchors Min property of a RectTransform, but it turns out I can only change the anchored position with TweenAnchoredPosition.

Describe the solution you'd like
Add extensions TweenAnchorMin and TweenAnchorMax / classes AnchorMinTween and AnchorMaxTween that is similar to TweenAnchoredPosition / AnchoredPositionTween, but in OnUpdate, it sets anchorMin/Max instead.

Describe alternatives you've considered
For now I have to make my own timer and update code to set anchorMin/Max manually every frame.

Unable to add package via Package Manager UI or direct edit of manifest.json

Windows 10, Unity 2020.3.14

When I attempt to add the package using the package manager UI and the github URL I get this error in the Console:

[Package Manager Window] Unable to add package [https://github.com/jeffreylanters/unity-tweens.git]:
The file [C:\projects\redacted\Library\PackageCache@7ac349b\package.json] is not valid JSON:
Unexpected token "}" (0x7D) in JSON at position 591 while parsing near "...aster/LICENSE.md",\r\n}\r\n"
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

I get similar parsing error when I add the entry to my manifest.json directly.

Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.