#! /usr/bin/python import clutter, gobject, gtk fps = 60 scale = 1.5 stage = clutter.stage_get_default() stage.set_color(clutter.color_parse('Black')) stage.fullscreen() stage.set_title('Cluttershow') def key_press (stage, event): if event.keyval == clutter.keysyms.q: clutter.main_quit() return True return False stage.connect('key-press-event', key_press) stage.show() def withdraw(actor): def completed(timeline, actor): behavior_scale.remove(actor) behavior_path.remove(actor) timeline = clutter.Timeline(fps*2, fps) alpha = clutter.Alpha(timeline, clutter.smoothstep_inc_func) timeline.connect("completed", completed, actor) behavior_scale = clutter.BehaviourScale(alpha, scale, 1, clutter.GRAVITY_CENTER) behavior_scale.apply(actor) behavior_path = clutter.BehaviourPath(alpha, (actor.get_abs_position(), (0, 0))) behavior_path.apply(actor) timeline.start() return False def pan(actor): def completed(timeline, actor): behavior.remove(actor) gobject.timeout_add (500, withdraw, actor) timeline = clutter.Timeline(fps*2, fps) timeline.connect("completed", completed, actor) knots = ( actor.get_abs_position(), (int(-((stage.get_width()*scale)-stage.get_width())+stage.get_width()/6), int(-stage.get_height() / 4)) ) behavior = clutter.BehaviourPath(clutter.Alpha(timeline, clutter.smoothstep_inc_func), knots) behavior.apply(actor) timeline.start() return False def fade(actor): def completed(timeline, actor): behavior.remove(actor) gobject.timeout_add (250, pan, actor) timeline = clutter.Timeline(fps/2, fps) timeline.connect("completed", completed, actor) behavior = clutter.BehaviourOpacity(clutter.Alpha(timeline, clutter.sine_inc_func), 0x00, 0xFF) behavior.apply(actor) actor.set_opacity(0) timeline.start() image = gtk.gdk.pixbuf_new_from_file_at_size("/home/ross/Pictures/Desktop/1024x768/rain.jpg", int(stage.get_width()*scale), int(stage.get_height()*scale)) texture = clutter.texture_new_from_pixbuf(image) texture.set_size(stage.get_width(), stage.get_height()) texture.set_scale_with_gravity(scale, scale, clutter.GRAVITY_CENTER) texture.set_position(-stage.get_width()/6, -stage.get_height() / 4) texture.show() stage.add(texture) fade(texture) clutter.main()