I’m trying to show part of an image (texture) bottom up at run time. What I did is keep growing the rectangle of the BeginGroup while also keep updating the relative position of the texture within the group to make sure the image would be seen from bottom to top.
The following is part of the code:
GUI.BeginGroup(new Rect(x,y*Mathf.Clamp01(1-t)+ height,width,height*Mathf.Clamp01(t)));
GUI.DrawTexture(new Rect(0,(-height)*Mathf.Clamp01(1-t),width,height),img);
GUI.EndGroup();
The result is what I want. However, it keeps jitterring (not big jumps but I can see obvious vibration there).
I tried to use Mathf.Lerp and Mathf.SmoothStep also. The problem is still there.
If I just update each of them separately (ex: just update the size of the rectangle or just update the position of the texture),everything looks smoothly. But if I combine all updating together, this issue would occur.
Does anyone has the same issue like this and any idea that can solve it?[/code]