Lines

Build a system for regularly positioned lines (horizontal, vertical, diagonal, fixed angle, crossing, etc.). Find 3 variables that change the composition, export your 3 most interesting results, note what parameters you can manipulate and give them a matching title. Record a ~10 sec screencapture showing them in action.

Log in to post a comment.

const numb_lines = 360; //min=30, max=10000, step=100
const line_length = 26; //min=1, max=100, step=1
const numb_layers = 25; //min=2, max=30, step=1
const gap = 2; //min=0, max=30, step=1
const waveAmplitude = 24; //min=1, max=100, step=1
const frequency = 25.; //min=1, max=100, step=0.5
const phaseShift = 1; //min=0.1, max=2, step=0.1

Canvas.setpenopacity(-0.85); // Global code will be evaluated once. 
const turtle = new Turtle();

for (let j= 0; j < numb_layers; j++){ 
    for (let i = 0; i < numb_lines; i++){ 
        const angle = i * 2 * Math.PI / numb_lines; 
        const cos = Math.cos(angle);
        const sin = Math.sin(angle); 
        const inner = (line_length+gap)*j; 
        const outer = inner + line_length; 
        
        const offset = waveAmplitude * Math.sin(angle * frequency + j * phaseShift);
        
        const start= [inner*cos-offset*sin, inner*sin+offset*cos]; 
        const end = [outer*cos-offset*sin, outer*sin+offset*cos]; 
        
        line(start, end); 
    } 
}

function line(start, end){
    turtle.jmp(start[0], start[1]);
    turtle.goto(end[0], end[1]); 
}