Skip to content

Commit

Permalink
JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
John Marstall committed Oct 11, 2017
1 parent 47211c6 commit a45a102
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
39 changes: 39 additions & 0 deletions example.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
############################################
# Example usage.
# For all features, please check the README.
############################################

focusContainer = new Layer
width: 440
height: 80
x: Align.center
y: Align.center
backgroundColor: "clear"
for i in [0..4]
i = new TextLayer
parent: focusContainer
x: i * 90
backgroundColor: new Color("hsl(#{200 + i * 10}, 95, 57)")
width: 80
height: 80
borderRadius: 10
text: i
color: "white"
textAlign: "center"

document.addEventListener "keydown", (event) ->
keyCode = event.which
switch keyCode
when 13 then fe.changeFocus("select")
when 37 then fe.changeFocus("left")
when 38 then fe.changeFocus("up")
when 39 then fe.changeFocus("right")
when 40 then fe.changeFocus("down")
else null

fe.time = 0.5
fe.initialize(focusContainer.children)
fe.placeFocus(focusContainer.children[0])

for layer in focusContainer.children
layer.onTap -> fe.placeFocus(this)
11 changes: 11 additions & 0 deletions module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "FocusEngine",
"description": "Generates a developer panel to expose advanced features of your prototype.",
"author": "John Marstall",

"require": "fe = require 'FocusEngine'",
"install": "FocusEngine.coffee",
"example": "example.coffee",

"thumb": "thumb.png"
}

0 comments on commit a45a102

Please sign in to comment.