Compare commits

...

3 Commits

Author SHA1 Message Date
lee2sman 93192f750a updated starter code 2021-01-21 04:45:01 -05:00
lee2sman dbd22abbd4 added penColor() and penSize() functions 2021-01-21 04:44:54 -05:00
lee2sman 1fe8572d1d add more commands to reference section 2021-01-21 04:44:35 -05:00
3 changed files with 17 additions and 2 deletions

View File

@ -31,7 +31,11 @@ penup(); //will draw a line with movement commands
pendown(); //will move to x,y coordinates without drawing line
//By default, pendown is on / true
penColor('colorName'); //any color word: purple, grey, blue, etc.
//color name must be in single or double quotes!
//or a HTML color like #ff4d4d (in quotes!)
penSize(n); //width of pen in pixels
//randomness
randint(n); //returns a random int between 0 and n (exclusive)

View File

@ -51,7 +51,12 @@ function pendown(){
function penup(){
drawing=false;
}
function penSize(weight=1){
strokeWeight(weight);
}
function penColor(c){
stroke(c);
}
function randint(max=100){
//default returns int between 0 and 100
return int(random(max))

View File

@ -1,12 +1,18 @@
function turtle(){
penSize(3);
penColor('purple');
right(randint(100));
forward(randint(200));
penup();
right(randint());
forward(randint());
penSize(12);
penColor('#00ff8f');
pendown();
right(randint(45));
forward(randint(300));