Sideway
output.to from Sideway
Draft for Information Only

Content

Element Management
 def add(self, *mobjects)
  Example Scene.add
   Code Scene.add
   Output Scene.add
 def remove(self, *mobjects)
  Example Scene.remove
   Code Scene.remove
   Output Scene.remove

Element Management

The element management functions of Scene object is to manage the Mobject objects of Scene object. The element management functions are
  • def add(self, *mobjects)
  • def remove(self, *mobjects)
  • def add_mobjects_among(self, values)
  • def add_foreground_mobjects(self, *mobjects)
  • def add_foreground_mobject(self, mobject)
  • def remove_foreground_mobjects(self, *to_remove)
  • def remove_foreground_mobject(self, mobject)
  • def clear(self)

def add(self, *mobjects)

Add one or more Mobject objects to the casting list of Scene object. Mobjects are added to Scene object from background to foreground in the order with which these Mobject objects are added. In other words, Mobject object added by add(self, *mobjects) will always be placed in front of others Mobject objects in the Scene object. Usually, a Mobject object is added through an instance of the Mobject object, by reference to a Mobject object name, to the casting list of the Scene object for easier manipulation. However, the same Mobject instance represented by variables always refer to the same Mobject of the Scene object, unless a varible is reassigned to another Mobject instance. Besides, Mobject objects can also be added by direct construction as static Mobjects in the Scene object.last updated 27Dec2019

Example Scene.add

Example of Scene.add

Code Scene.add

# folder/file: tut/manim_scene_add_001a.py

from manimlib.scene.scene import Scene
from manimlib.mobject.geometry import Circle
from manimlib.mobject.geometry import Square

class manim_scene_add_001a(Scene): 
    def construct(self): 
        self.add(Circle(fill_opacity=1,radius=1.5))
        self.add(Square(color="#FFFF00"),Circle(radius=1.2,color="#FF0000",stroke_width=10))
        temp1=Circle(stroke_width=10,radius=2.5)
        temp2=Square(color="#FFFFFF",side_length=4)
        temp3=Circle(radius=2.2,color="#FF0000",stroke_width=10)
        self.add(temp3)
        self.add(temp2,temp1)

Output Scene.add

image

def remove(self, *mobjects)

Only remove one or more Mobject objects, by reference to the corresponding Mobject object names, from both the casting list and priority casting list of Scene object, while the instances of Mobject objects are still available for later use in the Scene object. The remove function will only remove the specified Mobject objects if present from the casting list through scanning both the mobjects and submobjects of grouped mobjects in the Scene object. In other words, only the specified Mobject objects will be completely removed from the casting list of Scene object and any specified Mobject object with no unmatched Mobject object will be ignored.last updated 27Dec2019

Example Scene.remove

Example of Scene.remove

Code Scene.remove

# folder/file: tut/manim_scene_remove_001a.py

from manimlib.scene.scene import Scene
from manimlib.mobject.geometry import Circle
from manimlib.mobject.geometry import Square
from manimlib.mobject.mobject import Mobject

class manim_scene_remove_001a(Scene): 
    def construct(self): 
        self.add(Circle(fill_opacity=1,radius=1.5))
        self.add(Square(color="#FFFF00"),Circle(radius=1.2,color="#FF0000",stroke_width=10))
        temp1=Circle(stroke_width=10,radius=2.5)
        temp2=Square(color="#FFFFFF",side_length=4)
        temp3=Circle(radius=2.2,color="#FF0000",stroke_width=10)
        temp4=Circle(color="#FFFF00",radius=1.75)
        temp5=Square(color="#FFFF00",side_length=2.25)
        temp6=Square(fill_opacity=1,side_length=5.25)
        dummy=Mobject().add(temp4,temp5)
        self.add(temp1,temp2,temp3,dummy)
        self.remove(temp3)
        self.remove(temp1,temp5,temp6)

Output Scene.remove

image

©sideway

ID: 200302802 Last Updated: 3/28/2020 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019