This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Ash Adamson
Posted Mar 31 - Read on Facebook

Is there a simple way to create a function that keeps track of all changes and returns them to their original frames? Call it reset() for example. It envision it would work like how the reload button hard resets the project. Except, because it's a function, it could be automatically called on AnimationEnd.

My limited understanding of how framer works would be to create some kind of for loop to go through every variable that changes and log the original frame, then return all of them to the original frame when called. This seems like too much, there must be a more elegant solution.

10 Comments

Jordan Robert Dobson

Perhaps that could be calling the default state on a layer?

Johannes Eckert

hm, you can "record" every change in a new state. First state.add and then changeInstant to that state. This way, you can easily go back to the "default" state, but you would also be able to do a history of all changes by doing state.previous

Ash Adamson

So to think about resetting everything, I would need to assign states to each event, and then call default?

Johannes Eckert

yes, the initial state is always accessible by layer.states.switchInstant "default"

Ash Adamson

So to think about resetting everything, I would need to assign states to each event, and then call default?

Jordan Robert Dobson

Do you need to set other states besides default ?

Koen Bok

You can also loop through all layers in a context and set the original frame as a property.

Alexis Morin

The library Shortcuts for Framer does this. It's quite useful. Check it out, Ben Adamson https://github.com/facebook/shortcuts-for-framer

Utkarsh Mishra

Johannes Eckert: I tried this, but it didn't set my layers' properties to default.

Does now, any such function exists which resets the properties of layer to default?

Read the entire post on Facebook