Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to draw a straight line using the line tool.
Figma
line = figma.create[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using createRectangle() instead of createLine()
Using createEllipse() which creates a circle or oval
Using createText() which creates text objects
✗ Incorrect
Use createLine() to create a straight line in Figma.
2fill in blank
mediumComplete the code to set the stroke color of the line to red.
Figma
line.strokes = [{ type: 'SOLID', color: { r: 1, g: [1], b: 0 } }] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting green to 1 or 0.5 which adds green tint
Setting blue to non-zero values
✗ Incorrect
To get pure red, green and blue values should be 0.
3fill in blank
hardFix the error in the code to add an arrowhead at the end of the line.
Figma
line.strokeCaps = ['NONE', '[1]']
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ROUND or SQUARE which do not add arrowheads
Using NONE which removes stroke caps
✗ Incorrect
Use line.strokeCaps = ['NONE', 'ARROW_EQUILATERAL'] to add an arrowhead at the end of a line.
4fill in blank
hardFill both blanks to create a dashed arrow line with stroke weight 3.
Figma
line.strokeWeight = [1] line.dashPattern = [[2]]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using strokeWeight less than 3 for visibility
Using dashPattern values too small or zero
✗ Incorrect
Stroke weight 3 makes the line thicker. Dash pattern [5] creates dashes of length 5.
5fill in blank
hardFill all three blanks to create a blue arrow line from (10, 20) to (100, 200).
Figma
line.strokeWeight = [1] line.strokes = [{ type: 'SOLID', color: { r: 0, g: [2], b: [3] } }] line.vectorPaths = [{ windingRule: 'NONZERO', data: 'M10 20 L100 200' }] line.strokeCaps = ['NONE', 'ARROW_EQUILATERAL']
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Setting green or red to non-zero for blue color
Using strokeWeight too thick or too thin
✗ Incorrect
Stroke weight 2 is a good thickness. Blue color means red=0, green=0, blue=1.