Skip to content

roryhardy/reveal-leap-motion

Repository files navigation

reveal-leap-motion

NPM version Build Status

This plugin lets you utilize your Leap Motion device to control basic navigation of your Reveal.js presentation.

Featured in:

Getting Started

  1. Download and install the package in the presentation project: npm i -S reveal-leap-motion
  2. Add the plugin to the dependencies in the presentation, as below:
Reveal.initialize({
    // ...
    dependencies: [
        // ...
        { src: 'node_modules/reveal-leap-motion/reveal-leap-motion.min.js', async: true }
    ]
});

Config Options

You can edit the following options:

Property Default Description
autoCenter true Center the pointer based on where your finger enters the leap motion's detection field.
gestureDelay 500 How long to delay between gestures in milliseconds.
naturalSwipe true Swipe as though you were using a touch screen. Set to false to invert.
pointerColor #00aaff The color of the pointer.
pointerOpacity 0.7 The opacity of the pointer.
pointerSize 15 The minimum height and width of the pointer.
pointerTolerance 120 Larger values yield slower movement.

Example configuration:

Reveal.initialize({
  //...
  "reveal-leap-motion": {
    naturalSwipe: false,     // Invert swipe gestures
    pointerColor: '#d80000', // Red pointer
    pointerOpacity: 0.5,     // Set pointer opacity to 0.5
  },
});

Supported Gestures

Index Finger Only

When a single index finger is extended, a circular pointer will appear on screen, which tracks the finger. Moving closer to the device expands the pointer.

Multiple Fingers with One Hand

Navigate through the slides by swiping up, down, left, or right. See the config options to invert movements.

Two Hands

Swiping upwards with two hands will toggle the overview mode. A second swipe will exit the overview.

Callouts

reveal-leap-js includes LeapJS, developed by Leap Motion for your convenience. LeapJS is licensed under the Apache 2.0 license which can be obtained here.

Contributing

Contributions are encouraged and welcome! To get started, please see the contribution guide.