Example #1
0
    def on_progress(self, progression: float) -> NoReturn:
        progression = AnimationTransition.out_quad(progression)

        if self._direction == "up":
            self.screen_in.y = (self.manager.y + self.manager.height *
                                progression) - self.screen_in.height
            self.screen_in.opacity = progression
        if self._direction == "down":
            self.screen_out.y = (self.manager.y -
                                 self.manager.height * progression)
            self.screen_out.opacity = 1 - progression
Example #2
0
    def sky_down(points, alpha):
        x = AnimationTransition.out_quad(alpha)
        x0, y0, x1, y1 = points
        h = (y1 - y0) * (4 - 3 * x)  # tend to correct height, from 0
        w = (x1 - x0) * (x)
        cx = (x0 + x1) / 2

        return (
            cx - w * .5, y0,
            cx + w * .5, y0,
            cx + w * .5, y0 + h,
            cx - w * .5, y0 + h,
        )
Example #3
0
    def sky_down(points, alpha):
        x = AnimationTransition.out_quad(alpha)
        x0, y0, x1, y1 = points
        h = (y1 - y0) * (4 - 3 * x)  # tend to correct height, from 0
        w = (x1 - x0) * (x)
        cx = (x0 + x1) / 2

        return (
            cx - w * .5,
            y0,
            cx + w * .5,
            y0,
            cx + w * .5,
            y0 + h,
            cx - w * .5,
            y0 + h,
        )
Example #4
0
    def roll_in(points, alpha):
        x0, y0, x1, y1 = points
        x = AnimationTransition.out_quad(alpha)
        H = (y1 - y0)
        W = (x1 - x0)
        h = H * x
        w = W * x
        h2 = h / 2
        w2 = w / 2
        cx = (x0 + x1) / 2 + H * (1 - x)
        cy = (y0 + y1) / 2 - H * .4 * (1 - x)
        a = pi * x
        pi4 = pi / 4

        return (
            cx + cos(a + 1 * pi4) * w2, cy + sin(a + 1 * pi4) * h2,
            cx + cos(a + 3 * pi4) * w2, cy + sin(a + 3 * pi4) * h2,
            cx + cos(a + 5 * pi4) * w2, cy + sin(a + 5 * pi4) * h2,
            cx + cos(a + 7 * pi4) * w2, cy + sin(a + 7 * pi4) * h2,
        )
Example #5
0
    def roll_in(points, alpha):
        x0, y0, x1, y1 = points
        x = AnimationTransition.out_quad(alpha)
        H = (y1 - y0)
        W = (x1 - x0)
        h = H * x
        w = W * x
        h2 = h / 2
        w2 = w / 2
        cx = (x0 + x1) / 2 + H * (1 - x)
        cy = (y0 + y1) / 2 - H * .4 * (1 - x)
        a = pi * x
        pi4 = pi / 4

        return (
            cx + cos(a + 1 * pi4) * w2,
            cy + sin(a + 1 * pi4) * h2,
            cx + cos(a + 3 * pi4) * w2,
            cy + sin(a + 3 * pi4) * h2,
            cx + cos(a + 5 * pi4) * w2,
            cy + sin(a + 5 * pi4) * h2,
            cx + cos(a + 7 * pi4) * w2,
            cy + sin(a + 7 * pi4) * h2,
        )