Monday, April 8, 2019

Map no map

I opened the example file "Map", hoping to be able to do something with interactive maps like Google Maps. However, all I could do with the example to see an orange circle scale and fade as I move my cursor around. It wasn't the map I was looking for but still fun to explore what it can do. I made small changes to the code:
1) changed the canvas size
2) changed the movement variable from mouseX to mouseY
3) changed the color of the circle
4) change the position of the circle

void setup() {
  size(800, 600);
  noStroke();
}
// changed the canvas size
void draw() {
  background(0);
  // Scale the mouseX value from 0 to 640 to a range between 0 and 175
  float c = map(mouseY, 0, width, 0, 175);
  // changed from mouseX to mouseY. I want the shape to scale based on
  // the vertical movement of my cursor
  // Scale the mouseX value from 0 to 640 to a range between 40 and 300
  float d = map(mouseX, 0, width, 40, 300);
  fill(125, c, 100);
  // changed the color. exoeriment of RGB values and how it displays on screen
  ellipse(width/4, height/4, d, d); 
}
  // changed the position of the circle

No comments:

Post a Comment