onShow animations

I tried putting an animation in the onShow() method, and it works great as long as the onShow() is triggered by me actively swiping/exiting back to the watchface. However, if it gets back to the watchface by idle timeout from one of the widgets, it calls the onShow() which starts the animation but then it is put in sleepmode right after that, which kills the animation on the first drawing and actually leaves it stuck there - as in, the thing that was being animated is left at the initialization value rather than either completing the animation or at least setting the value to the final value.

Exiting the sleep mode doesn't resume the animation or complete it, the only way to get the drawable's property back to what it should be is to swipe to a widget and then swipe back.

Is there something that can be done to allow animations to either complete or just set to the final animated value when it decides to start an animation while in low power / sleep mode? Or do i have to set the animated value back to its final value myself when it is in sleep mode?
  • Former Member
    Former Member over 10 years ago
    function onEnterSleep() is called just before entering low power mode. Try setting your final animation value there(or whatever you need to set to get back to your basic low power watch face) and then call Ui.requestUpdate(); to draw that face before things shutdown for the next minute.

    In my GMTmoon watch face I use this code:

    function onEnterSleep()
    {
    scrollMode = 0; // Make sure the watch is in run mode before the OS forces all timers to autostop
    sleeping = true; // Let the main program, onUpdate(dc), know to not draw the seconds hand
    Ui.requestUpdate(); // request the OS to make a call to onUpdate(dc) to draw the second hand-less face
    }