animators.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:susi_linux 作者: fossasia 项目源码 文件源码
def draw(self, ctx, width, height):

        self.tc += 0.2
        self.tc %= 2 * math.pi

        for i in range(-4, 5):
            ctx.set_source_rgb(0.2, 0.5, 1)
            ctx.set_line_width(6)
            ctx.set_line_cap(cairo.LINE_CAP_ROUND)
            if i % 2 == 0:
                ctx.move_to(width / 2 + i * 10, height / 2 + 3 - 8 * math.sin(self.tc + i))
                ctx.line_to(width / 2 + i * 10, height / 2 - 3 + 8 * math.sin(self.tc + i))
            else:
                ctx.set_source_rgb(0.2, 0.7, 1)
                ctx.move_to(width / 2 + i * 10, height / 2 + 3 - 8 * math.cos(self.tc - i))
                ctx.line_to(width / 2 + i * 10, height / 2 - 3 + 8 * math.cos(self.tc - i))
            ctx.stroke()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号