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


Python Animation.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
    def __init__(self, mobject1, mobject2, 
                 run_time = DEFAULT_TRANSFORM_RUN_TIME,
                 interpolation_function = straight_path,
                 black_out_extra_points = False,
                 *args, **kwargs):
        self.interpolation_function = interpolation_function
        count1, count2 = mobject1.get_num_points(), mobject2.get_num_points()
        if count2 == 0:
            mobject2 = Point((SPACE_WIDTH, SPACE_HEIGHT, 0))
            count2 = mobject2.get_num_points()
        Mobject.align_data(mobject1, mobject2)
        Animation.__init__(self, mobject1, run_time = run_time, *args, **kwargs)
        self.ending_mobject = mobject2
        self.mobject.SHOULD_BUFF_POINTS = \
            mobject1.SHOULD_BUFF_POINTS and mobject2.SHOULD_BUFF_POINTS
        self.reference_mobjects.append(mobject2)
        self.name += "To" + str(mobject2)

        if black_out_extra_points and count2 < count1:
            #Ensure redundant pixels fade to black
            indices = np.arange(
                0, count1-1, float(count1) / count2
            ).astype('int')
            temp = np.zeros(mobject2.points.shape)
            temp[indices] = mobject2.rgbs[indices]
            mobject2.rgbs = temp
            self.non_redundant_m2_indices = indices
开发者ID:nachinius,项目名称:animations,代码行数:29,代码来源:transform.py

示例2: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, AnimationClass, mobjects, **kwargs):
     centers = [mob.get_center() for mob in mobjects]
     kwargs["mobject"] = Mobject().add_points(centers)
     self.centers_container = AnimationClass(**kwargs)
     kwargs.pop("mobject")
     Animation.__init__(self, Mobject(*mobjects), **kwargs)
     self.name = str(self) + AnimationClass.__name__
开发者ID:Rubixdarcy,项目名称:manim,代码行数:9,代码来源:simple_animations.py

示例3: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, value_function, **kwargs):
     """
     Value function should return a real value 
     depending on the state of the surrounding scene    
     """
     digest_config(self, kwargs, locals())
     self.update_mobject()
     Animation.__init__(self, self.mobject, **kwargs)
开发者ID:PythonJedi,项目名称:manim,代码行数:10,代码来源:numerals.py

示例4: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, mobject, **kwargs):
     self.intermediate = Mobject(color = self.color)
     self.intermediate.add_points([
         point + (x, y, 0)
         for point in self.mobject.points
         for x in [-1, 1]
         for y in [-1, 1]
     ])
     Animation.__init__(self, mobject, **kwargs)        
开发者ID:GodotMisogi,项目名称:manim,代码行数:11,代码来源:simple_animations.py

示例5: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, homotopy, mobject, **kwargs):
     """
     Homotopy a function from (x, y, z, t) to (x', y', z')
     """
     def function_at_time_t(t):
         return lambda p : homotopy(p[0], p[1], p[2], t)
     self.function_at_time_t = function_at_time_t
     digest_config(self, kwargs)
     Animation.__init__(self, mobject, **kwargs)
开发者ID:crclayton,项目名称:manim,代码行数:11,代码来源:simple_animations.py

示例6: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, matrix, mobject, **kwargs):
     matrix = np.array(matrix)
     if matrix.shape == (2, 2):
         self.matrix = np.identity(3)
         self.matrix[:2, :2] = matrix
     elif matrix.shape == (3, 3):
         self.matrix = matrix
     else:
         raise "Matrix has bad dimensions"
     Animation.__init__(self, mobject, **kwargs)
开发者ID:GodotMisogi,项目名称:manim,代码行数:12,代码来源:transform.py

示例7: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
    def __init__(self, mobject, target_mobject, **kwargs):
        #Copy target_mobject so as to not mess with caller
        self.original_target_mobject = target_mobject
        target_mobject = target_mobject.copy()
        digest_config(self, kwargs, locals())
        mobject.align_data(target_mobject)
        self.init_path_func()

        Animation.__init__(self, mobject, **kwargs)
        self.name += "To" + str(target_mobject)  
开发者ID:PythonJedi,项目名称:manim,代码行数:12,代码来源:transform.py

示例8: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
    def __init__(self, mobject, ending_mobject, **kwargs):
        mobject, ending_mobject = map(instantiate, [mobject, ending_mobject])
        digest_config(self, kwargs, locals())
        count1, count2 = mobject.get_num_points(), ending_mobject.get_num_points()
        if count2 == 0:
            ending_mobject.add_points([SPACE_WIDTH*RIGHT+SPACE_HEIGHT*UP])
            count2 = ending_mobject.get_num_points()
        Mobject.align_data(mobject, ending_mobject)
        if self.should_black_out_extra_points and count2 < count1:
            self.black_out_extra_points(count1, count2)

        Animation.__init__(self, mobject, **kwargs)
        self.name += "To" + str(ending_mobject)  
        self.mobject.point_thickness = ending_mobject.point_thickness
开发者ID:CrazySymbols,项目名称:manim,代码行数:16,代码来源:transform.py

示例9: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, word, **kwargs):
     self.path = Cycloid(end_theta = np.pi)        
     word_mob = TextMobject(list(word))
     end_word = word_mob.copy()
     end_word.shift(-end_word.get_bottom())
     end_word.shift(self.path.get_corner(DOWN+RIGHT))
     end_word.shift(3*RIGHT)
     self.end_letters = end_word.split()
     for letter in word_mob.split():
         letter.center()
         letter.angle = 0
     unit_interval = np.arange(0, 1, 1./len(word))
     self.start_times = 0.5*(1-(unit_interval))
     Animation.__init__(self, word_mob, **kwargs)
开发者ID:GodotMisogi,项目名称:manim,代码行数:16,代码来源:curves.py

示例10: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
    def __init__(self, body, underwear, hair=None, duration=sf.seconds(1)):
        Animation.__init__(self, body.size(), duration)

        self._body = body
        self._underwear = underwear
        self._hair = hair

        self._mantle = None
        self._shoes = None
        self._legging = None
        self._hauberk = None
        self._armor = None

        self._weapon = None
        self._shield = None
开发者ID:OpenHelbreath,项目名称:openhelbreath-client,代码行数:17,代码来源:humananimation.py

示例11: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, mobject, color = "white", slow_factor = 0.01,
              run_time = 0.1, alpha_func = None,
              *args, **kwargs):
     Animation.__init__(self, mobject, run_time = run_time, 
                        alpha_func = alpha_func,
                        *args, **kwargs)
     self.intermediate = Mobject(color = color)
     self.intermediate.add_points([
         point + (x, y, 0)
         for point in self.mobject.points
         for x in [-1, 1]
         for y in [-1, 1]
     ])
     self.reference_mobjects.append(self.intermediate)
     self.slow_factor = slow_factor
开发者ID:nachinius,项目名称:animations,代码行数:17,代码来源:simple_animations.py

示例12: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, clock, **kwargs):
     digest_config(self, kwargs)
     assert(isinstance(clock, Clock))
     rot_kwargs = {
         "axis" : OUT,
         "about_point" : clock.get_center()
     }
     hour_radians = -self.hours_passed*2*np.pi/12
     self.hour_rotation = Rotating(
         clock.hour_hand, 
         radians = hour_radians,
         **rot_kwargs
     )
     self.minute_rotation = Rotating(
         clock.minute_hand, 
         radians = 12*hour_radians,
         **rot_kwargs
     )
     Animation.__init__(self, clock, **kwargs)
开发者ID:aquafemi,项目名称:manim,代码行数:21,代码来源:objects.py

示例13: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
    def __init__(self, mobject, ending_mobject, **kwargs):
        mobject = instantiate(mobject)
        #Copy ending_mobject so as to not mess with caller
        ending_mobject = instantiate(ending_mobject).copy()
        digest_config(self, kwargs, locals())
        count1, count2 = mobject.get_num_points(), ending_mobject.get_num_points()
        if count2 == 0:
            ending_mobject.add_points(
                [mobject.get_center()],
                color = BLACK
            )
            count2 = ending_mobject.get_num_points()
        Mobject.align_data(mobject, ending_mobject)
        if self.should_black_out_extra_points and count2 < count1:
            self.black_out_extra_points(count1, count2)

        Animation.__init__(self, mobject, **kwargs)
        self.name += "To" + str(ending_mobject)  
        self.mobject.point_thickness = ending_mobject.point_thickness
开发者ID:Rubixdarcy,项目名称:manim,代码行数:21,代码来源:transform.py

示例14: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, AnimationClass, mobject, arg_creator = None, **kwargs):
     digest_config(self, kwargs)
     for key in "rate_func", "run_time", "lag_ratio":
         if key in kwargs:
             kwargs.pop(key)
     if arg_creator is None:
         arg_creator = lambda mobject : (mobject,)
     self.subanimations = [
         AnimationClass(
             *arg_creator(submob),
             run_time = self.run_time,
             rate_func = squish_rate_func(
                 self.rate_func, beta, beta + self.lag_ratio
             ),
             **kwargs
         )
         for submob, beta in zip(
             mobject, 
             np.linspace(0, 1-self.lag_ratio, len(mobject))
         )
     ]
     Animation.__init__(self, mobject, **kwargs)
开发者ID:PythonJedi,项目名称:manim,代码行数:24,代码来源:simple_animations.py

示例15: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import __init__ [as 别名]
 def __init__(self, tex_list, **kwargs):
     mobject = TexMobject(self.curr_tex).shift(start_center)
     Animation.__init__(self, mobject, **kwargs)
开发者ID:Rubixdarcy,项目名称:manim,代码行数:5,代码来源:arithmetic.py


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