added retro() command
This commit is contained in:
parent
d2360b04be
commit
fba260192c
|
@ -69,6 +69,11 @@ Alternatively, a RGB color or RGBA color with transparency can be specified, wit
|
|||
penSize(n)
|
||||
```
|
||||
Width of pen in pixels
|
||||
|
||||
```
|
||||
retro()
|
||||
```
|
||||
Adds a retro filter on the entire drawing. This command can be called anywhere and filter is always applied at the end of the program.
|
||||
|
||||
### Randomness
|
||||
|
||||
|
@ -136,3 +141,4 @@ forward(100);
|
|||
|
||||
- Re-render turtle() after screen resizing
|
||||
- Added new setpos(x,y) function to move turtle to a position. A path will be drawn if the pen is currently down.
|
||||
- add retro() command for retro filter.
|
||||
|
|
12
lib/plogo.js
12
lib/plogo.js
|
@ -2,12 +2,14 @@ let angle,
|
|||
x,
|
||||
y,
|
||||
drawing = true,
|
||||
retroStyle = false,
|
||||
turtleC;
|
||||
function setup() {
|
||||
createCanvas(windowWidth, windowHeight); //canvas is size of window
|
||||
resetDefaults();
|
||||
turtle();
|
||||
displayTurtle();
|
||||
retroFilter();
|
||||
}
|
||||
|
||||
function resetDefaults() {
|
||||
|
@ -80,6 +82,16 @@ function randint(max = 100) {
|
|||
//default returns int between 0 and 100
|
||||
return int(random(max));
|
||||
}
|
||||
function retro() {
|
||||
retroStyle = true;
|
||||
}
|
||||
function retroFilter() {
|
||||
if (retroStyle) {
|
||||
//attempts a 'retro' aesthetic
|
||||
filter(THRESHOLD);
|
||||
filter(BLUR, 3);
|
||||
}
|
||||
}
|
||||
function displayTurtle() {
|
||||
stroke(0, 255, 0);
|
||||
strokeWeight(1);
|
||||
|
|
Loading…
Reference in New Issue