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

What is Framer? Join the Community
Return to index
Stephen Thunder Nixon
Posted May 24 - Read on Facebook

Fairly basic question I haven't yet been able to figure out from the documentation/googling for it:

How do I add simple properties to a layer from a Sketch import without repeating myself a lot?

For example, I have a fixed header which I want to have a drop shadow state given by Framer (I'll later trigger this state on content scroll, see the attached photos for an example of what I'm going for). However, doing this only seems to work like this:

#
sketch.second_header.shadowY = 2
sketch.second_header.shadowColor = "rgba(0,0,0,0.2)"
sketch.second_header.shadowBlur = 3
#

whereas I would expect it to be something like

#
sketch.second_header.states.add
stateA:
shadowY: 2,
shadowColor: "rgba(0,0,0,0.2)",
shadowBlur: 3
#

BUT, the second version won't work. What am I doing wrong between identifying a layer from Sketch, then giving it properties?

6 Comments

Anton Jarl

What does won't? Do you get any errors?

Trevor Phillippi

I use props when I need to modify a bunch of properties at once

Stephen Thunder Nixon

Awesome, this is such great help!

Stephen Thunder Nixon

So, this works really well (and even animates nicely when the next state is triggered!) for adding properties in a new state

Stephen Thunder Nixon

And to simply add properties, this works great

Stephen Thunder Nixon

Thanks so much, Anton and Trevor!

Read the entire post on Facebook