最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Adding shaders to existing shapes, labels, drawables? - Stack Overflow

programmeradmin0浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论