Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created May 28, 2011 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurenju/996712 to your computer and use it in GitHub Desktop.
Save yurenju/996712 to your computer and use it in GitHub Desktop.
tweener
const Clutter = imports.gi.Clutter;
const Tweener = imports.tweener.tweener;
function click(actor, ev) {
let properties = { time: 1.0,
x: texture.x+100,
y: texture.y+100,
scale_x: texture.scale_x*0.8,
scale_y: texture.scale_y*0.8,
opacity: texture.opacity*0.8
};
Tweener.addTween(texture, properties);
print('Clicked!');
return true;
}
function quit(actor) {
Clutter.main_quit();
}
Clutter.init(0, null);
let stage = new Clutter.Stage();
let texture = new Clutter.Texture({ filename: 'test.jpg',
reactive: true });
texture.connect('button-press-event', click);
stage.connect('destroy', quit);
stage.add_actor(texture);
stage.show();
Clutter.main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment