top of page

Our Recent Posts

Tags

week 12: development

  • annaquarrie
  • May 30, 2018
  • 1 min read

This week I tried to work on the drop and drag function and try to make the object disappear upon collision. I found this difficult to manage but I was happy to complete the task. I found making a timer out of the arc() function much more difficult. I tried to use the millis() function first but it wasn't appropriate for the timer i was trying to create. Instead I went to use the angle and radians and try and use the frame rate of processing.

int m; int totalTime = 60; int currentTime = 60;

float bx; float by; int boxSize = 30;

boolean overBox = false; boolean locked = false; float xOffset = 0; float yOffset = 0;

void setup(){ size(700,500); bx = width/2; by = height/2; rectMode(RADIUS); }

void draw(){ background(255); rect(600,250, 50,150);

if (mouseX > bx-boxSize && mouseX <bx + boxSize && mouseY > by-boxSize && mouseY <by + boxSize) { overBox = true; if(!locked) { fill(153); } } else { fill(153); overBox = false; } rect(bx, by, boxSize, boxSize); }

void mousePressed() { if(overBox) { locked = true; } else { locked = false; } xOffset = mouseX-bx; yOffset = mouseY-by; }

void mouseDragged() { if(locked) { bx = mouseX - xOffset; by = mouseY - yOffset; } }

void mouseReleased() { locked = false; }

void clocktimer(){ for (int i=0; i<36; i+=(1/6)){ float angle = radians(i); stroke(255,100,100); arc(50,50,80,80,0,angle+180, PIE); } }

 
 
 

Comments


©2018 by annaquarriedesign. Proudly created with Wix.com

bottom of page