예제 #1
0
def main():
    clock = RealtimeClock()
    g = Graph(clock)
    g.dump()

    GVWindow(g, width=400, height=400, resizable=True)
    run()
예제 #2
0
def hello():
    """Show a simple message"""
    root_layer = Layer(scale=(1, 16 / 8))
    hi_world = Text(root_layer, "Hello, World!", relative_anchor=(0.5, 0), position=(0.5, 0.5), scale=(0.001, 0.001))

    Window(root_layer, width=400, height=400)

    answer(root_layer, hi_world)

    run()
예제 #3
0
def demo():
    rootLayer = Layer()

    makeColorrect(rootLayer, 0, 90, (.5, .5, .5))
    makeColorrect(rootLayer, 1, -90, (1, 0, 0))
    makeColorrect(rootLayer, 2, 80, (1, 1, 0))
    makeColorrect(rootLayer, 3, -80, (0, 1, 0))
    makeColorrect(rootLayer, 4, 70, (1, 0, 1))
    makeColorrect(rootLayer, 5, -70, (0, 0, 1))
    makeColorrect(rootLayer, 6, 60, (0, 1, 1))
    makeColorrect(rootLayer, 7, -60, (.5, .5, .5))

    Window(rootLayer, resizable=True)

    run()
예제 #4
0
def demo():
    rootLayer = EffectLayer()
    rootLayer.mosaic = 10, 10

    fooLayer = EffectLayer(rootLayer)

    makeColorrect(fooLayer, 0, 90, (.5, .5, .5))
    makeColorrect(fooLayer, 1, -90, (1, 0, 0))
    makeColorrect(fooLayer, 2, 80, (1, 1, 0))
    makeColorrect(fooLayer, 3, -80, (0, 1, 0))
    makeColorrect(fooLayer, 4, 70, (1, 0, 1))
    makeColorrect(fooLayer, 5, -70, (0, 0, 1))
    makeColorrect(fooLayer, 6, 60, (0, 1, 1))
    makeColorrect(fooLayer, 7, -60, (.5, .5, .5))

    clock.schedule(gillcup.Animation(rootLayer, 'mosaic', 1, 1, time=10))
    clock.schedule(5 + gillcup.Animation(fooLayer, 'color', 0, 1, 0,
            timing=lambda t, s, d: (0.5 + math.sin(t - s) * 0.5) ** 5))

    Window(rootLayer, resizable=True)

    run()
예제 #5
0
파일: tikatko.py 프로젝트: encukou/tikatko
def main(time):
    top_layer = Layer(relative_anchor=(0.5, 0.5))
    clock = RealtimeClock()
    Window(top_layer, fullscreen=True)

    text_layer = Layer(top_layer,
        scale=(1, top_layer.scale_x/top_layer.scale_y))

    text = Countdown(text_layer, '', scale=0.001, font_size=256,
        relative_anchor=(0.5, 0.8), position=(0.5, 0.5), time=time)

    def game_over():
        def easing(power):
            return lambda x: 1 - (math.sin(x * TAU) / 2 + 0.5) ** power
        rect = Rectangle(top_layer, color=(1, 0, 0), opacity=0)
        clock.schedule(Animation(rect, 'color', 1, 1, 0,
            timing='infinite', easing=easing(1), time=0.1))
        clock.schedule(Animation(rect, 'opacity', 0.5, time=1))

    clock.schedule(Animation(text, 'time', 0, time=time, timing='infinite'))
    clock.schedule(game_over, dt=time)

    run()
예제 #6
0
from gillcup_graphics import Layer, Rectangle, Window, run, RealtimeClock

root_layer = Layer()

rect = Rectangle(root_layer,
        size=(0.5, 0.5),
        position=(0.5, 0.5),
        relative_anchor=(0.5, 0.5),
        rotation=45,
    )

Window(root_layer, width=400, height=400)

clock = RealtimeClock()


def blink(hide_flag):
    rect.hidden = hide_flag

    if not rect.dead:
        clock.schedule(lambda: blink(not hide_flag), 0.5)

blink(True)

run()
예제 #7
0
        start_x, start_y = self.drag_starts[pointer, button]
        self.x += x - start_x
        self.y += y - start_y
        return True

    def on_pointer_release(self, pointer, x, y, z, button, **kwargs):
        del self.drag_starts[pointer, button]
        return True


class DemoLayer(gillcup_graphics.Layer):
    def __init__(self, clock, *args, **kwargs):
        super(DemoLayer, self).__init__(*args, **kwargs)
        n = 10
        for x in range(n):
            for y in range(n):
                rct = DemoRect(self, clock, scale=(1 / n, 1 / n),
                    position=(x / n, y / n))
                if (x, y) == (5, 5):
                    rct.rotation = 30
                    rct.blue = 0.7
        DraggableRect(self, size=(0.05, 0.05), color=(0, 1, 0),
            position=(1 / 3, 1 / 3))


if __name__ == '__main__':
    clock = gillcup_graphics.RealtimeClock()
    layer = DemoLayer(clock)
    window = gillcup_graphics.Window(layer, width=500, height=500)
    gillcup_graphics.run()