the "arm" should try to follow the mouse pointer. To change the length of each segment, use the l1 slider for the first segment's length, and l2 for the second's
This project uses inverse kinematics to simulate an arm with 2 DOF (degrees of freedom). Inverse kinematics are a set of equations to calculate the angle of each segment in an arm from the target point (the mouse pointer) to the base (the center of the screen). This is the inverse of forward kinematics which calculates from the base to the target. I plan to use this in an armature rigging project later on, so these will simulate moving bones in the body. Everything is by me. If you have any questions I'll do my best to give you an answer. Enjoy!