If you ignore the rotation, what you have is two points moving in an ellipse around a center point. Calculating the proximity of the point is a simple matter of applying the pythagorean theorem to your x and y points. The distance from the center for each point is sqrt(x * x + y * y). You know the range of possible distances: from 30 at the closest approach to 70 at the furthest distance, so setting the color can be done using lerpColor() and map():
let dist = sqrt(x * x + y * y);
// When sin is 1/-1 and cos is 0 the first dot will be at its closest approach: 30
// When cos is 1/-1 and sin is 0 the second dot will be at its closest approach: 40
// Both dots will reach there furthest distance at the opposite time, at 70
// Lerp will linearly interpolate colors from green to red based on distance from the center.
fill(lerpColor(color('green'), color('red'), map(dist, 30, 70, 0, 1)));
ellipse(x, y, 5)