Skip to main content

I am trying to create a plugin that will create a frame inside all parent frames called ‘#watermark’, this is my end goal. But first I need to create a frame inside another and can work out how. Documentation has this:


`// By default, the new node has a white background, width and height both at 100, 
// and is parented under figma.currentPage.
const frame = figma.createFrame()

// Move to (50, 50)
frame.x = 0
frame.y = 550

// Set size to 1280 x 720
frame.resize(500, 350);`

But how can I pin it to a parent frame?


My Page setup is: Page 1 > 3x Frames (Frame One, Frame Two, Frame Three).


Code:


const currentPage = figma.currentPage;
const childFrames = currentPage.findChildren(n => n.type === "FRAME");

Console Logs:



  • PAGE: Page 1 - ID: 0:1

  • CHILD FRAMES: Frame One - ID: 1:2

  • CHILD FRAMES: Frame Two - ID: 1:3

  • CHILD FRAMES: Frame Three - ID: 1:10

figma.com

Reply