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

What is Framer? Join the Community
Return to index
Rob Jones
Posted Jun 09 - Read on Facebook

Is there a property for the *original" value of a layer property? Specifically, I want the x and y position of a layer as imported from Generator.

It's easy enough to save this manually I know, but just curious.

13 Comments

Johannes Eckert

Maybe there is a default state by default (even before you added any other states) that you can look into its options?

William Hutter

I'm wondering too how to save the properties you declare when you create a new Layer into some sort of variable so that I can come back to the original state when needed.

Johannes Eckert

After you created a layer, simply create your own variables on the layer, like layer.originalX = layer.x

William Hutter

thanks :) so no way to put them all in one variable ?

Johannes Eckert

Hm, maybe layer.options is actually a thing that has them all?

Johannes Eckert

I would try to find out if you can read them from the layer.states.default

William Hutter

ha yes, good idea

Koen Bok

You can also just save the state of a layer by doing:
layerProperties = layer.properties

William Hutter

amazing

Koen Bok

Also note that you can pass that into an animation if you want directly:

savedProperties = layer.properties

[whole bunch of other stuff]

layer.animate({properties: savedProperties})

Ale Muñoz

I think Cemre had something like that on https://github.com/facebook/shortcuts-for-framer?

Jay Walter Robinson

Yup. Cemre’s (CoffeeScript) version is:

for layerGroupName of PSD
PSD[layerGroupName].originalFrame=window[layerGroupName].frame

Jay Walter Robinson

So you can write Layer.animate({ properties: { x: Layer.originalFrame.x } })

Read the entire post on Facebook