Reset item positions to original

I have made the breakfast tray items draggable by selecting On drag > Control element position. The check button positions the items into the correct spots using a relative timeline.
The difficulty Im having is creating a simple button to return each item to the starting position. I have tried a new timeline called reset but it doesn't return to the original position if the vertical position of the object has changed.
IS there a simple solution?

It would be very helpful if you could provide your Hype source file.

Just thinking hypothetically, as I haven't looked at the original Hype project, it shouldn't be too difficult to add a "Reset".

First, with the Jigsaw template… …I don't even bother reseting. Players can simply press reload on their browser. :blush:

A button that reloads the page, or uses the JavaScript… reload() …method… …might be a solution.

Of course, “simple solution” is relative. I'd probably just create an array dynamically. At the start of the project, all items with a certain tag… such as a class name …could have their starting positions recorded. Then, when a "reset" is triggered, I can tell each of those elements to go back to their starting position.

It's just a standard multidimensional array with an event, a loop, and applying the Hype JavaScript API — easy! :wink:

But, if you're looking for a non programming solution, why not just go with a new Hype timeline? That would also be "relative". But in that scenario, it means that the starting position is not specified. Then, when the timeline is played, elements can be moved from their current position to a starting position. That's tedious if you have a lot of elements, but pretty simple to do. Here's an example… (13.1 KB)

Here is my Hype file (575.2 KB)

This version resets all items in one reset-timeline and also the vector lines, should 'check' have been clicked before... (476.7 KB)


I tried this myself and couldn't get to to work -thank you everyone.
Im lucky to be part of such a great community - very kind of all of you

I removed my answer, as I probably ran into the issue you were getting when you were trying to do it yourself.

When an element is dragged, its origin point/position for the relative timeline is set to this new current position.
Which means it will not return to the first original point/position you had set on the timeline when you reverse the same relative timeline back to its beginning as I was suggesting.

At first I thought this was to NOT expected behaviour but on reflection I suspect it is and I have not not paid attention enough to relative timelines workings

Yes that was the problem I had but I appreciate you trying

1 Like

Might help:

1 Like