We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all, 
I have a question concerning physics in the most part.
I have modelled a spring after this funcrion (Hooke's Law): F = k * X 
http://en.wikipedia.org/wiki/Hooke's_law
here is the code:
float force = 0;
float accel = 0;
float speed = 5;
float posMid = 300;
float pos = 300;
float x;
float mass = 1000;
float k = 1;
void setup(){
  size(600,600);
  frameRate(60);
}
void draw(){
  background(0);
  x = posMid - pos;
  force = k*x;
  accel = force / mass;
  speed += accel;
  pos += speed;
  stroke(255,0,0);
  line(300,pos,300,posMid);
  noStroke();
  fill(255);
  ellipse(300,pos,10,10);
}
any ideas on how to add friction to the system?,
so that the system slowly stops oscillating...
Answers
I dunno either! You gotta w8 for some1 w/ physics knowledge here! :(
Here's my sorry attempt: :@)
Friction is proportional to the velocity (sometimes as velocity squared, depending on the situation), so just subtract that from the force:
It's been a long time, I had forgotten about this thread. Thanks after all. :)