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

What is Framer? Join the Community
Return to index
Anton Kosarchyn
Posted Jan 10 - Read on Facebook

Hi, guys and gals)
I'm trying to copy layer (declared as a custom class, eg "album") via layer.copy().
The issue is it's not only copying the content of the layer, but seems it also creates another instance of the same class inside that layer (greyed in the layers tree panel, see the screenshot).
What I'm doing wrong?)



Niels van Hoorn

The problem is that we copy layers by creating new instances of the same layer with the same properties. This means that the constructor of the Album class also gets called when creating a copy, thus creating another set of layers.
I think it's best to move the creation of the new layers to a function outside of the constructor.

Read the entire post on Facebook