Answers for "circular objects javascript"

0

circular objects javascript

//Canvas method
const canvas = document.createElement('canvas')
const c = canvas.getContext('2d')

c.beginPath()
c.ellipse(x, y, width, height, 0, 0, Math.PI * 2)
c.closePath()
c.fillStyle = 'red'
c.fill()

//Div method
const newDiv = document.createElement('div')
newDiv.style.background = 'red'
newDiv.style.height = 100
newDiv.style.width = 100
newDiv.borderRadius = 50%
document.getElementById('parent').appendChild(newDiv)
Posted by: Guest on March-01-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language