Skip to content

Instantly share code, notes, and snippets.

@mikeymop
Last active October 7, 2016 15:56
Show Gist options
  • Save mikeymop/aced02118bafca77674a5092b8e9efee to your computer and use it in GitHub Desktop.
Save mikeymop/aced02118bafca77674a5092b8e9efee to your computer and use it in GitHub Desktop.
var tabris = require('tabris')
exports.create = function() {
return new tabris.Page({
title: "I told you so!",
topLevel: true
});
};
new tabris.ImageView({
layoutData: {left: 10, top: 10, width: 400, height: 400},
image: {src: "./images/anger.jpg"},
background: "#fff",
id: 'madman',
}).appendTo(landingPage);
new tabris.Button({
id:'exitButton',
text: "I'm Sorry!",
centerX: 0,
top: ['#madman', 20],
});
landingPage.open();
var tabris = require('tabris')
var page = new tabris.Page({
topLevel: true,
title: "myapp"
});
var pain = 0;
var landingPage = require("./landing");
var grumpy = new tabris.TextView({
layoutData: {centerX:0, centerY: 0},
text: "Hey!",
}).appendTo(page);
new tabris.Button({
id: 'magicButton',
text: "Press Me!",
centerX:0,
top: [grumpy, 20],
}).on('select', function() {
this.set("text", "Ouch!!");
++pain;
if (pain > 12){
landingPage.create().open();
} else if (pain > 10){ //yell at me
grumpy.set({text: "DUDE ENOUGH!",
textColor: "red"
});
grumpy.animate({ transform:{scaleX: 4, scaleY: 4}}, {duration: 500});
} else if (pain > 5) { //raise voice
grumpy.set({text: "Seriously, quit it!",
textColor: "maroon"
});
// grumpy.set({"textColor=maroon"});
grumpy.animate({ transform:{scaleX:2.0, scaleY:2.0}}, {duration: 500});
} else if (pain > 2) { //cut it
grumpy.set({text: "Can you stop?"});
}
}).appendTo(page);
grumpy.appendTo(page);
page.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment