当前位置: 首页>>代码示例>>Python>>正文


Python Mobject.__init__方法代码示例

本文整理汇总了Python中mobject.Mobject.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Mobject.__init__方法的具体用法?Python Mobject.__init__怎么用?Python Mobject.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mobject.Mobject的用法示例。


在下文中一共展示了Mobject.__init__方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
    def __init__(self, **kwargs):
        x_axis = NumberLine(**kwargs)
        y_axis = NumberLine(**kwargs).rotate(np.pi/2, OUT)
        Mobject.__init__(self, x_axis, y_axis)


        
开发者ID:mherkazandjian,项目名称:manim,代码行数:6,代码来源:functions.py

示例2: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, **kwargs):
     Mobject.__init__(self, **kwargs)
     for part_name in self.PART_NAMES:
         mob = ImageMobject(
             part_name_to_directory(part_name),
             should_center = False
         )
         if part_name not in self.WHITE_PART_NAMES:
             mob.highlight(self.color)
         setattr(self, part_name, mob)
     self.eyes = Mobject(self.left_eye, self.right_eye)
     self.legs = Mobject(self.left_leg, self.right_leg)
     mouth_center = self.get_mouth_center()
     self.mouth.center()
     self.smile = self.mouth
     self.frown = self.mouth.copy().rotate(np.pi, RIGHT)
     self.straight_mouth = TexMobject("-").scale(0.7)
     for mouth in self.smile, self.frown, self.straight_mouth:
         mouth.sort_points(lambda p : p[0])
         mouth.highlight(self.color) ##to blend into background
         mouth.shift(mouth_center)
     self.digest_mobject_attrs()
     self.give_smile()
     self.add(self.mouth)
     self.scale(PI_CREATURE_SCALE_VAL)
开发者ID:Rubixdarcy,项目名称:manim,代码行数:27,代码来源:characters.py

示例3: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     Mobject.__init__(self, *args, **kwargs)
     complex_power = 0.9
     radius = self.INITIAL_WIDTH/2
     circle = Circle(density = radius*DEFAULT_POINT_DENSITY_1D)
     circle.apply_complex_function(lambda z : z**complex_power)
     circle.scale(radius)
     boundary_point_as_complex = radius*complex(-1)**complex_power
     boundary_points = [
         [
             boundary_point_as_complex.real,
             unit*boundary_point_as_complex.imag,
             0
         ]
         for unit in -1, 1
     ]
     tip = radius*(1.5*LEFT+UP)
     self.add(
         circle,
         Line(boundary_points[0], tip),
         Line(boundary_points[1], tip)
     )
     self.highlight("white")
     self.rotate(np.pi/2)
     self.points[:,1] *= float(self.INITIAL_HEIGHT)/self.INITIAL_WIDTH
     Bubble.__init__(self, direction = LEFT)
开发者ID:nachinius,项目名称:animations,代码行数:28,代码来源:simple_mobjects.py

示例4: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, expression, **kwargs):
     if "size" not in kwargs:
         #Todo, make this more sophisticated.
         if len("".join(expression)) < MAX_LEN_FOR_HUGE_TEX_FONT:
             size = "\\Huge"
         else:
             size = "\\large"
     digest_locals(self)
     Mobject.__init__(self, **kwargs)
开发者ID:Rubixdarcy,项目名称:manim,代码行数:11,代码来源:tex_mobject.py

示例5: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, condition = (lambda x, y : True), **kwargs):
     """
     Condition must be a function which takes in two real
     arrays (representing x and y values of space respectively)
     and return a boolean array.  This can essentially look like
     a function from R^2 to {True, False}, but & and | must be
     used in place of "and" and "or"
     """
     Mobject.__init__(self, **kwargs)
     self.condition = condition
开发者ID:GodotMisogi,项目名称:manim,代码行数:12,代码来源:region.py

示例6: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, image_file, **kwargs):
     digest_locals(self)
     Mobject.__init__(self, **kwargs)
     self.name = to_camel_case(
         os.path.split(image_file)[-1].split(".")[0]
     )
     path = get_full_image_path(image_file)
     self.generate_points_from_file(path)
     self.scale(self.scale_factorue)
     if self.should_center:
         self.center()
开发者ID:PythonJedi,项目名称:manim,代码行数:13,代码来源:image_mobject.py

示例7: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, 
              function, 
              dim = 1, 
              expected_measure = 10.0, 
              density = None,
              *args, 
              **kwargs):
     self.function = function
     self.dim = dim
     self.expected_measure = expected_measure
     if density:
         self.epsilon = 1.0 / density
     elif self.dim == 1:
         self.epsilon = 1.0 / expected_measure / DEFAULT_POINT_DENSITY_1D
     else:
         self.epsilon = 1.0 / np.sqrt(expected_measure) / DEFAULT_POINT_DENSITY_2D
     Mobject.__init__(self, *args, **kwargs)
开发者ID:nachinius,项目名称:animations,代码行数:19,代码来源:function_graphs.py

示例8: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, image_file, **kwargs):
     digest_locals(self)
     Mobject.__init__(self, **kwargs)
     self.name = to_cammel_case(
         os.path.split(image_file)[-1].split(".")[0]
     )
     possible_paths = [
         image_file,
         os.path.join(IMAGE_DIR, image_file),
         os.path.join(IMAGE_DIR, image_file + ".jpg"),
         os.path.join(IMAGE_DIR, image_file + ".png"),
     ]
     for path in possible_paths:
         if os.path.exists(path):
             self.generate_points_from_file(path)
             self.scale(self.scale_value)
             if self.should_center:
                 self.center()
             return
     raise IOError("File not Found")
开发者ID:Rubixdarcy,项目名称:manim,代码行数:22,代码来源:image_mobject.py

示例9: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, **kwargs):
     digest_config(self, Stars, kwargs)
     Mobject.__init__(self, **kwargs)
开发者ID:mherkazandjian,项目名称:manim,代码行数:5,代码来源:three_dimensions.py

示例10: to_symbol

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def to_symbol(self):
     Mobject.__init__(
         self,
         *list(set(self.get_parts()).difference(self.get_white_parts()))
     )
开发者ID:Rubixdarcy,项目名称:manim,代码行数:7,代码来源:characters.py

示例11: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, location = ORIGIN, **kwargs):
     digest_locals(self)        
     Mobject.__init__(self, **kwargs)
开发者ID:mherkazandjian,项目名称:manim,代码行数:5,代码来源:geometry.py

示例12: __init__

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import __init__ [as 别名]
 def __init__(self, num_points = DEFAULT_NUM_STARS, 
              *args, **kwargs):
     self.num_points = num_points
     Mobject.__init__(self, *args, **kwargs)
开发者ID:nachinius,项目名称:animations,代码行数:6,代码来源:three_dimensional_mobjects.py


注:本文中的mobject.Mobject.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。