Touchcode lets you easily perform custom actions after a sequence of clic / touch is executed.
Load the script:
<script type="text/javascript" src="path/to/touchcode.js"></script>
And add your touchcode:
// 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 !');
});
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. |
- Implement a timeout to reset the counter.
- Define built-ins zone (e.g "top-left", "center", "bottom", "bottom-right", etc...)