admin管理员组

文章数量:1320165

Good day, friends! I would like to use existing drawable object like pyglet.shapes.Rectangle, pyglet.shapes.Line or pyglet.text.Label and add some shader effects like scaling over time, changing color over time.

class TestLabel(Label):
    def __init__(self):
        super().__init__(
            text="y",
            font_name="Arial",
            font_size=90,
            color=(0, 0, 255, 255),
            x=640, y=390)
    
    def scale(self, factor, time):
        # Slowly grow over time
        pass

    def change_color(self, to_this_color, time):
        # Transition rgba values of label to target color within the time
        pass

Is this even an option? Do I really have to create a custom class including a shader program from the ground up if I would like to have a blinking/scaling rectangle? Do I really have then to implement custom events, behaviour etc.?

Does someone have code for blinking/scaling rectangle?

本文标签: pythonAdding shaders to existing shapeslabelsdrawablesStack Overflow