[Solved] Using Animation Curve to move Image on Canvas

Hi!

I want to move a couple of Images on a World Space Canvas with Animation Curve, but when i construct the Curve with Keyframes, it takes World Coordinates, so the animation of the Images parented under the Canvas is totally wrong. Outside of the Canvas it’s fine, moving an object from a to b using a constructed Animation Curve is not a problem. But when it’s under the Canvas…
Maybe i have to convert World Space Coordinates to Canvas positions, but i have no idea, how.
(I’m using C#, but i guess its more or less irrelevant…)
Any help would be appreciated.

Thanks in advance!
vS

Here is what the documentation says : Redirect to... title of new-page

When positioning a Rect Transform it’s useful to first determine it has or should have any stretching behavior or not. Stretching behavior happens when the anchorMin and anchorMax properties are not identical.

For a non-stretching Rect Transform, the position is set most easily by setting the anchoredPosition and the sizeDelta properties. The anchoredPosition specifies the position of the pivot relative to the anchors. The sizeDelta is just the same as the size when there’s no stretching.

For a stretching Rect Transform, it can be simpler to set the position using the offsetMin and offsetMax properties. The offsetMin property specifies the corner of the lower left corner of the rect relative to the lower left anchor. The offsetMax property specifies the corner of the upper right corner of the rect relative to the upper right anchor.

Thus, when you set the position of the UI element using the curve, you must not call transform.position, but either GetComponent<RectTransform>().anchoredPosition or GetComponent<RectTransform>().offsetMin