From a45a1027d503e4cdd1d07e51fff166be47763f27 Mon Sep 17 00:00:00 2001 From: John Marstall Date: Wed, 11 Oct 2017 17:32:37 -0500 Subject: [PATCH] JSON --- example.coffee | 39 +++++++++++++++++++++++++++++++++++++++ module.json | 11 +++++++++++ 2 files changed, 50 insertions(+) create mode 100644 example.coffee create mode 100644 module.json diff --git a/example.coffee b/example.coffee new file mode 100644 index 0000000..a94d9be --- /dev/null +++ b/example.coffee @@ -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) diff --git a/module.json b/module.json new file mode 100644 index 0000000..67fa677 --- /dev/null +++ b/module.json @@ -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" +}