The aim of this puzzle: Add the bullseye circle to the target
Walkthrough of the solution: To add a new shape to the screen, you use .append()
. The argument of .append()
is a string that says what kind of shape you want to create. In this puzzle, it should be a 'circle'
. It should have a radius of 30, so set its 'r'
attribute to 30. It should also be colored red. You can change the color by setting the 'fill'
attribute.
Sample code solution:
(Tap below to reveal)
let outer = svg.append('circle').attr('r',90).attr('fill','red');
let inner = svg.append('circle').attr('r',60).attr('fill','white');
let bullseye = svg.append('circle').attr('r',30).attr('fill','red');
D3 Concepts: .append()
, .attr('fill',)
, .attr('r',)
Additional Code (hidden code that runs before the puzzle’s code):
var svg = canvas.append('g');
svg.attr('transform',`translate(${window.innerWidth/2},${window.innerHeight/2})`);