As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Monday, June 8, 2020

Processing Experimentation: Contiunued Lines

I altered the example file “Continued Lines”.


One of the things I did was make the stroke width randomize with each frame. I did this using the strokeWeight + the random function. I also altered the code so that each time you click, the range of colors displayed as you draw your line changes. I did this with a few cascading if /if else / else statements that only ran when the mouse was pressed. When the mouse was released, the else statement generated a random number between 0 and 3, and this was stored in a float. This number was used to determine which color range would be used the next time I drew a line.





/** * Continuous Lines. * * Click and drag the mouse to draw a line. */ float lineColor; void setup() { size(640, 360); background(102); } void draw() { if (mousePressed == true) { if(lineColor * 3 > 6){ stroke(random(255), random (255), 255); strokeWeight(random(100)); line(mouseX, mouseY, pmouseX, pmouseY); } else if(lineColor * 3 > 3){ stroke(255, random(255), random(255)); strokeWeight(random(100)); line(mouseX, mouseY, pmouseX, pmouseY); } else{ stroke(random(255), 255, random(255)); strokeWeight(random(100)); line(mouseX, mouseY, pmouseX, pmouseY); } } else{ lineColor = random(3); } }

No comments:

Post a Comment