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

What is Framer? Join the Community
Return to index
Mike Kyllo
Posted Apr 14 - Read on Facebook

Hi Framer people,

I am new to all this and have a question that might be easy to answer. I am repeating assets in my prototypes, such as layer and child layers. Is there a way that I can create a variable, copy a layer and child layer and assign the variable to attributes of that set?


Jordan Robert Dobson


a = new Layer
b = new Layer parent: a
c = a.copy()

c.props = rotation: 45

print a, c

Mike Kyllo

Hi Jordan, Thank you, this is going to save me hours. One question with this. I am using the Input Module, that requires me to include: InputModule = require "input"

Mike Kyllo

I would like to reuse this essentially

Adria Jimenez

Mike Kyllo the copy() is a method from Layer. As the Input module inherits from Layer it also has this method. But I don't think it will work copying all the attributes from the Input module like it does for the layer (I haven't read how the copy() method of Layer is implemented). So I can't confirm if it works or it doesn't for the input module.
You can try and if it doesn't work maybe you can try making a pull request to the project, as it's open source it's open for everyone to collaborate :)

Adria Jimenez

I was now thinking, why you don't store all your config variables in a var and then initialize all the inputs with that var? Like...
options =
x: 100, y: 200, setup: false, etc...

And then you can do
input1 = new Input(options)
input2 = new Input(options)


Read the entire post on Facebook