An extended comment. I tried with:
DynamicModule[{running = False, n = 0},
EventHandler[
Animator[Dynamic[n], {0, 100, 1}, AnimationRunning -> Dynamic[running] ]
, { "MouseEntered" :> FEPrivate`Set[running, True]
, "MouseExited" :> FEPrivate`Set[running, False]
}
]
]
But at least on Win10 v12.1 the internal timer goes on and when on MouseExited
and when it runs again it starts from the position it would have had without stopping.
EDIT: The solution
If we are less subtle it will work:
DynamicModule[{running = False, n = 0},
EventHandler[
Dynamic @ Animator[Dynamic[n], {0, 100, 1}, AnimationRunning -> running ]
, { "MouseEntered" :> FEPrivate`Set[running, True]
, "MouseExited" :> FEPrivate`Set[running, False]
}
]
]
It isn't completely FE-side anymore, evaluation of the whole Animator[...]
goes back and forth, but at least it works.