def __init__(self, start, end, **kwargs): self.start = ensureArray(start) self.end = ensureArray(end) super().__init__(**kwargs) self.exposedProperties += ["start", "end"]
def __init__(self, start, end, **kwargs): self.start = ensureArray(start) self.end = ensureArray(end) super().__init__(**kwargs) self.distance = distance(self.start, self.end) self.normalized_direction = ((self.end - self.start) / self.distance) if "time" in kwargs: self.speed = (self.distance / kwargs["time"]) * .001
def __init__(self, center, radius, **kwargs): self.center = ensureArray(center) self.radius = radius super().__init__(**kwargs) self.exposedProperties += ["center", "radius"]
def __init__(self, size, **kwargs): self.objects = {} self.nextObjectId = 0 self.animations = {} self.nextAnimationId = 0 self.size = size self.backgroundColor = kwargs.get("backgroundColor", colors.background_color) self.defaultColor = kwargs.get("defaultColor", colors.default_color) self.ratio = kwargs.get("ratio", 1.0) self.center = ensureArray( kwargs.get("center", [self.size[0] / 2, self.size[1] / 2])) self.backend = kwargs.get("backend", PygameBackend)(size, self, **kwargs) self.time = kwargs.get("startTime", 0) self.deltaTime = None self.data = OrderedDict({}) self.debug = kwargs.get("debug", False) self.handler = EventHandler(types=["tick"]) self.on("tick", type(self).onTick) self.fps = self.backend.fps self.frame_time = 1000 / self.fps if self.backend.interactive: self.init_interactive(**kwargs) if self.debug: self.init_debug(**kwargs)
def __init__(self, start, width, height, **kwargs): self.start = ensureArray(start) self.width = width self.height = height super().__init__(**kwargs) self.exposedProperties += ["start", "width", "height"]
def __init__(self, start, content, font, **kwargs): self.start = ensureArray(start) self.font = font self.content = content self.size = kwargs.get("size", 1) super().__init__(**kwargs) self.exposedProperties += ["start", "content", "size"]
def __init__(self, points, **kwargs): self.points = [ensureArray(p) for p in points] super().__init__(**kwargs) self.distances = [distance(p1, p2) for p1, p2 in zip(self.points, self.points[1:])] self.total_distance = sum(self.distances) self.fractions = [distance / self.total_distance for distance in self.distances] self.normalized_vectors = [(p2 - p1) / distance(p1, p2) for p1, p2, in zip(self.points, self.points[1:])] if "time" in kwargs: self.total_time = kwargs["time"] else: self.total_time = total_distance self.speed = self.total_distance / self.total_time self.durations = [self.total_time * fraction for fraction in self.fractions] self.startTimes = [sum(self.durations[:part]) for part in range(len(self.points))] print(self.startTimes)
def __init__(self, coords, **kwargs): self.pos = ensureArray(coords) super().__init__(**kwargs) self.exposedProperties += ["pos"]
def __init__(self, center, radius, **kwargs): self.center = ensureArray(center) self.radius = radius super().__init__(**kwargs)
def point(self, time = None): if time is None: time = self.time return ensureArray(self.getPoint(time))
def __init__(self, points, **kwargs): self.points = [ensureArray(p) for p in points] super().__init__(**kwargs) self.exposedProperties += ["points"]