{"id":13439636,"url":"https://github.com/nok/leap-motion-processing","last_synced_at":"2025-12-17T14:36:12.610Z","repository":{"id":6747199,"uuid":"7993534","full_name":"nok/leap-motion-processing","owner":"nok","description":"Contributed library to use the Leap Motion in Processing.","archived":false,"fork":false,"pushed_at":"2017-10-11T13:45:53.000Z","size":161824,"stargazers_count":305,"open_issues_count":4,"forks_count":72,"subscribers_count":44,"default_branch":"master","last_synced_at":"2025-06-11T09:59:17.630Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/nok/leap-motion-processing","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-03T17:15:34.000Z","updated_at":"2025-04-07T01:49:04.000Z","dependencies_parsed_at":"2022-09-17T06:31:15.021Z","dependency_job_id":null,"html_url":"https://github.com/nok/leap-motion-processing","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/nok/leap-motion-processing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nok%2Fleap-motion-processing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nok%2Fleap-motion-processing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nok%2Fleap-motion-processing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nok%2Fleap-motion-processing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nok","download_url":"https://codeload.github.com/nok/leap-motion-processing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nok%2Fleap-motion-processing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27783737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-17T02:00:08.291Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:15.824Z","updated_at":"2025-12-17T14:36:12.595Z","avatar_url":"https://github.com/nok.png","language":"Java","funding_links":[],"categories":["HarmonyOS","Libraries"],"sub_categories":["Windows Manager","Contributions"],"readme":"![Leap Motion for Processing](reference/github_cover.png)\n\n===\n\n[![Join the chat at https://gitter.im/nok/leap-motion-processing](https://badges.gitter.im/nok/leap-motion-processing.svg)](https://gitter.im/nok/leap-motion-processing?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/nok/leap-motion-processing/master/LICENSE.txt)\n\nContributed library to use the [Leap Motion](https://leapmotion.com/) in [Processing](http://processing.org/).\n\n\n## Table of Contents\n\n- [About](#about)\n- [Download](#download)\n- [Installation](#installation)\n- [Dependencies](#dependencies)\n- [Tested](#tested)\n- [Usage](#usage)\n- [Changelog](#changelog)\n- [Questions?](#questions)\n- [License](#license)\n\n\n## About\n\nThe Leap detects and tracks hands, fingers and finger-like tools. The device operates in an intimate proximity with high precision and tracking frame rate.\n\nThe Leap software analyzes the objects observed in the device field of view. It recognizes hands, fingers, and tools, reporting both discrete positions and motion. The Leap field of view is an inverted pyramid centered on the device. The effective range of the Leap extends from approximately 25 to 600 millimeters above the device (1 inch to 2 feet).\n\n\n## Download\n\n- [Leap Motion for Processing v2.3.1.6](download/LeapMotionForProcessing.zip?raw=true)\n\n\n## Installation\n\nEither you use the import manager of Processing (`Sketch \u003e Import library ... \u003e Add library ... \u003e Filter: \"Leap Motion\"`).\n\nOr you [download](download/LeapMotionForProcessing.zip?raw=true), unzip and copy the extracted *LeapMotionForProcessing* folder into the libraries folder of your Processing sketches. The reference and examples are stored in the *LeapMotionForProcessing* directory. For further help you can read the [instructions](http://www.learningprocessing.com/tutorials/libraries/) by [Daniel Shiffman](https://github.com/shiffman).\n\n\n## Dependencies\n\n- Running [Leap Motion Software](https://developer.leapmotion.com/v2) v2 (2.3.1+31549)\n\n\n## Tested\n\nSystem:\n\n- **OSX** (*Mac OS 10.7 and higher*)\n- **Linux** (*not tested yet, but it should work*) (*Ubuntu Linux 12.04 LTS and Ubuntu 13.04 Raring Ringtail*)\n- **Windows** (*not tested yet, but x86 and x64 should work*) (*Windows 7 and 8*)\n\nProcessing version:\n\n- 3.2.3\n- 3.1.2\n- 3.1.1\n- 3.0.2\n- 3.0.1\n- 3.0a5\n\nTo use an older version of Processing examine the [release](https://github.com/nok/leap-motion-processing/releases) section:\n\n- 2.2.1\n- 2.1.2\n- 2.1.1\n- 2.1.0\n- 2.0.1\n- 2.0b9\n- 2.0b8\n- 2.0b7\n\nLeap Motion Software version:\n\n* **2.3.1+31549**\n* 2.2.5+26752\n* 2.2.4+26750\n* 2.2.3+25971\n* 2.2.1+24116\n* 2.2.0+23475\n* 2.1.6+23110\n* 2.1.5+22699\n* 2.0.5+18024 beta\n* 2.0.4+17546 beta\n* 2.0.3+17004 beta\n* 2.0.2+16391 beta\n* 2.0.1+15831 beta\n* 2.0.0+13819 beta\n\n\n## Usage\n\n* [Basics](#basics)\n* [Gestures](#gestures)\n* [Camera-Images](#camera-images)\n\n\n### Basics\n\nThe following example shows the basic [data access](reference/e1_basic.png):\n\n```java\nimport de.voidplus.leapmotion.*;\n\n// ======================================================\n// Table of Contents:\n// ├─ 1. Callbacks\n// ├─ 2. Hand\n// ├─ 3. Arms\n// ├─ 4. Fingers\n// ├─ 5. Bones\n// ├─ 6. Tools\n// └─ 7. Devices\n// ======================================================\n\n\nLeapMotion leap;\n\nvoid setup() {\n  size(800, 500);\n  background(255);\n  // ...\n\n  leap = new LeapMotion(this);\n}\n\n\n// ======================================================\n// 1. Callbacks\n\nvoid leapOnInit() {\n  // println(\"Leap Motion Init\");\n}\nvoid leapOnConnect() {\n  // println(\"Leap Motion Connect\");\n}\nvoid leapOnFrame() {\n  // println(\"Leap Motion Frame\");\n}\nvoid leapOnDisconnect() {\n  // println(\"Leap Motion Disconnect\");\n}\nvoid leapOnExit() {\n  // println(\"Leap Motion Exit\");\n}\n\n\nvoid draw() {\n  background(255);\n  // ...\n\n  int fps = leap.getFrameRate();\n  for (Hand hand : leap.getHands ()) {\n\n\n    // ==================================================\n    // 2. Hand\n\n    int     handId             = hand.getId();\n    PVector handPosition       = hand.getPosition();\n    PVector handStabilized     = hand.getStabilizedPosition();\n    PVector handDirection      = hand.getDirection();\n    PVector handDynamics       = hand.getDynamics();\n    float   handRoll           = hand.getRoll();\n    float   handPitch          = hand.getPitch();\n    float   handYaw            = hand.getYaw();\n    boolean handIsLeft         = hand.isLeft();\n    boolean handIsRight        = hand.isRight();\n    float   handGrab           = hand.getGrabStrength();\n    float   handPinch          = hand.getPinchStrength();\n    float   handTime           = hand.getTimeVisible();\n    PVector spherePosition     = hand.getSpherePosition();\n    float   sphereRadius       = hand.getSphereRadius();\n\n    // --------------------------------------------------\n    // Drawing\n    hand.draw();\n\n\n    // ==================================================\n    // 3. Arm\n\n    if (hand.hasArm()) {\n      Arm     arm              = hand.getArm();\n      float   armWidth         = arm.getWidth();\n      PVector armWristPos      = arm.getWristPosition();\n      PVector armElbowPos      = arm.getElbowPosition();\n    }\n\n\n    // ==================================================\n    // 4. Finger\n\n    Finger  fingerThumb        = hand.getThumb();\n    // or                        hand.getFinger(\"thumb\");\n    // or                        hand.getFinger(0);\n\n    Finger  fingerIndex        = hand.getIndexFinger();\n    // or                        hand.getFinger(\"index\");\n    // or                        hand.getFinger(1);\n\n    Finger  fingerMiddle       = hand.getMiddleFinger();\n    // or                        hand.getFinger(\"middle\");\n    // or                        hand.getFinger(2);\n\n    Finger  fingerRing         = hand.getRingFinger();\n    // or                        hand.getFinger(\"ring\");\n    // or                        hand.getFinger(3);\n\n    Finger  fingerPink         = hand.getPinkyFinger();\n    // or                        hand.getFinger(\"pinky\");\n    // or                        hand.getFinger(4);        \n\n\n    for (Finger finger : hand.getFingers()) {\n      // or              hand.getOutstretchedFingers();\n      // or              hand.getOutstretchedFingersByAngle();\n\n      int     fingerId         = finger.getId();\n      PVector fingerPosition   = finger.getPosition();\n      PVector fingerStabilized = finger.getStabilizedPosition();\n      PVector fingerVelocity   = finger.getVelocity();\n      PVector fingerDirection  = finger.getDirection();\n      float   fingerTime       = finger.getTimeVisible();\n\n      // ------------------------------------------------\n      // Drawing\n\n      // Drawing:\n      // finger.draw();  // Executes drawBones() and drawJoints()\n      // finger.drawBones();\n      // finger.drawJoints();\n\n      // ------------------------------------------------\n      // Selection\n\n      switch(finger.getType()) {\n      case 0:\n        // System.out.println(\"thumb\");\n        break;\n      case 1:\n        // System.out.println(\"index\");\n        break;\n      case 2:\n        // System.out.println(\"middle\");\n        break;\n      case 3:\n        // System.out.println(\"ring\");\n        break;\n      case 4:\n        // System.out.println(\"pinky\");\n        break;\n      }\n\n\n      // ================================================\n      // 5. Bones\n      // --------\n      // https://developer.leapmotion.com/documentation/java/devguide/Leap_Overview.html#Layer_1\n\n      Bone    boneDistal       = finger.getDistalBone();\n      // or                      finger.get(\"distal\");\n      // or                      finger.getBone(0);\n\n      Bone    boneIntermediate = finger.getIntermediateBone();\n      // or                      finger.get(\"intermediate\");\n      // or                      finger.getBone(1);\n\n      Bone    boneProximal     = finger.getProximalBone();\n      // or                      finger.get(\"proximal\");\n      // or                      finger.getBone(2);\n\n      Bone    boneMetacarpal   = finger.getMetacarpalBone();\n      // or                      finger.get(\"metacarpal\");\n      // or                      finger.getBone(3);\n\n      // ------------------------------------------------\n      // Touch emulation\n\n      int     touchZone        = finger.getTouchZone();\n      float   touchDistance    = finger.getTouchDistance();\n\n      switch(touchZone) {\n      case -1: // None\n        break;\n      case 0: // Hovering\n        // println(\"Hovering (#\" + fingerId + \"): \" + touchDistance);\n        break;\n      case 1: // Touching\n        // println(\"Touching (#\" + fingerId + \")\");\n        break;\n      }\n    }\n\n\n    // ==================================================\n    // 6. Tools\n\n    for (Tool tool : hand.getTools()) {\n      int     toolId           = tool.getId();\n      PVector toolPosition     = tool.getPosition();\n      PVector toolStabilized   = tool.getStabilizedPosition();\n      PVector toolVelocity     = tool.getVelocity();\n      PVector toolDirection    = tool.getDirection();\n      float   toolTime         = tool.getTimeVisible();\n\n      // ------------------------------------------------\n      // Drawing:\n      // tool.draw();\n\n      // ------------------------------------------------\n      // Touch emulation\n\n      int     touchZone        = tool.getTouchZone();\n      float   touchDistance    = tool.getTouchDistance();\n\n      switch(touchZone) {\n      case -1: // None\n        break;\n      case 0: // Hovering\n        // println(\"Hovering (#\" + toolId + \"): \" + touchDistance);\n        break;\n      case 1: // Touching\n        // println(\"Touching (#\" + toolId + \")\");\n        break;\n      }\n    }\n  }\n\n\n  // ====================================================\n  // 7. Devices\n\n  for (Device device : leap.getDevices()) {\n    float deviceHorizontalViewAngle = device.getHorizontalViewAngle();\n    float deviceVericalViewAngle = device.getVerticalViewAngle();\n    float deviceRange = device.getRange();\n  }\n}\n```\n\n\n### Gestures\n\n![Snapshot](reference/leap_gestures.jpg)\n\n\u003e Source: [Leap Motion](https://developer.leapmotion.com/documentation/skeletal/java/devguide/Leap_Overview.html#gestures)\n\nThe following example shows how to recognize predefined gestures:\n\n```java\nimport de.voidplus.leapmotion.*;\n\n// ======================================================\n// Table of Contents:\n// ├─ 1. Swipe Gesture\n// ├─ 2. Circle Gesture\n// ├─ 3. Screen Tap Gesture\n// └─ 4. Key Tap Gesture\n// ======================================================\n\n\nLeapMotion leap;\n\nvoid setup(){\n  size(800, 500);\n  background(255);\n  // ...\n\n  leap = new LeapMotion(this).allowGestures();  // All gestures\n  // leap = new LeapMotion(this).allowGestures(\"circle, swipe, screen_tap, key_tap\");\n  // leap = new LeapMotion(this).allowGestures(\"swipe\");  // Leap detects only swipe gestures\n}\n\nvoid draw(){\n  background(255);\n  // ...\n}\n\n\n// ======================================================\n// 1. Swipe Gesture\n\nvoid leapOnSwipeGesture(SwipeGesture g, int state){\n  int     id               = g.getId();\n  Finger  finger           = g.getFinger();\n  PVector position         = g.getPosition();\n  PVector positionStart    = g.getStartPosition();\n  PVector direction        = g.getDirection();\n  float   speed            = g.getSpeed();\n  long    duration         = g.getDuration();\n  float   durationSeconds  = g.getDurationInSeconds();\n\n  switch(state){\n    case 1: // Start\n      break;\n    case 2: // Update\n      break;\n    case 3: // Stop\n      println(\"SwipeGesture: \" + id);\n      break;\n  }\n}\n\n\n// ======================================================\n// 2. Circle Gesture\n\nvoid leapOnCircleGesture(CircleGesture g, int state){\n  int     id               = g.getId();\n  Finger  finger           = g.getFinger();\n  PVector positionCenter   = g.getCenter();\n  float   radius           = g.getRadius();\n  float   progress         = g.getProgress();\n  long    duration         = g.getDuration();\n  float   durationSeconds  = g.getDurationInSeconds();\n  int     direction        = g.getDirection();\n\n  switch(state){\n    case 1: // Start\n      break;\n    case 2: // Update\n      break;\n    case 3: // Stop\n      println(\"CircleGesture: \" + id);\n      break;\n  }\n\n  switch(direction){\n    case 0: // Anticlockwise/Left gesture\n      break;\n    case 1: // Clockwise/Right gesture\n      break;\n  }\n}\n\n\n// ======================================================\n// 3. Screen Tap Gesture\n\nvoid leapOnScreenTapGesture(ScreenTapGesture g){\n  int     id               = g.getId();\n  Finger  finger           = g.getFinger();\n  PVector position         = g.getPosition();\n  PVector direction        = g.getDirection();\n  long    duration         = g.getDuration();\n  float   durationSeconds  = g.getDurationInSeconds();\n\n  println(\"ScreenTapGesture: \" + id);\n}\n\n\n// ======================================================\n// 4. Key Tap Gesture\n\nvoid leapOnKeyTapGesture(KeyTapGesture g){\n  int     id               = g.getId();\n  Finger  finger           = g.getFinger();\n  PVector position         = g.getPosition();\n  PVector direction        = g.getDirection();\n  long    duration         = g.getDuration();\n  float   durationSeconds  = g.getDurationInSeconds();\n\n  println(\"KeyTapGesture: \" + id);\n}\n\n```\n\n### Camera-Images\n\nFurthermore you have access to the [raw camera images](reference/e3_camera_images.png):\n\n```java\nimport de.voidplus.leapmotion.*;\n\n\nLeapMotion leap;\n\nvoid setup(){\n\tsize(640, 480);\n\tbackground(255);  \n\tleap = new LeapMotion(this);\n}\n\nvoid draw(){\n\tbackground(255);\n\n\tif (leap.hasImages()) {\n\t\tfor (Image camera : leap.getImages()) {\n\t\t\tif (camera.isLeft()) {\n\t\t\t\t// left camera\n\t\t\t\timage(camera, 0, 0);\n\t\t\t} else {\n\t\t\t\t// right camera\n\t\t\t\timage(camera, 0, camera.getHeight());\n\t\t\t}\n\t\t}\n\t}\n\n}\n```\n\n\n## Changelog\n\nYou can find the changes in the [release](https://github.com/nok/leap-motion-processing/releases) section.\n\n\n## Questions?\n\nDon't be shy and feel free to contact me on [Twitter](https://twitter.com/darius_morawiec) or [Gitter](https://gitter.im/nok/leap-motion-processing).\n\n\n## License\n\nThe library is Open Source Software released under the [license](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnok%2Fleap-motion-processing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnok%2Fleap-motion-processing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnok%2Fleap-motion-processing/lists"}