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

What is Framer? Join the Community
Return to index
Logan Merriam
Posted Aug 12 - Read on Facebook

Is there a way to reference one property of a layer in another property when creating a layer? Trying to do something like:

layerName = new Layer
width: 100
x: this.width

14 Comments

Jordan Robert Dobson

I don't think so... I typically would create an object for this... only if I had more values like that to store though. For only one it's a little silly.

layer = { w: 100 }

myLayer = new Layer width: layer.w, x: layer.w

Jordan Robert Dobson

Here's an example: http://jrdn.io/cDFn

Logan Merriam

awesome! new workflow for complex layers. very helpful

Jordan Robert Dobson

Logan - The problem is that this.width wouldn't exist yet because it's not even created yet. When your defining the properties, it's still just a definition at that point... so you'd have to wait until after you've created it to do something similar to what you were looking for.

Logan Merriam

i figured as much--i'm currently just doing this:

Jordan Robert Dobson

You could also do checkboxInput.maxX = checkboxContainer.width

Jordan Robert Dobson

You definitely want to learn to use maxX, midX, maxY, midY etc... :D

Logan Merriam

that's exactly what i need, feelin kinda silly for not checking the docs for such a common use case

Jordan Robert Dobson

You can use it when you create the layer too!

Jordan Robert Dobson

new Layer width: 50, maxX: checkboxContainer.width :D

Logan Merriam

yeah i noticed that, super cool! one curious thing i couldn't seem to do though "midY: container.midY"

Jordan Robert Dobson

I'm getting it working over here.

Logan Merriam

scratch that, I am mixing up midY with half the height of the container

Read the entire post on Facebook