{
let randRange = d3.randomNormal(5, 75);
let MAX_RANGE = 75
let range = 5
let ix = 0;
return p5(sketch => {
sketch.setup = function () {
if (!isLooping)
sketch.noLoop()
else
sketch.loop()
sketch.createCanvas(size[0],size[1]);
let SCALE = 0.01
let r = perlin2(ix * SCALE, 1)
range = Math.ceil((r + 1) / 2 * MAX_RANGE)
ix += 1
}
sketch.draw = function () {
sketch.background('#ffffff');
sketch.stroke('#000000')
sketch.strokeWeight(size[0] / (121*2));
const noises = createNoises(size[1])
const yVals = _.range(0,size[1], lineSizeRatio * size[1])
function getNoise(y) { return noises[_.indexOf(yVals, y)] }
_.forEach(cols, (c) => {
let lineLengths = createLinesWithShape(c, size[1], tri.data, range)
lineLengths.forEach((l,i) => {
let n = getNoise(l[0])
sketch.line(xScale(c) + n, l[0], xScale(c) + n, l[1])
})
})
}
})
}