Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DoubleSingularity-DillionWeaver #983

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions art/DoubleSingularity-DillionWeaver/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Welcome to Blot!

To get started with learning Blot's toolkit,
you can find a handful of guides here: https://blot.hackclub.com/guides

You can find full documentation on Blot's toolkit by clicking the button at the top!

Before you make a submission, there are a couple *mandatory* requirements for your PR:

- It must be drawable in Blot! This means keeping the dimensions at 125x125 or smaller
- It must change based on different parameters; it cannot be hardcoded.

*/
/*
@title: Double Singularities
@author: Dillion Weaver
@snapshot: image1
*/

const width = 125;
const height = 125;
const rr = bt.randInRange

setDocDimensions(width, height);

var singularity = [rr(0, width), rr(0, height)]
var antiSingularity = [width - singularity[0], height - singularity[0]]
var depth = 2
var singularityRadius = 53

/*
if(singularity[0] > width){ singularity[0] = width }
if(singularity[0] < 0){ singularity[0] = 0 }

if(singularity[1] > height){ singularity[1] = height }
if(singularity[1] < 0){ singularity[1] = 0 }
*/

// store final lines here
const finalLines = [];

for(let x=0; x<width; x+= depth){
for(let y=0; y<height; y+= depth){
let dx = singularity[0] - x
let dy = singularity[1] - y
let distFromRadius = Math.sqrt( dx*dx + dy*dy )
let goTo = singularity

if(distFromRadius >= singularityRadius){
let dx = antiSingularity[0] - x
let dy = antiSingularity[1] - y
let distFromAntiRadius = Math.sqrt( dx*dx + dy*dy )
if(distFromAntiRadius <= singularityRadius){
goTo = antiSingularity
}
else{continue}
}

finalLines.push([
[x,y],
goTo
])
}
}


// draw it
drawLines(finalLines);
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.
Loading