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()
评论列表
文章目录