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
def __init__(self, filename_or_array, **kwargs): digest_config(self, kwargs) if isinstance(filename_or_array, str): path = get_full_raster_image_path(filename_or_array) image = Image.open(path).convert(self.image_mode) self.pixel_array = np.array(image) else: self.pixel_array = np.array(filename_or_array) self.change_to_rgba_array() if self.invert: self.pixel_array[:, :, :3] = 255 - self.pixel_array[:, :, :3] Mobject.__init__(self, **kwargs)
def __init__(self, *args, **kwargs): # components are responsible for creating their own "unique enough" # keys self.key = self.make_key(*args) self.assert_primitive(self.key) self.labels = OrderedDict() # attributes are stored in the mobject, not the component. we call this # here so components can be added and removed like regular mobjects Mobject.__init__(self) delattr(self, "color") delattr(self, "name") delattr(self, "dim") delattr(self, "target") self.update_attrs(update_without_overwrite(kwargs, self.CONFIG), animate=False)
def __init__(self, **kwargs): digest_config(self, kwargs) self.epsilon = 1.0 / self.density Mobject.__init__(self, **kwargs)
def __init__(self, value=0, **kwargs): Mobject.__init__(self, **kwargs) self.points = np.zeros((1, 3)) self.set_value(value)