code your way Week2-5

PHOTO EMBED

Sat Feb 04 2023 20:36:11 GMT+0000 (Coordinated Universal Time)

Saved by @yc_lan

/*
Inspired by Colette and Charles J. Bangert's Complex Intersecting Line (1976) and Roman Verostko's Sketch (1987)
*/

let startX;
let startY;
let endX;
let endY;

let num = 0;
let total = 1000;

let tx = 0;
let ty = 1000;

function setup() {
  createCanvas(windowWidth, windowHeight);
  background(0);
  stroke(255);
  strokeWeight(2);
  getStartPoint();
  getEndPoint();
}

function draw() {
  while (num < total) {
    line(startX, startY, endX, endY);
    startX = endX;
    startY = endY;
    getEndPoint();
    num++;
  }
}

function getStartPoint() {
  startX = map(noise(tx), 0, 1, 0, width);
  startY = map(noise(ty), 0, 1, 0, height);
}

function getEndPoint() {
  endX = map(noise(tx), 0, 1, 0, width);
  endY = map(noise(ty), 0, 1, 0, height);

  tx += 0.01;
  ty += 0.01;
}
/* ------------↓↓ My comment here ↓↓----------*/

/*
Inspired by Colette and Charles J. Bangert's Complex Intersecting Line (1976) and Roman Verostko's Sketch (1987)
*/

let startX;
let startY;
let endX;
let endY;

let num = 0;
let total = 1000;

let tx = 0;
let ty = 0.12;

function setup() {
  createCanvas(windowWidth, windowHeight);
  background(0);
  stroke(255);
  strokeWeight(0.1);
  
  getStartPoint();
  getEndPoint();
}

function draw() {
  while (num < total) {
    
    line(startX, startY, endX, endY);
    startX = endX;
    startY = endY;
    getEndPoint();
    num++;
  }
}


//the same structure of the task4
//only change the the way of get a  start and end point


function getStartPoint() {
  startX = map(noise(tx), 0, 1, 0, width);
  startY = map(noise(ty), 0, 1, 0, height);
}

function getEndPoint() {
  endX = map(noise(tx), 0, 1, 0, width);
  endY = map(noise(ty), 0, 1, 0, height);

  tx += 1.01;
  ty += 1.01;
  
  //tx and ty increase a little, to made the next point close to the last point,
  //I change the ty, made it close to the tx, which cause the noise value close 
  // and it will made the x and y close, so the lines will appears with a tendency on the f(x)=y
  
}









/* !!!!!!!!!!!!MODIFY!!!!!!!!!*/

/* ------------↓↓ My comment here ↓↓----------*/

/*
Inspired by Colette and Charles J. Bangert's Complex Intersecting Line (1976) and Roman Verostko's Sketch (1987)
*/

let startX;
let startY;
let endX;
let endY;

let num = 0;
let total = 1000;

let tx = 0;
let ty = 0.2;



function setup() {
  createCanvas(windowWidth, windowHeight);
  background(0);
  stroke(255);
  strokeWeight(0.1);
  
  getStartPoint();
  getEndPoint();
}

function draw() {
  background(0,50);
  
  
  for (num=0;num < total;num++) {
    
    line(startX, startY, endX, endY);
    startX = endX;
    startY = endY;
    getEndPoint();
    
  }
  
}


//the same structure of the task4
//only change the the way of get a  start and end point


function getStartPoint() {
  startX = map(noise(tx), 0, 1, 0, width);
  startY = map(noise(ty), 0, 1, 0, height);
}

function getEndPoint() {
  
 
  endX = map(noise(tx), 0, 1, 0, width);
  endY = map(noise(ty), 0, 1, 0, height);

  tx += map(mouseX,0,width,0.1,0.5);
  ty += map(mouseY,0,height,0.1,2);
    
  
  
  //tx and ty increase a little, to made the next point close to the last point,
  //I change the ty, made it close to the tx, which cause the noise value close 
  // and it will made the x and y close, so the lines will appears with a tendency on the f(x)=y
  
}
content_copyCOPY

https://github.com/ellennickles/code-your-way-s23/blob/main/week2/decode5.js