Complete the code to add a rectangle shape in Figma.
const rect = figma.createRectangle(); rect.[1](100, rect.height);
The resize method sets the rectangle's width to 100 (keeping height the same), which is essential for defining its size.
Complete the code to set the fill color of a shape to red.
rect.fills = [{ type: 'SOLID', color: { r: [1], g: 0, b: 0 } }];The red color channel uses a value between 0 and 1 in Figma's API, so 1 means full red.
Fix the error in the code to add a text node with content 'Hello'.
const text = figma.createText(); text.characters = [1];The characters property requires a string, so the text must be in quotes like 'Hello'.
Fill both blanks to create a frame and add a rectangle inside it.
const frame = figma.create[1](); frame.appendChild(figma.create[2]());
You create a Frame and then add a Rectangle inside it as a child using figma.createRectangle().
Fill all three blanks to create a blue ellipse with width 150 and height 100.
const ellipse = figma.createEllipse(); ellipse.resize([1], [2]); ellipse.fills = [{ type: 'SOLID', color: { r: 0, g: 0, b: [3] } }];
Call resize(150, 100) to set the size and blue color channel b to 1 for full blue.