Project 3

What could you do with the absolute value of your position? TEKS Standards 1G and 2A

// Declare that you want to use variables.
int middleX;
int distanceX;
int absoluteDistanceX;
int diameter;

// Set the size of your drawing canvas and
// initialize your variables.
void setup() {
  size(500, 500);
  middleX = width/2;
  distanceX = 0;
  absoluteDistanceX = distanceX;
  diameter = absoluteDistanceX;
}

// Resize the diameter of a circle (ellipse)
// based on your mouse/touch position.
void draw() {
  distanceX = mouseX - middleX;
  if (distanceX >= 0) {
    absoluteDistanceX = distanceX;
  } else {
    absoluteDistanceX = -distanceX;
  }
  diameter = absoluteDistanceX;
  ellipse(mouseX, mouseY, diameter, diameter);
}

/**
 * Describe the variable absoluteDistanceX
 * in your own words.
 *  
 *  
 *  
 */

All source code is licensed under the MIT License. Text and images are free to remix under the terms of a Creative Commons Attribution 4.0 International License.