예제 #1
0
    def get_number_mobject(
            self,
            number,  # input number should be a origin_x
            number_config=None,
            scale_val=None,
            direction=None,
            buff=None,
            number_is_origin_x=True):
        number_config = merge_dicts_recursively(
            self.decimal_number_config,
            number_config or {},
        )
        if scale_val is None:
            scale_val = self.number_scale_val
        if direction is None:
            direction = self.label_direction
        buff = buff or self.line_to_number_buff

        num_mob = DecimalNumber(self.log_factor * (self.log_base**(number)),
                                **number_config)
        num_mob.scale(scale_val)
        num_mob.next_to(self.number_to_point(number, number_is_origin_x),
                        direction=direction,
                        buff=buff)
        return num_mob
예제 #2
0
    def get_number_mobject(self, x,
                           direction=None,
                           buff=None,
                           scale_val=None,
                           # number_config=None,
                           **number_config):
        number_config = merge_dicts_recursively(
            self.decimal_number_config,
            number_config or {},
        )
        if scale_val is None:
            scale_val = self.number_scale_val
        if direction is None:
            direction = self.line_to_number_direction
            #direction = self.label_direction
        if buff is None:
            buff = self.line_to_number_buff
        #buff = buff or self.line_to_number_buff

        num_mob = DecimalNumber(x, **number_config)
        num_mob.scale(scale_val)
        num_mob.next_to(
            self.number_to_point(x),
            direction=direction,
            buff=buff
        )
        if x < 0 and self.line_to_number_direction[0] == 0:
            # Align without the minus sign
            num_mob.shift(num_mob[0].get_width() * LEFT / 2)
        return num_mob
예제 #3
0
 def get_number_mobjects(self, *numbers, **kwargs):
     # TODO, handle decimals
     if len(numbers) == 0:
         numbers = self.default_numbers_to_display()
     result = VGroup()
     for number in numbers:
         mob = DecimalNumber(number, **self.decimal_number_config)
         mob.scale(self.number_scale_val)
         mob.next_to(
             self.number_to_point(number),
             self.label_direction,
             self.line_to_number_buff,
         )
         result.add(mob)
     return result
예제 #4
0
    def get_number_mobject(self,
                           number,
                           number_config=None,
                           scale_val=None,
                           direction=None,
                           buff=None):
        number_config = merge_dicts_recursively(
            self.decimal_number_config,
            number_config or {},
        )
        scale_val = scale_val or self.number_scale_val
        direction = direction or self.label_direction
        buff = buff or self.line_to_number_buff

        num_mob = DecimalNumber(number, **number_config)
        num_mob.scale(scale_val)
        num_mob.next_to(self.number_to_point(number),
                        direction=direction,
                        buff=buff)
        return num_mob
예제 #5
0
    def get_number_mobject(self, number,
                           number_config=None,
                           scale_val=None,
                           direction=None,
                           buff=None):
        number_config = merge_dicts_recursively(
            self.decimal_number_config,
            number_config or {},
        )
        if scale_val is None:
            scale_val = self.number_scale_val
        if direction is None:
            direction = self.label_direction
        buff = buff or self.line_to_number_buff

        num_mob = DecimalNumber(number, **number_config)
        num_mob.scale(scale_val)
        num_mob.next_to(
            self.number_to_point(number),
            direction=direction,
            buff=buff
        )
        return num_mob