Skip to content

Reworking the update module #1538

Open
Open
@AntonBallmaier

Description

@AntonBallmaier

Enhancement proposal

The update module currently contains the following:

  • UpdateFromFunc
  • UpdateFromAlphaFunc
  • MaintainPositionRelativeTo

UpdateFromFunc and UpdateFromAlphaFunc

Just like Mobject.add_updater accepts callables with or without second parameter, so should UpdateFromFunc. That would render UpdateFromAlphaFunc useless.

Additionally I would like a parameter range for what currently is UpdateFromAlphaFunc. This would simply map the given value linearly. This might seem useless, but I find myself remapping the alpha value every single time I use UpdateFromAlphaFunc - so why not add a quality of life feature?

MaintainPositionRelativeTo

Why is this an animation? Maintaining relative position is the prime example of where you should use an updater.
I do however not suggest to only deprecate this feature: It should instead be replaced by an "updater factory function" returning an updater. In the same vain we might even want to add more factory functions for useful updaters that get used regularly.

Updater logic

The updater logic is not too simple and would even be quite a bit more complex after #1520. It would be nice to move some of that logic from the Mobject class to this module - this would also make it easier to reuse parts of it in OpenGLMobject (and maybe Scene in the future, see #1488)

Docs docs docs

This is one of the less documented modules - they should of course not be neglected when refurbishing that module 🙂

Additional comments

Please let me know your ideas for common updaters this module could include.
Also please add a comment if you want to work on this issue, as it may well be I already started doing so :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAdditions and improvements in generalpr:deprecationDeprecation, or removal of deprecated coderefactorRefactor or redesign of existing code

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions