Seamlessly swapping scrolled components

TLDR - I have an element with overflow set to scrolling and I would like to swap out the content but retain its position rather than resetting to its initial position

Hi there, below is a link to a lofi version to illustrate what i am trying to do.

figma prototype

Figma Design

I have a gantt chart with 2x zoom levels - zoomed out so you can see its entire length as an overview and zoomed in so that you can see it in detail and scroll around to explore. I also have 2x buttons at the top so that you can compare 2x states - a before and after.

I have created a component that contains the 2x variations of the gantt chart (before and after). And i have created 2x artboards for each state - the first includes the zoomed out version the second contains the zoomed in version both are clipped within a frame and the overflow on the zoomed out one is set to horizontal scrolling.

All is working as expected on the zoomed out version, you can click before and after at the top and easily compare the two gantt charts. BUT when you zoom in and scroll around and then press a button the zoomed in view returns to its initial position which makes it difficult to compare the two charts.

I have tried using interactive components with the gantt chart and the navigation in the same component but the position of the zoomed in section still resets.

Does anyone know a way of doing this? Any suggestions would be much appreciated

The problem is because of you prototyping and layer naming.

Try using smart animate to jump between before and after.

Name image layers the same and smart animate will notice to maintain instead of change

Smart animate was the answer :smiley:
Thank you so much!!
Have a great day