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

What is Framer? Join the Community
Return to index
Aditya Narayan
Posted Aug 23 - Read on Facebook

Hi everyone, I created a bunch of compound objects in Framer design mode, now I have to create multiple of these with different data using "for" loop. But I can't seem to find an option to do it.

The one solution that I found was to create "class" and basically create new object, but all the examples I found were building the class in code itself.

Would appreciate help with this :)


Derek Nguyen

I think you could do `newObject = existingObject.copy()` in your loop and then access the inside layers with newObject.children

Matthew Mang

You have 2 options: going the copy route as Derek suggested or building the object in code using the design view object properties. Of the two options, the latter is a bit easier for targeting purposes. Also keep in mind that copies do not carry over constraints from design view.

Matthew Mang

The latter method unfortunately also does not maintain design view constraints. As far as I know, there currently is no method that does that. The method I outlined would be something like this:

newObject = new Layer
size: designViewObject.size

The main advantage to this method is that you can target the new layers by variable instead of by designView.copy().children[x]

Matthew Mang

Thinking about it some more, one way you can get the goodness of design view constraints from a direct copy or a code-based copy that references the original is that you can resize the original design view object, then animate the copy to the design view object's new properties

Aditya Narayan

I am trying out both, will post the results.

Read the entire post on Facebook