Assignment Week #1 – RADAR

Concept: 

My concept this week is “RADAR”. It is an art piece in which there are multiple walkers located randomly on the canvas and walk towards the cursor and then after a few seconds they scatter back to their initial positions. There are horizontal and vertical lines which gives the image the feel of a radar.

Sketch: 

https://editor.p5js.org/mi1171/full/wgCqaP_wT

step(){
    let stepvar = (random(1));

    if(stepvar < 0.6){
      if(bool == true){
      if(mouseX>=this.x){
      this.x++} if(mouseX<this.x){
        this.x--
      }
        if(mouseY>=this.y){
      this.y++}
        if(mouseY<this.y){
        this.y--
      }
    }else{
      if(this.initialx>=this.x){
      this.x++}
      if(this.initialx<this.x){
        this.x--
      }
        if(this.initialy>=this.y){
      this.y++}
        if(this.initialy<this.y){
        this.y--
      }
    }
    } else if(stepvar < 0.7){
      this.y++
    } else if(stepvar < 0.8){
      this.x--
    } else {
      this.y--
    }
    this.x = constrain(this.x,0,width-1);
    this.y = constrain(this.y,0,height-1);
    
    if(this.r<= r2){
      this.r++
    }else{
      this.r--
    }
    
     if(this.g<= g2){
      this.g++
    }else{
      this.g--
    }
    
     if(this.b<= b2){
      this.b++
    }else{
      this.b--
    }
}

This is my step function, the part I’m particularly proud of is how I manage to make the walkers go back to their initial positions after the bool variable becomes true. (This variable flips every 400 frames)

Challenges:

In this week’s assignment, I had 1 main issue, which was the lag caused by the code. I decided to decrease the number of walkers I had from 200 to 100, which greatly decreased the amount of lag in the sketch while still maintaining the integrity of the art piece.

Future Improvements: 

There are some improvements that can be made to this assignment. For example, I can add a line that rotates and ‘detects’ the circles. When detected the circles can increase in opacity, then slowly decrease until the line touches them again. 

Leave a Reply

Your email address will not be published. Required fields are marked *