-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from yutarour/main
added lines+circles
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// welcome to blot! | ||
|
||
const width = 125; | ||
const height = 125; | ||
|
||
setDocDimensions(width, height); | ||
|
||
const c = 3.1; | ||
let radius = 60; | ||
let divisions = 60; | ||
let divAngle = 2*Math.PI/divisions; | ||
|
||
function mathf(x){ | ||
return x*c; | ||
} | ||
|
||
class vec{ | ||
constructor(x,y){ | ||
this.x = x; | ||
this.y = y; | ||
} | ||
} | ||
|
||
function divPos(num){ | ||
let x = Math.cos(divAngle*num)*radius; | ||
let y = Math.sin(divAngle*num)*radius; | ||
return new vec(x,y); | ||
} | ||
|
||
function line(turtle,startx, starty, endx, endy){ | ||
turtle.jump([startx,starty]); | ||
turtle.goTo([endx,endy]); | ||
} | ||
|
||
const testTurtle = createTurtle(); | ||
|
||
for (let i = 0; i < divisions; i++) { | ||
let x = i; | ||
let y = mathf(x); | ||
let startPos = divPos(x); | ||
let endPos = divPos(y); | ||
line(testTurtle,startPos.x,startPos.y,endPos.x,endPos.y); | ||
} | ||
|
||
|
||
|
||
testTurtle.translate( | ||
[width/2, height/2], | ||
testTurtle.cc | ||
); | ||
|
||
testTurtle.jump(testTurtle.ct); | ||
testTurtle.arc(360,radius); | ||
|
||
drawTurtles([ | ||
testTurtle | ||
]); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
ef69d86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
blot – ./astro
blot-git-main.hackclub.dev
blot.hackclub.dev