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
// A 2D polyline of samples along a flow field | |
let path = [ penStart ]; | |
let [ x, y ] = penStart; | |
for (let i = 0; i < steps; i++) { | |
// Get new angle of rotation | |
const angle = noise(x, y) * angleAmplitude; | |
// Offset the point by this angle | |
x += Math.cos(angle) * stepSize; | |
y += Math.sin(angle) * stepSize; | |
// Add the new sample | |
path.push([ x, y ]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment