Skip to content

Using z-order to define layer for Mobjects #117

@kolibril13

Description

@kolibril13

Matplotlib has a very nice method to define in which layer objects are shown on the screen with a parameter zorder.
image
When working with manim, it's sometimes a little tricky to get the layers right, so what about an implementation, where you can write:

d=Dot()
self.add(d, zorder= 1)

Furthermore, there could be defaults like:

  • Dots at the first layer
  • Text & Equations at the second layer
  • Shapes on the third layer
  • Functions and graphs on the fourth layer.

When I posted this text to the discord server, @eulertour wrote:

I don't think it would require anything more than sorting scene.mobjects by z-index before rendering each frame
and since its already possible to assign arbitrary attributes to mobjects it may end up being a one-line change

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAdditions and improvements in generalrefactorRefactor or redesign of existing code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions