Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: jgodfrey on February 03, 2016, 09:31:53 PM
-
Using Unity's new UI features, it's my understanding that the proper way to move UI panels on and off of the screen in a resolution independent manner is by modifying the associated RectTransform's anchorMin and anchorMax vectors. Currently, I'm accomplishing that via a sequence of generic tweens something like this:
DOTween.Sequence()
.Join(DOTween.To(() => rect.anchorMin, x => rect.anchorMin = x, new Vector2(1f, 0f), 1f))
.Join(DOTween.To(() => rect.anchorMax, x => rect.anchorMax = x, new Vector2(1f, 0f), 1f))
.SetRelative(true)
.Play();
The above moves the RectTransform 1 full screen to the right without knowing anything about the screen resolution - which is the whole point.
This seems like it might be a reasonable candidate for some "shortcut" methods, such as:
DoAnchorMin(...)
DoAnchorMinX(...)
DoAnchorMinY(...)
DoAnchorMax(...)
DoAnchorMaxX(...)
DoAnchorMaxY(...)
Thanks for your consideration and a GREAT product!
Jeff
-
Additionally, since it's likely that both the min and max anchors will be moved together (to simply tween a UI element on/off the screen), maybe some additional, single-tween variations might make sense:
DoAnchor(Vector2 targetMin, Vector2 targetMax, ...)
DoAnchor(Vector2 relativeTargetBoth, ...)