Skip to content

Create a sketch based on the bw image. It is generated in real time as a separate html page. Uses p5js.

Notifications You must be signed in to change notification settings

ksenia007/squiggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Squiggle

This code draws a squiggly line based on the high contrast black and white photo. Some examples of the images (for a live version go to: https://ksenia007.github.io/squiggle/)

The code has values that can be easily changed to produce desirable results: the length of the jump from one point to new (d), how many steps we take in one line until starting new (durationOneSquiggle), control the maximum density of the line fill (controlDensity), the stroke weight (strokeW), whether to show the image or not when drawing (showImage) and finally the image address (imageAddress).

What does the code do?

The idea behind the code - having the black/white photo we want to draw squiggly lines on top of the black region. The code starts randomly from one point, and every iteration of draw() steps distance d to another black pixel. If the line is too long or gets stuck - it terminates and a new one is started.

The additional functions:

initNew() - initializes the new curve from random black pixel

getNear() - finds a black pixel that is distance d from the current position

randomPosition() - returns [x, y] of the random position (20 pixels away from borders).

About

Create a sketch based on the bw image. It is generated in real time as a separate html page. Uses p5js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published