Skip to content

Make animations simpler

Guido Günther requested to merge guidog/phoc:gesture/animation-class into master

The animation code in !344 (merged) is pretty raw. This series tries to improve on this by introducing an PhocAnimatable interface that can be implemented by animatable objects. It's main purpose currently is to allow to get called by a frame clock so the animated object can calculate the progress. This is used by PhocDraggableLayerSurface and frees objects from knowing the details of the render loop as they can just react on "tick" events.

Since we have that we can also remove the shield related animation code from PhocServer by introducing PhocOuputShield which also implements PhocAnimatable. On top of that we introduce a PhocTimedAnimation class that can ease properties over time. We still have to hook into render-end to draw the shield layer, something we likely also want to make simpler in the future by allowing to have z ordering between layer-surfaces, views, shields, touch points, etc instead of hardcoding it in the render loop but that's orthogonal to the problem at hand.

All objects in this series can use a per output clock. Things like PhocView which can move between surfaces will need a bit more work but can use the same interface. I have some code to also animate surface movement using PhocTimedAnimation (as in https://twitter.com/GuidoGuenther/status/1502321755783843846) but that needs more cleanup and !352 (merged) so this looks like a good cut. There's also some code to make the clocks more useful by taking presentation time into account, etc) but that can also be added later on.

Goes on top of !366 (merged) !365 (merged) !364 (merged) hence draft but some intitial input about the APIs and pathes taken is appreciated.

Possible followups:

  • make the fold margin a property so PhocDragableLayersurface can use PhocAnimation as is
Edited by Guido Günther

Merge request reports