Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hugohil/touchcode

Trigger special actions when user clic or touch a specific sequence of points in the screen
https://github.com/hugohil/touchcode

Last synced: about 17 hours ago
JSON representation

Trigger special actions when user clic or touch a specific sequence of points in the screen

Awesome Lists containing this project

README

        

# Touchcode

Touchcode lets you easily perform custom actions after a sequence of clic / touch is executed.

## Usage

Load the script:

```html

```

And add your touchcode:

```js
// Create a new Touchode instance ...
var tc = new Touchcode();

// ... and initialize it with your sequence, padding and you callback
tc.init([{x: 100, y: 100}, {x: 300, y: 400}, ...], 50, function(){
console.log('Touchcode: You did it !');
});
```

## Documentation


### touchcode.init(sequence, padding, callback)
Initilization of the Touchcode.

| Param | Type | Description |
| --- | --- | --- |
| sequence | Array | Sequence to execute. |
| padding | Number| The padding for the bouding box of your points. |
| callback | function | The callback function to be executed when the sequence is over. |

## TODO
* Implement a timeout to reset the counter.
* Define built-ins zone (e.g "top-left", "center", "bottom", "bottom-right", etc...)