Last active
October 7, 2016 15:56
-
-
Save mikeymop/aced02118bafca77674a5092b8e9efee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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