Rect transform question!! please help!!
Greetings everyone,
I am trying to make a app that has this card view like structure and a hamburger nav bar on the side. Now , i have a game object with several card like structures in it and they are far apart vertically . I want them to move to a specific POS Y position everytime i click from the side bar (nav bar) .
example : i click on home in nav bar , i want the specific card to come down . if i click settings , that card should come down. for that i need to access the POS Y anchored position of rect transform.
I want cards to move like how a one page parallax scroll would work in html5. Is there anyway to access the Pos Y of rect transform or animation from frame to frame. Thanks , please help :).
EDIT : User DiegoSLTS , solved it . Thankyou soo much!! :)
some Screenshots of app :
You may want to take a look at the Unity UI Extensions Project, it is found here: Unity UI Extensions on BitBucket. There is a couple of controls in that collection that allow for a scroll view to snap to a location. Specifically, the VerticalScrollSnap control should be able to handle exactly what you are trying to do, have a look and see if it might help: Vertical Scroll Snap Overview
Thankyou so much for telling me this , Trickyhandz . I will try it out for sure . :)
So with this , if i press a button can i make one object lerp to another object and even scroll up and down and make those objects snap to the scene? :)
Thankyou soo much . i saw this , it has really cool stuff and it has a native date picker too . I am loving it , thankyou soo much !! :)))
I saw that horizontal scroll snap and jump to i think that will solve my problem !!
Answer by DiegoSLTS · Aug 21, 2016 at 04:07 PM
https://docs.unity3d.com/ScriptReference/RectTransform-anchoredPosition.html
Note that anchoredPosition works as expected only for certain anchor modes, you might need to use sizeDelta too to get the proper y position of a RectTransform.
Thanks , is there a way to control the frames of animation like if i want to play from 5.0 to 8.0 and then after that i want to go from 3.0 to 1.0?
And with size delta i would be able to move the pos y of the rect transform??
Thankyou for reading. :)
You can move the y position of the rect transform just by setting a Vector2 to anchoredPosition, but that does what you want only for certain anchor modes (the ones that show the y position in the inspector). For other modes anchorPosition must be used in conjunction with RectTransform.sizeDelta and RectTransform.pivot, it's all explained in the docs.
As for your animation question, you should ask that as a new question, but I wouldn't even try that. Ins$$anonymous$$d of trying to execute parts of a big animation, split it into different animations (one with frames 5, 6, 7 and 8; another with frames 3, 2 and 1), since that's what you're actually doing, playing different animations.
Hi Diego , thanks for the answer.
I have a full game object in canvas which has child objects in it like in form of cards , i want them to move them up and down to a certain position like -1500 Pos Y or if i press another button it should go down like 500 Pos y and then another button i clicked on , it should go up to like -1000 pos Y. I only want to move the parent object which has these child objects. I want it to lerp from one card to another with pos y.
All i want to do is make a lerp effect , if you see the html5 one page scroll . You will understand what i want to make .
If nothing works i will just go for the enable and disable game object. :<
Thanks for reading. :)
Your answer
Follow this Question
Related Questions
Creating a dynamic animation system for a card game. 0 Answers
Is there an "IF" statement for "RectTransform"? 1 Answer
Animation not playing 0 Answers
Get and modify animation clip keyframes using a script? 0 Answers
Big sprite textures with animations appears distorted and flickers, only in build. 2 Answers