Complete the code to set a linear gradient fill in Figma.
node.fills = [{ type: 'GRADIENT_LINEAR', [1]: [{ position: 0, color: { r: 1, g: 0, b: 0 } }, { position: 1, color: { r: 0, g: 0, b: 1 } }] }];The property to define the colors and positions in a linear gradient fill in Figma is gradientStops.
Complete the code to set the direction of the linear gradient in Figma.
node.fills = [{ type: 'GRADIENT_LINEAR', gradientStops: [{ position: 0, color: { r: 0, g: 1, b: 0 } }, { position: 1, color: { r: 0, g: 0, b: 0 } }], [1]: [[0, 1, 0], [1, 0, 0]] }];The gradientTransform property defines the direction and scale of the linear gradient in Figma.
Fix the error in the code to correctly apply a linear gradient fill with two colors in Figma.
node.fills = [{ type: 'GRADIENT_LINEAR', gradientStops: [{ position: 0, color: { r: 1, g: 1, b: 0 } }, { position: 1, color: { r: 0, g: 1, b: 1 } }], gradientTransform: [1] }];The gradientTransform must be a 2x3 matrix represented as an array of two arrays with three numbers each, like [[1, 0, 0], [0, 1, 0]].
Fill both blanks to create a linear gradient from red to blue with a vertical direction in Figma.
node.fills = [{ type: 'GRADIENT_LINEAR', [1]: [{ position: 0, color: { r: 1, g: 0, b: 0 } }, { position: 1, color: { r: 0, g: 0, b: 1 } }], [2]: [[0, 1, 0], [1, 0, 0]] }];Use gradientStops to define the colors and gradientTransform to set the vertical direction of the gradient.
Fill all three blanks to create a linear gradient fill with green to yellow colors and a diagonal direction in Figma.
node.fills = [{ type: 'GRADIENT_LINEAR', [1]: [{ position: 0, color: { r: 0, g: 1, b: 0 } }, { position: 1, color: { r: 1, g: 1, b: 0 } }], [2]: [[1, 1, 0], [1, -1, 0]], [3]: true }];Use gradientStops for colors, gradientTransform for diagonal direction, and visible to make sure the fill is shown.