Also notice that each time you reload the page, the image is slightly different. This is because I set it up to generate certain aspects randomly.
/** Pi Symbol
* Written on Khan Academy by MathGeek.
*
* This text is a simplified version of the final,
* which can be found at:
* https://www.khanacademy.org/cs/pi/2154631286
**/
var char = "π";
var simple = false;
noStroke();
var val = simple?2:1;
var sh=function(c,s,alpha){
for (var i = 0; i < c; i++) {
var a = random(0,360); var q = simple?15:random(10,20);
var x = cos(a)*300; var y = sin(a)*300;
var x2 = cos(a+q)*300; var y2=sin(a+q)*300;
fill(random(220,255), random(200,255), s, alpha);
triangle(200,200,200+x,200+y,200+x2,200+y2);
}
};
sh(200/val,0,30*val);
textSize(500); textAlign(CENTER, CENTER);
textFont(createFont("Times", 0), 565);
for (var i = 50; i < 600; i += 4*val) {
fill(0, 0, 0, i/30*val); textSize(i); text(char, 200, 203-i/8); }
fill(0, 0, 0, 70);
text(char, 200, 203-i/8);
sh(15,90,10);
* Written on Khan Academy by MathGeek.
*
* This text is a simplified version of the final,
* which can be found at:
* https://www.khanacademy.org/cs/pi/2154631286
**/
var char = "π";
var simple = false;
noStroke();
var val = simple?2:1;
var sh=function(c,s,alpha){
for (var i = 0; i < c; i++) {
var a = random(0,360); var q = simple?15:random(10,20);
var x = cos(a)*300; var y = sin(a)*300;
var x2 = cos(a+q)*300; var y2=sin(a+q)*300;
fill(random(220,255), random(200,255), s, alpha);
triangle(200,200,200+x,200+y,200+x2,200+y2);
}
};
sh(200/val,0,30*val);
textSize(500); textAlign(CENTER, CENTER);
textFont(createFont("Times", 0), 565);
for (var i = 50; i < 600; i += 4*val) {
fill(0, 0, 0, i/30*val); textSize(i); text(char, 200, 203-i/8); }
fill(0, 0, 0, 70);
text(char, 200, 203-i/8);
sh(15,90,10);
No comments:
Post a Comment