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

What is Framer? Join the Community
Return to index
Paresh Ravi
Posted Feb 18 - Read on Facebook

hey guys,

Im trying to learn Framer JS. How to I get a layer to centered on the screen. Here is my code:

layerB = new Layer
backgroundColor:"#2DD7AA",
width:60,
height:60,
layerB.center()

I cant get the layer positioned in the center. I keep getting "undefined is not an object error

3 Comments

Joshua Tucker

Hey Paresh! Welcome to the community. Indentation is super important in CoffeeScript. The layerB.center() needs to be less indented than the properties you set on a layer (because it's not a property of a layer, it's a method).

Paresh Ravi

oh now I get it.. Thank you very much Joshua. :)

Joshua Tucker

Paresh Ravi No problem!

Read the entire post on Facebook