Skip to content

Instantly share code, notes, and snippets.

@bulkan
Created May 2, 2013 06:57
Show Gist options
  • Save bulkan/5500572 to your computer and use it in GitHub Desktop.
Save bulkan/5500572 to your computer and use it in GitHub Desktop.
goog.provide('events_tutorial');
goog.require('lime.Director');
goog.require('lime.Scene');
goog.require('lime.Layer');
goog.require('lime.Label');
goog.require('lime.animation.FadeTo');
goog.require('lime.animation.Spawn');
goog.require('lime.animation.ScaleTo');
goog.require('events_tutorial.ColoredSprite');
goog.require('events_tutorial.Events');
events_tutorial.start = function(){
var director = new lime.Director(document.body,1024,768),
scene = new lime.Scene(),
target = new lime.Layer().setPosition(512,384);
var cs = new events_tutorial.ColoredSprite(1024,768);
target.appendChild(cs);
scene.appendChild(target);
director.makeMobileWebAppCapable();
goog.events.listen(events_tutorial.Events, ['CHANGECOLOR'], function() {
var pop = new lime.Label().
setSize(0,0).
setPosition(100, 100).
setText("Event Triggered").
setFontFamily('Comic Sans').
setFontColor("red").
setFontSize(35);
target.appendChild(pop);
var zoomOut = new lime.animation.Spawn(
new lime.animation.ScaleTo(2).setDuration(1),
new lime.animation.FadeTo(0).setDuration(1)
);
pop.runAction(zoomOut);
});
goog.events.listen(cs, ['mousedown','touchstart'], cs.changeColor);
director.replaceScene(scene);
}
goog.exportSymbol('events_tutorial.start', events_tutorial.start);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment