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:

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

Is something like this possible?

7 Comments

Joshua Tucker

Hey Mike! Yes you can.

layerA = new Layer height: 100
layerA.states.add
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!

http://jrdn.io/byD6

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: https://www.facebook.com/groups/framerjs/permalink/708797955913945/

Read the entire post on Facebook