杂波没有做完整的动画。
这是我当前的代码:
from gi.repository import Clutter, Gtk
import sys
def onClick(actor, event):
actor.animatev(Clutter.AnimationMode.LINEAR, 1000, ["x"], [280]) # clutter does not seem to be running this line
actor.animatev(Clutter.AnimationMode.LINEAR, 1000, ["x"], [20])
def main():
Clutter.init(sys.argv)
# Colors
red = Clutter.Color().new(255, 0, 0, 255)
black = Clutter.Color().new(0, 0, 0, 255)
# Create Stage
stage = Clutter.Stage()
stage.set_title("Basic Usage")
stage.set_size(400, 200)
stage.set_color(black)
# Rectangle Actor
actor = Clutter.Rectangle()
actor.set_size(100, 50)
actor.set_position(150, 100)
actor.set_color(red)
actor.set_reactive(True)
actor.connect("button-press-event", onClick)
# Add Actor to the Stage
stage.add_actor(actor)
stage.connect("destroy", lambda w: Clutter.main_quit())
stage.show_all()
Clutter.main()
if __name__ == '__main__':
main()
看看我的问题的这个例子:
对于那些不喜欢 gif 的人,我的问题是用文字描述的:我希望演员从中间向右移动,然后一直向左移动。相反,它只是从中间直接向左移动。
是什么原因造成的,我该如何解决?