def animate(self):
self.angle += (math.pi / 30)
xs = 200 * math.sin(self.angle) - 40 + 25
ys = 200 * math.cos(self.angle) - 40 + 25
self.m_lightSource.setPos(xs, ys)
for item in self.m_items:
effect = item.graphicsEffect()
delta = QPointF(item.x() - xs, item.y() - ys)
effect.setOffset(QPointF(delta.toPoint() / 30))
dd = math.hypot(delta.x(), delta.y())
color = effect.color()
color.setAlphaF(max(0.4, min(1 - dd / 200.0, 0.7)))
effect.setColor(color)
self.m_scene.update()
评论列表
文章目录