0.0.1 • Published 5 years ago
node-turtle v0.0.1
node-turtle
A node-js wrapper for python's turtle library. turtle-js was meant to help teach javascript as a standalone language.
Installation
npm install node-turtle
# or
yarn add node-turtle
Example
const { Turtle } = require('node-turtle')
async function main() {
let turtles = []
for (let i = 0; i < 15; i++) {
let turtle = await Turtle()
await turtle.penup()
await turtle.goto(-100, -50 + i * 15)
await turtle.color(Math.random(), Math.random(), Math.random())
await turtle.pendown()
await turtles.push(turtle)
}
while (true) {
for (turtle of turtles)
await turtle.forward(Math.floor(Math.random() * 5))
}
}
main()
0.0.1
5 years ago