# Exiting CrossSlidingDiscontinuity in NDSolve to follow equilibrium curve

I am trying to figure out how to get the solution curve to an `NDSolve` to slide along once it reaches a boundary and then to exit the `CrossSlidingDiscontinuity` once it reaches an equilbrium curve and follow the equilibrium curve back within a set boundary.

If the x[t] solution curve reaches the boundary edge on this interval [0,1] I needed it to slide along this boundary, hence I used `CrossSlidingDiscontinuity`. However once, the solution reaches the yellow equilibrium sine curve, I need it to exit the sliding discontinuity and follow the equilibrium curve. I tried using `EventLocator` (in the code below). It manages to fall back within [0,1] but does not follow the equilibrium sine curve. I attached the image of the plot below.

I also tried using two `WhenEvents` (one for when x[t] reaches 1 triggering the sliding and one where x[t] reaches the sine curve triggering to follow the sine curve) but only the sliding `WhenEvent` was triggered.

Here is my code:

``normalDE2[x_, t_] := -(x + 1/2)*(x - 1/2)*(x - (1 + .1*Sin[t]));  testDE3[x_?NumberQ, t_] :=  If[0 < x < 1, normalDE2[x, t], -1*normalDE2[x, t]];  sol4 = NDSolve[{x'[t] == testDE3[x[t], t], x[0] == .75,  WhenEvent[{x[t] == 1, x[t] == 0},  {Print[t],"CrossSlidingDiscontinuity"}]},  x, {t, 0, 10}, Method -> {"EventLocator", "Event" -> {x[t] - (1 +.1*Sin[t])}, "EventAction" :> {{x[t] -> (1 + .1*Sin[t])}}}];  Plot[{x[t] /. sol4, (1 + .1*Sin[t])}, {t, 0, 10},  Frame -> True, GridLines -> Automatic]  ``

Plot Image