我在Kivy制作了一个Widget,以便为图像添加动画效果。
<AnimatedImage>:
pos_hint: root.pos_hint
size: root.size
size_hint: .3, .3
canvas:
Rectangle:
source: 'images/image.png'
pos: self.pos[0], self.pos[1]
size: root.size[0], 435. / 770 * root.size[0]
正如您在最后一行中所看到的,我使用图像比率来计算矩形大小。
我想在调整中加载不同的图像并调整小部件的大小。
使用Image而不是Widget。我无法使用动画对象为Image size_hint设置动画。
谢谢!