Created
August 12, 2018 07:21
-
-
Save hassi32/3b57ad19eda81ba47e4a82c332ecc69a to your computer and use it in GitHub Desktop.
draw radius lines on a circle by p5.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
createCanvas(1000, 600); | |
background(255); | |
strokeWeight(5); | |
smooth(); | |
var radius = 500; | |
var centx = 500; | |
var centy = 300; | |
stroke(0, 10); | |
noFill(); | |
ellipse(centx, centy, radius*2, radius*2); | |
stroke(20, 50, 70); | |
var x, y; | |
for (var ang = 0; ang <= 360; ang += 5) { | |
var rad = radians(ang); | |
console.log('setup -> rad', rad); | |
x = centx + (radius * cos(rad)); | |
y = centy + (radius * sin(rad)); | |
line(centx, centy, x, y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment