Skip to content

Commit

Permalink
chore(leap-motion): first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecasar committed Oct 6, 2015
0 parents commit 40f9b8d
Show file tree
Hide file tree
Showing 7 changed files with 689 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bower_components
.yo-rc.json
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# leap-motion

An element providing a wrapper for Leap Motion.


## Dependencies

Element dependencies are managed via [Bower](http://bower.io/). You can
install that via:

npm install -g bower

Then, go ahead and download the element's dependencies:

bower install


## Playing With Your Element

If you wish to work on your element in isolation, we recommend that you use
[Polyserve](https://github.com/PolymerLabs/polyserve) to keep your element's
bower dependencies in line. You can install it via:

npm install -g polyserve

And you can run it via:

polyserve

Once running, you can preview your element at
`http://localhost:8080/components/leap-motion/`, where `leap-motion` is the name of the directory containing it.


## Testing Your Element

Simply navigate to the `/test` directory of your element to run its tests. If
you are using Polyserve: `http://localhost:8080/components/leap-motion/test/`

### web-component-tester

The tests are compatible with [web-component-tester](https://github.com/Polymer/web-component-tester).
Install it via:

npm install -g web-component-tester

Then, you can run your tests on _all_ of your local browsers via:

wct

#### WCT Tips

`wct -l chrome` will only run tests in chrome.

`wct -p` will keep the browsers alive after test runs (refresh to re-run).

`wct test/some-file.html` will test only the files you specify.
31 changes: 31 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "leap-motion",
"version": "1.0.1",
"authors": [
"Anonymous <[email protected]>"
],
"description": "An element providing a solution to no problem in particular.",
"keywords": [
"web-component",
"polymer",
"seed"
],
"main": [
"leap-motion.html",
"leap-motion-hand.html"
],
"license": "http://polymer.github.io/LICENSE.txt",
"homepage": "https://github.com/<USERNAME>/seed-element/",
"ignore": [
"/.*",
"/test/"
],
"dependencies": {
"leapjs": "~0.6.4",
"polymer": "Polymer/polymer#^1.0.0"
},
"devDependencies": {
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
"web-component-tester": "*"
}
}
96 changes: 96 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>leap-motion Demo</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../leap-motion.html">
<link rel="import" href="../leap-motion-hand.html">
</head>
<body unresolved>

<template is="dom-bind">
<ul>
<li>
<label>
<input type="checkbox" disabled checked$="[[connected]]"/>
Connected
</label>
</li>
<li>
<label>
<input type="checkbox" disabled checked$="[[isFocus]]"/>
Focus
</label>
</li>
<li>
<label>
<input type="checkbox" disabled checked$="[[isDeviceAttached]]"/>
Device attached
</label>
</li>
<li>
<label>
<input type="checkbox" disabled checked$="[[isDeviceConnected]]"/>
Device connected
</label>
</li>
<li>
<label>
<input type="checkbox" disabled checked$="[[isDeviceStreaming]]"/>
Device streaming
</label>
</li>
<li>
<label>
<input type="checkbox" disabled checked$="[[streaming]]"/>
Streaming
</label>
</li>
<li>
Gesture (<span>{{gesture.state}}</span>)
<pre>{{gesture}}</pre>
</li>
</ul>
<leap-motion
auto
enable-gestures
last-frame="{{frame}}"
last-gesture="{{gesture}}"
connected="{{connected}}"
streaming="{{streaming}}"
is-device-attached="{{isDeviceAttached}}"
is-device-connected="{{isDeviceConnected}}"
is-device-streaming="{{isDeviceStreaming}}"
is-focus="{{isFocus}}"
>
<template is="dom-repeat" items="{{frame.hands}}" as="hand">
<leap-motion-hand hand="{{hand}}" confidence="{{confidence}}" type="{{type}}">
<p>{{confidence}}</p>
<p>{{type}}</p>
</leap-motion-hand>
</template>
</leap-motion>

</template>
<script>
var frame = {
hands: [{
confidence: 0.23412,
type: 'right'
}]
};
</script>

</body>
</html>
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">

</head>
<body unresolved>
<!-- Note: if the main element for this repository doesn't
match the folder name, add a src="&lt;main-component&gt;.html" attribute,
where &lt;main-component&gt;.html" is a file that imports all of the
components you want documented. -->
<iron-component-page></iron-component-page>

</body>
</html>
13 changes: 13 additions & 0 deletions leap-motion.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<link rel="import" href="../polymer/polymer.html">
<script src="../leapjs/leap-0.6.4.js"></script>
<dom-module id="leap-motion">
<style>
:host {
display: block;
}
</style>
<template>
<content></content>
</template>
</dom-module>
<script src="leap-motion.js"></script>
Loading

0 comments on commit 40f9b8d

Please sign in to comment.