Skip to content

Instantly share code, notes, and snippets.

@emilwidlund
Last active August 1, 2017 08:48
Show Gist options
  • Select an option

  • Save emilwidlund/199f8f2b7a5391558fbce6c4438b3f9c to your computer and use it in GitHub Desktop.

Select an option

Save emilwidlund/199f8f2b7a5391558fbce6c4438b3f9c to your computer and use it in GitHub Desktop.
{App, View, Gamepad, Focusable, Transitions, Grid} = require 'joystick'
homeView = new View
background:
backgroundColor: '#eaeaea'
for index in [0..2]
new Focusable
parent: homeView.safezone
x: 300 * index
y: 200
width: 200
height: 200
focusProperties:
scale: 1.2
backgroundColor: '#00eeaa'
animationOptions:
time: .2
animationOptions:
time: .2
actions: [
{
keyCode: 0,
function: () ->
myApp.transitionToView(anotherView, Transitions.goIn)
}
]
anotherView = new View
background:
backgroundColor: '#eaeaea'
actions: [
{
keyCode: 1
function: () ->
myApp.transitionToView(homeView, Transitions.goOut)
}
]
new TextLayer
parent: anotherView.safezone
text: 'This is anotherView'
x: Align.center
y: Align.center
textAlign: 'center'
myApp = new App
myApp.transitionToView(homeView)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment