Compare commits
7 Commits
4fb8e5cbbc
...
7893eca2e2
Author | SHA1 | Date | |
---|---|---|---|
7893eca2e2 | |||
a248e84fc3 | |||
482266f571 | |||
da191ae694 | |||
6315ec29d7 | |||
b147168a0f | |||
94ed08bd34 |
14
README.md
14
README.md
|
@ -10,7 +10,7 @@ A kind of LOGO-like DSL built in the p5.js library.
|
|||
|
||||
This is a rudimentary proof of concept right now with globals and without implementing classes. To write loops or *subroutines* one must use regular javascript.
|
||||
|
||||
![example program](example.jpg)
|
||||
![example logo program image](examples/simple-logo/simple-logo.jpg)
|
||||
|
||||
## How to Use
|
||||
|
||||
|
@ -77,6 +77,11 @@ 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.
|
||||
|
||||
```
|
||||
noConsole()
|
||||
```
|
||||
Turns off the default onscreen display of the program listing.
|
||||
|
||||
### Randomness
|
||||
|
||||
```
|
||||
|
@ -93,6 +98,8 @@ Returns a random int between 0 and n. Specifying a value is optional. If no inpu
|
|||
|
||||
## Examples
|
||||
|
||||
*More examples in the examples folder*
|
||||
|
||||
### Backwards box
|
||||
|
||||
```
|
||||
|
@ -141,6 +148,11 @@ forward(100);
|
|||
|
||||
##### 2021-02-07
|
||||
|
||||
- Added onscreen console print of commands (on by default) and noConsole() to turn off
|
||||
- Added more example files
|
||||
|
||||
##### 2021-02-07
|
||||
|
||||
- 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.
|
||||
|
|
BIN
examples/color-walker/color-walker.jpg
Normal file
BIN
examples/color-walker/color-walker.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 119 KiB |
30
examples/color-walker/turtle.js
Normal file
30
examples/color-walker/turtle.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
function turtle(){
|
||||
|
||||
for (let j = 0; j < 10; j++){
|
||||
|
||||
penup()
|
||||
setpos(0,0)
|
||||
pendown()
|
||||
|
||||
for (let i = 0; i < 2000; i++){
|
||||
|
||||
penSize(randint(255))
|
||||
penColor(color(randint(255),randint(255),randint(255)))
|
||||
|
||||
if (randint()<50)
|
||||
{
|
||||
penup()
|
||||
} else
|
||||
{
|
||||
pendown()
|
||||
}
|
||||
|
||||
forward(randint())
|
||||
right(randint())
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
BIN
examples/retro-random-walker/retro-random-walker.jpg
Normal file
BIN
examples/retro-random-walker/retro-random-walker.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 KiB |
30
examples/retro-random-walker/turtle.js
Normal file
30
examples/retro-random-walker/turtle.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
function turtle(){
|
||||
retro()
|
||||
|
||||
for (let j = 0; j < 10; j++){
|
||||
|
||||
penup()
|
||||
setpos(0,0)
|
||||
pendown()
|
||||
|
||||
for (let i = 0; i < 2000; i++){
|
||||
|
||||
penSize(randint(30))
|
||||
|
||||
if (randint()<50)
|
||||
{
|
||||
penup()
|
||||
} else
|
||||
{
|
||||
pendown()
|
||||
}
|
||||
|
||||
forward(randint())
|
||||
right(randint())
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
BIN
examples/simple-logo/simple-logo.jpg
Normal file
BIN
examples/simple-logo/simple-logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
24
examples/simple-logo/turtle.js
Normal file
24
examples/simple-logo/turtle.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
function turtle(){
|
||||
|
||||
penColor('pink')
|
||||
penSize(12)
|
||||
|
||||
back(200)
|
||||
right(90)
|
||||
|
||||
penColor('blue')
|
||||
|
||||
for (let i = 0; i < 13; i++){
|
||||
forward(170)
|
||||
left(120)
|
||||
|
||||
forward(180)
|
||||
|
||||
right(10)
|
||||
|
||||
back(18)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -75,9 +75,6 @@ function randint(max = 100) {
|
|||
//default returns int between 0 and 100
|
||||
return int(random(max));
|
||||
}
|
||||
function bg(c='black'){
|
||||
background(c)
|
||||
}
|
||||
function retro() {
|
||||
retroStyle = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user