when two circles touch, change motion
in
Programming Questions
•
9 months ago
hi there,
when the red circle touches yellow i want to change
speed&litude of the yellow circle using some random values
but not only while they are touching but till the next time circles intersect
if circles don't touch for a while i want motion to gradually slow down, till it stops completely
can anyone here help me with this please?
don't feel that clever right now
thank you
when the red circle touches yellow i want to change
speed&litude of the yellow circle using some random values
but not only while they are touching but till the next time circles intersect
if circles don't touch for a while i want motion to gradually slow down, till it stops completely
can anyone here help me with this please?
don't feel that clever right now
thank you
- float diameter;
float diam=100;
float angle = 0;
void setup() {
size(640, 360);
diameter = height - 10;
}
void draw() {
background(0);
float x= width/2;
float y = 10 + (sin(angle + PI/2) * diameter/2) + diameter/2;
fill(255,255,0);
ellipse(x, y, diam, diam);
fill(255,0,0);
ellipse(mouseX,mouseY,diam,diam);
angle += 0.1;
}
1