How can I animate two beads each sliding on its own frictionless rail? [closed]

I am told to animate two beads sliding on rails in Mathematica, but I am very confused on how to get a mass on a rail and it move up and down the rail.

closed as off-topic by Daniel Lichtblau, m_goldberg, MarcoB, bbgodfrey, Carl LangeApr 24 at 21:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Daniel Lichtblau, m_goldberg, MarcoB, bbgodfrey, Carl Lange
If this question can be reworded to fit the rules in the help center, please edit the question.

• Have you been able to model a single sliding bead yet? Any code to share? – MikeY Apr 20 at 11:43
• Is it 2D or 3D? – Alex Trounev Apr 20 at 19:19

If there are no restrictions on r, x, then the solution is

eq = {x''[t] == -k*(x[t] - r[t]*Cos[theta]),
r''[t] == -k*(r[t] - x[t]*Cos[theta])};

theta = Pi/4; k = 1;
ic = {x[0] == 1, r[0] == 0, x'[0] == 0, r'[0] == 0};
sol = NDSolve[{eq, ic}, {x, r}, {t, 0, 20}]

lst = Table[
Graphics[{{Line[{{-1, 0}, {1, 0}}],
Line[{{-Cos[theta], -Sin[theta]}, {Cos[theta],
Sin[theta]}}]}, {Green,
Line[{{x[t], 0}, {r[t]*Cos[theta], r[t]*Sin[theta]}} /.
sol]}, {Red, PointSize[.05],  Point[{x[t], 0} /. sol],
Point[{r[t]*Cos[theta], r[t]*Sin[theta]} /. sol]}}], {t, 0,
10, .1}];

ListAnimate[lst]