Compare commits

...

7 Commits

9 changed files with 103 additions and 8 deletions

View File

@ -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
@ -76,7 +76,12 @@ 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.
```
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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View 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())
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

View 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())
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

View 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)
}
}

View File

@ -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;
}

View File

@ -1,11 +1,12 @@
function turtle(){
bg('blue')
penColor('pink')
penSize(12)
forward(randint())
back(200)
right(90)
penColor('blue')
for (let i = 0; i < 13; i++){
forward(170)
@ -16,6 +17,7 @@ function turtle(){
right(10)
back(18)
}
}