UI transition that scales depending on the screen

I have an animation that transitions an image when it is clicked:


How can I calculate the height value of my transition depending on the screen? For ex. the height value takes 15% of the screen size

Assuming your parent RectTransform covers the whole screen:

int pxHeight = (transform.parent as RectTransform).rect.height * 0.15;

I would suggest looking into RectTransform.anchoredPosition and co. though, to try and keep as much things as you can in “relative space”.