Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/hugohil/touchcode
- Owner: hugohil
- Created: 2015-06-29T14:20:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-17T09:20:40.000Z (almost 8 years ago)
- Last Synced: 2024-10-12T18:09:36.107Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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...)