Drag & Drop Todo list Animation help

Hi. I’m trying to create a drag and drop todo list animation, where dragging the todo to the right moves the todo to the top of the list. I want the animation to be:

Todo is dragged to the right.
A “holding” element moves in from the left to fill the void and signal that the Todo is being moved.
The Todo moves to the top of the list.
Smart Animation reorders the list to fill in the missing todo with a todo from lower in the list.

Problem is, when I test my current animation in “Present” it won’t let me drag the todo to the right though, it only lets me drag it upward to trigger the animation.

The animation I trying to create is basically the same as this email inbox animation;

If I attached the Figma file would anyone possibly be kind enough to take a look at it for me and let me know where the bug is?

many thanks

1 Like

Hey Josh, I’d be happy to take a look! Could you reply with either a link or a .fig file so I could jump in and look around?

In the mean time I’ll try recreating what you described in my own file.

1 Like

This was a really fun puzzle to work on! I don’t get to do much mobile app interaction work. Here’s what I came up with:

I made a component with two variants to manage the “states” (there’s probably a better, more specific word than this) for a to-do item. The “To do” state and the “Move to-do to top” state that is revealed on drag. These are using auto layout:

Then I took instances of these components and arranged them in an auto-layout frame horizontally and set them to fill all available space, which is great because that means they’re equal widths just like in the video tutorial! I compentized this frame, and added a second variant. The first has both the “To do” and “Move to top” drag signal visible, and the second one hides the “to-do” instance:

After that I set up my first of the three necessary prototyping frames. It has a list of 3 to-do items. This prototype will move “:banana: Bananas” to the top of the list. Notice that the containing frame’s auto layout is right aligned, and a fixed width that matches exactly the width of the to-do item:

frame 2

Then I made a copy of this frame and adjusted “:banana: Bananas” variant from “pre-drag” to “post-drag” and reduced the width to fit the container frame. In the following GIF I do this manually until it snaps into place, but you might be able to just set the width to “fill” and get the same result. The interaction on the first frame to this second one is an “on drag” interaction on the “:banana: Bananas” to-do item.

frame 3

And finally I needed 1 last copy where “:banana: Bananas” replaced “:apple: Apples” as the top to-do item. The interaction between the second and third frame is an “After delay”, which I admit doesn’t look smooth, but it does the job.

Here’s view-access to the Figma file I used to take these screenshots and GIFs, in case you’d like to have a closer look at the layers and auto layout settings. You can also check out the working prototype!

1 Like

Thanks so much Alice. This is fantastic! Exactly the interaction I was looking for. The tutorial I was following didn’t mention using different variants to represent the 2 different states, so this is really helpful.

The “get a copy of this file” link in the Figma project seems to link to this project file (below) though, not the todo list project. Is there anywhere I can copy the file?: Alice's Figma Forum Workshop File | Figma Community

1 Like

Sorry, I can see the todo list now on the Prototyping page. Whats the best way to copy this page/frame into my existing project so I can copy my styling over? Do I just click and drag to select all the elements then copy/paste into my file?

There are a couple more interactions I need help with. Is there a way I can share the project file with you privately?

I’m glad this gets you where you need to be!

For getting the components out of the copy you grabbed and into the file you’re working out of, I’d recommend cutting and pasting. Copy/paste might get the same result but I always cut/paste when moving main components between files.

I’d be happy to take a look, yeah! I should have some time this evening (I’m based on the east coast). How about we move this conversation either to DMs on twitter, or email? Whatever you prefer works for me :sparkles:

1 Like

Thanks. Yeah I was afraid of leaving an animation or something behind. I’m in the UK (5h ahead) so might be easier to just email you for now. Shall I just email via your contact form? Also, do I need an email address to share the project with you?

Sounds good, let’s do email! Yes, best way to kick off an email conversation with me is through the contact form on my site :pray: when I reply to your message you’ll have my email address which you can use to invite me to your file.

1 Like