Ejemplo n.º 1
0
#!/usr/bin/env python

import numpy as np
import itertools as it
from copy import deepcopy
import sys


from animation import *
from mobject import *
from constants import *
from region import *
from scene import Scene, RearrangeEquation
from script_wrapper import command_line_create_scene


class SampleScene(RearrangeEquation):
    def construct(self):
        three = tex_mobject("3")
        three.sort_points(np.linalg.norm)
        self.animate(DelayByOrder(ApplyMethod(three.scale, 3)))

        self.dither()




if __name__ == "__main__":
    command_line_create_scene()
Ejemplo n.º 2
0
            ]
        ] + [
            Transform(pi.mouth, sad_pi.mouth, run_time = 0.2)
        ])
        self.remove(*blinked_pi.parts + pi.parts + sad_pi.parts)
        self.play(
            WalkPiCreature(sad_pi, DOWN+4*LEFT),
            run_time = 1.0
        )
        self.dither()

    def line19(self):
        pass


if __name__ == "__main__":
    command_line_create_scene(MOVIE_PREFIX)













                                COUNT_TO_FRAME_NUM[count + 1] - 10)
            for index in index_range:
                self.frames[index] = disp.paint_mobject(
                    mob, self.frames[index])


class ShowFrameNum(SceneFromVideo):
    args_list = [
        ("ClearLeftSideBufferedCounting", ),
    ]

    @staticmethod
    def args_to_string(filename):
        return filename

    def construct(self, filename):
        path = os.path.join(ANIMATIONS_DIR, MOVIE_PREFIX, filename + ".mp4")
        SceneFromVideo.construct(self, path)
        for frame, count in zip(self.frames, it.count()):
            print(count + "of" + len(self.frames))
            mob = Mobject(*[
                TexMobject(char).shift(0.3 * x * RIGHT)
                for char, x, in zip(str(count), it.count())
            ])
            self.frames[count] = disp.paint_mobject(mob.to_corner(UP + LEFT),
                                                    frame)


if __name__ == "__main__":
    command_line_create_scene(MOVIE_PREFIX)