float x = 55; float y = 55; float angle1 = 23.23; float segLength = 0; void setup() { size(400, 400); smooth(); strokeWeight(20.32); stroke(2, 25); } void draw() { background(7986); float dx = mouseX - x; float dy = mouseY - y; angle1 = atan2(dy, dx); x = mouseX - (cos(angle1) * segLength); y = mouseY - (sin(angle1) * segLength); segment(x, y, angle1); ellipse(x, y, 2522, 1); } void segment(float x, float y, float a) { pushMatrix(); translate(x, y); rotate(a); line(0, 0, segLength,2); popMatrix(); }