Comments (10)
Hey, Thanks for alerting me to this. I haven't played around with the new 2d options too much so I hadn't realized that didn't work.
It's now fixed in the latest version on Github. Let me know if any other 2d-centric things don't work...
I am glad you like it! TweenMax is the best, I did model a lot of how I do things after that great library :)
from leantween.
Unfortunately I can't "fade in" a gameobject but I can "fade out".
This script doesn't work:
gameObject.GetComponent<SpriteRenderer>().color = new Color(1f,1f,1f,0f); LeanTween.alpha(gameObject,1f,5f);
from leantween.
Good catch, I was tweening the *.material.color value and not the *.color like you are doing in your script. I think the way you are doing it is more appropriate, so I committed a change to fix that. If you test the latest it should work...
from leantween.
Awesome ;).
Thanks.
from leantween.
Thanks for the great tween plugin :) One more question to this necro issue: does "LeanTween.alpha(RectTransform)" work with "UnityEngine.UI.RawImage" component? I am using LeanTween 2.34 (Jul 25, 2016) and unfortunately cannot get it work with RawImage. But everything is just fine with the usual Image component.
from leantween.
Unfortunately, it does not. You can however tween the value with LeanTween.value, like:
LeanTween.value( gameObject, 1f, 0.5f, 1f).setOnUpdate( (float val)=>(){
UnityEngine.UI.RawImage r = gameObject.getComponent<UnityEngine.UI.RawImage>();
Color c = r.color;
c.a = val;
r.color = c;
});
I didn't get a chance to test this, but it should work...
And thanks! I am glad you like the plugin :)
from leantween.
Of course LeanTween.value is very versatile and can be used in this case as well. Actually that's exactly what I did, but without lambda expression, in dedicated function. It would be nice to add "RawImage" component support to the LeanTween (like "Image" component). Because currently it is impossible to write "one line tween" to change alpha of the "RawImage". I mean it is somehow inconsistent, that usual "Image" is supported, but "RawImage" is not. Anyway thanks :)
from leantween.
Indeed, it would be pretty easy to add, but I am just worried because to add it will incur a performance penalty for anyone looking to use alpha. Since I think 99% of the time people are just looking to tween a normal image, I would rather avoid the performance penalty for that 99% of the time. Unless people use RawImage a lot? I haven't had to use it myself, so I am not too aware of how much people use it...
from leantween.
I agree, it is a quite rare case, and if it's not worth it (because of a performance penalty), then no need to support it.
I'm curious, so one more question: why "LeanTween.alpha" requires RectTransform to tween UI component's alpha? It make sense if one need to tween values in RectTransform (pos, rot, scale, etc), but alpha value has no relation to a RectTransform. As I can see from Unity.UI sources, all visual components inherits from UnityEngine.UI.Graphic class, so it would be more logical (and type-safe) to pass component itself as an argument:
LeanTween.alpha(UnityEngine.UI.Graphic uiComponent, float to, float time)
instead of
LeanTween.alpha(RectTransform rectTrans, float to, float time)
Any component in Unity is always attached to a GameObject, and GameObject always has a Transform component attached to it. So if LeanTween internally requires GameObject or Transform, they can be easily retrieved from the passed component.
from leantween.
That was just to keep it consistent with all the other Canvas related
tweening methods, this way I can take shortcuts to only check for alpha
stuff related to a canvas object. It might have made more sense to pass a
graphics component like you said, but it was to keep more inline with the
other Canvas methods that I made it that way...
On Sun, Sep 4, 2016 at 4:48 PM, XANDER [email protected] wrote:
I agree, it is a quite rare case, and if it's not worth it (because of a
performance penalty), then no need to support it.I'm curious, so one more question: why "LeanTween.alpha" requires
RectTransform to tween UI component's alpha? It make sense if one need to
tween values in RectTransform (pos, rot, scale, etc), but alpha value has
no relation to a RectTransform. As I can see from Unity.UI sources
https://bitbucket.org/Unity-Technologies/ui/src/8f0a27711670/UnityEngine.UI/UI/Core/?at=5.3,
all visual components https://docs.unity3d.com/Manual/comp-UIVisual.html
inherits from UnityEngine.UI.Graphic class, so it would be more logical
(and type-safe) to pass component itself as an argument:LeanTween.alpha(UnityEngine.UI.Graphic uiComponent, float to, float time)
instead of
LeanTween.alpha(RectTransform rectTrans, float to, float time)Any component in Unity is always attached to a GameObject, and GameObject
always has a Transform component attached to it. So if LeanTween internally
requires GameObject or Transform, they can be easily retrieved from the
passed component.—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#6 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADWwwUk4p08qTgZr-sEJnkYFma5zXNYWks5qmy6ygaJpZM4BavId
.
Twitter - http://twitter.com/DentedPixel
Facebook - http://www.facebook.com/DentedPixel
Website - http://dentedpixel.com
from leantween.
Related Issues (20)
- Any way to know how many instances of LeanTween is running? HOT 1
- isPaused copy-paste error
- Package Manager shipping ? HOT 1
- Please continue this magnificent package. Don't let it die... HOT 3
- "EndlessPiece" has missing script HOT 6
- LeanTween.move inconsistent HOT 3
- LeanTween.delayedCall does not clear when tween finishes
- Editor List renderer problem with Unity 2021.1 or higher.
- Unexpected pause & resume behavior HOT 2
- Documentation website isn't opening HOT 1
- SetFrom with SetDelay
- Does not contain sequence HOT 1
- Type or namespace 'LTSeq' could not be found HOT 3
- Weird bugs from .setIgnoreTimeScale(false) HOT 2
- Errors - Downloaded from Asset store getting Assets\LeanTween\Framework\LeanTweenExt.cs(31,166): error CS1503: Argument 3: cannot convert from 'System.Action' to 'Action' HOT 2
- Documentation Website not available HOT 3
- LeanTween.delayedCall() is bugged/unreliable, will occasionally not perform call HOT 3
- Rotation and Value Tween stopping even when no cancel called HOT 1
- LeanTween.scale seems to run perfectly first run, after it stop to run HOT 2
- Image alpha bug.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leantween.