beauprime / beauroutine Goto Github PK
View Code? Open in Web Editor NEWCoroutine and tweening framework for Unity3D
License: Other
Coroutine and tweening framework for Unity3D
License: Other
Hi @BeauchesneFilament!
Firstly, thank so much for such an awesome project! It is very clean and new way to code unity that I love so much!
From your example, I see some extension like:
yield return m_RestartButton.onClick.WaitForInvoke();
Now I want to wait for the user to click on the scene. I am thinking about the wait for Input.GetMouseButtonDown but I do not know how to get this
Can you give me an example of how to handle that?
Thank so much!
Hey there,
I am quite impressed at all the things it looks like this package is capable of. Seems like it might be a great choice. I seem to be having a bit of an issue, though. What lead me to find this package was I am trying to do some light tweening at edit time in the scene view. I am trying to make it so when I click on items, such as my waypoint indicators in the sceneview that they animate a bit.
I first tried to use DoTween, but it just doesn't do well outside of playmode. So then I tried implementing this light package that uses normal coroutines which almost seemed like it was going to work. I clicked on a waypoint and it would begin to animate for about 1/4 of a second and then stop. I know the animation was still going because if I manually moved something else around while it was running, the waypoint would animate like it should, but I believe that since it was using normal coroutines, they don't force a sceneview repaint like moving something manually does.
Which is what lead me here, I was hoping that something that was outside of the standard coroutine might be just the thing I needed to bring this all together. The first thing I tried was taking the tween package I was currently trying out and simply replacing it's "StartCoroutine" with a BeauRoutine as seen below:
[ExecuteInEditMode]
...
private Routine routine;
protected virtual void Init()
{
m_Tween = new Tweener<Vector3>(GenericKeys(keys), duration, delay, wrap);
if (m_Tween.Loop != null)
{
m_Tween.OnSetValue += OnSetValue;
m_Tween.OnMoveValue += OnMoveValue;
// StartCoroutine(m_Tween.Loop);
routine = Routine.Start(m_Tween.Loop); // Swapping in BeauRoutine
}
}
protected virtual void Dispose()
{
if (m_Tween.Loop != null)
{
m_Tween.OnSetValue -= OnSetValue;
m_Tween.OnMoveValue -= OnMoveValue;
// StopCoroutine(m_Tween.Loop);
routine.Stop();
}
}
Unfortunately though, I tested that out, and at the point in which the prior coroutine would do the partial tween for 1/4 of a second, I got no response from BeauRoutine. So, I figured I would try to set up a new Tween using BeauRoutine for the whole setup, so I implemented the following:
[ExecuteInEditMode]
public class ArrowVisual : MonoBehaviour
{
public Tween beauTween;
public Routine beauRoutine;
public void PlayAnim()
{
var pos = transform.position;
var currentHeight = new Vector3();
beauTween = Tween.Vector(
new Vector3(pos.x, 1.0f, pos.z),
new Vector3(pos.x, 1.2f, pos.z),
x => currentHeight = x,
1f);
beauTween.OnUpdate(x => transform.position = currentHeight);
beauRoutine = beauTween.Play();
}
public void StopAnim()
{
beauRoutine.Stop();
}
}
Though now, using the "pure Beau" method, I seem to just get the following message in the console:
[Exception] InvalidOperationException: The following game object is invoking the DontDestroyOnLoad method: Routine::Manager. Notice that DontDestroyOnLoad can only be used in play mode and, as such, cannot be part of an editor script.
Manager.Initialize() at /BeauRoutine/Routine/Internal/Manager.cs:309
307: Host.Initialize(this);
308: hostGO.hideFlags = HideFlags.HideInHierarchy | HideFlags.DontSaveInEditor;
-->309: GameObject.DontDestroyOnLoad(hostGO);
311: Log("Initialize() -- Version " + VERSION.ToString());
Is there any chance of me getting edit time tweening working with this package, or am I barking up the wrong tree, so to speak?
Thanks!
-MH
Hi!
I like this very much and using BeauToutine, I can construct code and logic much easier and clear.
For now, I have some old projects that heavy base on DOTween. So can I have something like adapter/bridge class or function to using DOTween with BeauRoutine?
I try some method like this
IEnumerator TweentoBeauRoutine(Tween tween)
{
yield return tween.WaitForCompletion();
}
And then using Yield or Then like this
var routine1 = BeauRoutine.Sequence.Create(transform.GetComponent<SpriteRenderer>().FadeTo(1f,1f)).Wait(1)
.Then(transform.ScaleTo(0.65f,0.2f))
.Then(transform.ScaleTo( 0.55f,0.1f))
.Then(transform.ScaleTo(0.65f,0.05f))
//.Yield(TweentoBeauRoutine(this.Scale(1f,2.0f)))
.Then(() =>
{
print("OK here");
})
;
But DoTween is always executed before Routine.Start(this, routine);
Tween in BeauRoutine is awesome too but it takes time to convert all my DOTween functions to BeauRoutine so I am looking for way to wrapper it.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.