def rotate_wheels(self, group): cycle = group.copy() bar = Line(cycle.get_center(), cycle.get_center()+UP*1.6) handle = Mobject( Dot(cycle.get_center(),radius=0.15,color=RED), Line(cycle.get_center(), cycle.get_center()+UP*1.6), Line(bar.get_end()+LEFT*0.5,bar.get_end()+RIGHT*0.5)) self.add(cycle) self.play(ShowCreation(handle)) floor = Line(cycle.get_bottom()+LEFT*16, cycle.get_bottom()+RIGHT*16,color=BLACK) pi_floor = TexMobject(PI).scale(0.9).move_to((cycle.get_bottom()*1.063)+RIGHT*5.2) hpday = TexMobject(HAPPY, color=ORANGE).scale(0.9) rect = SurroundingRectangle(hpday) holder = Line(rect.get_bottom(), rect.get_bottom()*5) board = VGroup(hpday,rect, holder) pi = Randolph().scale(0.6) pi.move_to(handle.get_top()+UP*0.8) self.play(ShowCreation(pi)) self.play(ShowCreation(board.move_to(pi.get_top()+RIGHT))) handle.add(pi) handle.add(board) self.add(floor) self.add(pi_floor) self.add(board) self.play(ShowCreation(pi_floor, run_time=4),RollAlongVector(cycle,floor.points[-1]-floor.points[0], rate_func=None, run_time=13), MaintainPositionRelativeTo(handle, cycle), rate_func=None)
def __init__(self, **kwargs): SVGMobject.__init__(self, **kwargs) self.scale_to_fit_height(self.height) self.set_stroke(color = WHITE, width = 0) self.set_fill(self.color, opacity = 1) from topics.characters import Randolph randy = Randolph(mode = "happy") randy.scale_to_fit_height(0.6*self.get_height()) randy.stretch(0.8, 0) randy.look(RIGHT) randy.move_to(self) randy.shift(0.07*self.height*(RIGHT+UP)) self.randy = self.pi_creature = randy self.add_to_back(randy) orientation_line = Line(self.get_left(), self.get_right()) orientation_line.set_stroke(width = 0) self.add(orientation_line) self.orientation_line = orientation_line for light, color in zip(self.get_lights(), self.light_colors): light.set_fill(color, 1) light.is_subpath = False self.add_treds_to_tires()