Nodeschool Public Materials

    @2players/dollar1-unistroke-recognizer

    0.3.1 • Public • Published

    dollar1-unistroke-recognizer

    $1 Unistroke Recognizer Version code style: prettier Module System Dependency Status Travis Build Status NPM Downloads

    A wrapper of $1 Unistroke Recognizer.

    Install

    $ npm install @2players/dollar1-unistroke-recognizer
    

    Usage

    import GestureRecognizer from '@2players/dollar1-unistroke-recognizer'
     
    // create recognizer with default strokes
    const gr = new GestureRecognizer()
     
    // create recognizer without default strokes
    const gr = new GestureRecognizer({ defaultStrokes: false })
     
    /**
     * recognize gestures
     */
    const stroke = [
      { x: 310, y: 230 },
      { x: 333, y: 186 },
      { x: 356, y: 215 },
      { x: 375, y: 186 },
      { x: 399, y: 216 },
      { x: 418, y: 186 },
    ]
     
    gr.recognize(stroke, true)
    // 'zig-zag'
     
    /**
     * add custom gesture
     *
     * If you don't know how to get enough points, you can try following app:
     *
     *   https://2players.github.io/unistroke-creator/
     */
    const customStroke = [
      { x: 0, y: 0 },
      // ... more points
    ]
    gr.add('a-name', customStroke)
     
    /**
     * reset gestures
     *
     * Remove all customized gestures.
     */
    gr.reset()

    Related

    License

    MIT © 2Players Studio

    Keywords

    none

    Install

    npm i @2players/dollar1-unistroke-recognizer

    DownloadsWeekly Downloads

    35

    Version

    0.3.1

    License

    MIT

    Unpacked Size

    37.4 kB

    Total Files

    4

    Last publish

    Collaborators

    • m31271n_