Created
January 7, 2016 07:39
-
-
Save lyaunzbe/d772001eeb7a5ba12680 to your computer and use it in GitHub Desktop.
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
tRad = 250; | |
centerA = p.createVector(p.windowWidth/2, p.windowHeight/2); | |
centerB = p.createVector(centerA.x-125, centerA.y); | |
centerC = p.createVector(centerA.x+125, centerA.y); | |
} | |
p.draw = function() { | |
bg = p.color(74,201,255, 20); | |
// if (mouseIsPressed){ | |
// scale(1.5); | |
// } | |
centerA.x -= 2.1; | |
// console. | |
p.fill(p.color(250,0,162)); | |
p._triangle(createTriangle(centerA, tRad)); | |
p.fill(p.color(148,239,114)); | |
p._triangle(createTriangle(centerC, tRad)); | |
p.fill(p.color(249,136,160)); | |
p._triangle(createTriangle(centerB, tRad)); | |
p.background(bg); | |
} | |
function createTriangle(center, radius) { | |
let x_offset =radius*(Math.cos(Math.PI/6)); | |
let y_offset =radius*(Math.sin(Math.PI/6)); | |
let triangle = { | |
a : p.createVector(center.x - x_offset,center.y + y_offset), | |
b: p.createVector(center.x + x_offset,center.y + y_offset), | |
c: p.createVector(center.x, center.y - radius) | |
}; | |
return triangle; | |
} | |
} | |
} | |
function toRadians (angle) { | |
return angle * (Math.PI / 180); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment