Skip to content

@philn /animate.py
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
import sys
import pygtk
pygtk.require('2.0')
from gi.repository import Clutter
Clutter.init(sys.argv)
stage = Clutter.Stage()
stage_color = Clutter.Color(0, 0, 0, 255)
actor_color = Clutter.Color(255, 255, 255, 99)
stage.set_size(200, 200)
stage.set_color(stage_color)
rect = Clutter.Rectangle.new_with_color(actor_color)
rect.set_size(40, 40)
rect.set_position(10, 10)
stage.add_actor(rect)
rect.show()
stage.show()
def on_alpha(alpha, data):
timeline = alpha.get_timeline()
return timeline.get_progress()
timeline = Clutter.Timeline.new(5000)
timeline.set_loop(True)
timeline.start()
#import pdb; pdb.set_trace()
alpha = Clutter.Alpha()
alpha.set_timeline(timeline)
alpha.set_func(on_alpha, None, None)
animation = rect.animate_with_alphav(alpha, 3,
["x", 150, "y", 150, "opacity", 0])
Clutter.main()
# adaptation of http://www.openismus.com/documents/clutter_tutorial/0.9/docs/tutorial/html/sec-actors-transformations.html
import sys
import pygtk
pygtk.require('2.0')
from gi.repository import Clutter
Clutter.init(sys.argv)
stage = Clutter.Stage()
stage_color = Clutter.Color(0, 0, 0, 255)
actor_color = Clutter.Color(255, 255, 255, 99)
stage.set_size(200, 200)
stage.set_color(stage_color)
rect = Clutter.Rectangle.new_with_color(actor_color)
rect.set_size(100, 100)
rect.set_position(20, 20)
stage.add_actor(rect)
rect.show()
rect.set_rotation(Clutter.RotateAxis.X_AXIS, -20, 0, 0, 0)
label = Clutter.Text.new_full("Sans 12", "Some Text", actor_color)
label.set_size(500, 500)
label.set_position(20, 150)
stage.add_actor(label)
label.show()
label.set_scale(3., 1.)
label.move_by(10, -10)
label.set_depth(-20)
stage.show()
Clutter.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.