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

What is Framer? Join the Community
Return to index
Mike Stężycki
Posted Jul 16 - Read on Facebook

Hey Framer community. Quick question, is there an easy way to define a layers property as a value that can be used to manipulate? For instance, I know the height of layerA and I want to move layerA down by its height using:

one: { y: -"#{layerA.height"} }

Is something like this possible?


Joshua Tucker

Hey Mike! Yes you can.

layerA = new Layer height: 100
one: {y: -layerA.height}

However in this instance, are you meaning that the reference to layerA's height has to be dynamic? When creating the state, it will use layerA's height as defined above. If you were to change the height somewhere later in your code and then call layerA's state "one," it would still use 100 because that's when it was defined.

Thomas Rekers

This will move layerA down by its default height property (100px), if thats what your aiming to do. You need an extra line that switches from the default state to the "movedown" state.

Jordan Robert Dobson

I've been using a function for the value with some success in my sprite animation work. I'll post an example in a bit once I'm back from breakfast with the family.

Mike Stężycki

Ah thanks guys! Massive help :)

Jordan Robert Dobson

Here you go! This is a simplified version of how I've used it!

Mike Stężycki

Cheers bro, this is so helpful!

Jordan Robert Dobson

Sure! Check out my other post on this and see the message by Koen and my update:

Read the entire post on Facebook