mirror of
https://github.com/martijndeb/pixdisp.git
synced 2025-02-22 09:48:27 +01:00
Add basic animation queue, documentation to follow. Update README with new shots.
This commit is contained in:
parent
543cad5228
commit
b90370351d
2 changed files with 25 additions and 9 deletions
|
@ -35,7 +35,7 @@ Some code linting practices and security tests can be executed by running the li
|
|||
### Drawing
|
||||

|
||||
|
||||
Simple clicking on the canvas in the responsive webinterface makes things light up.
|
||||
Simple clicking on the canvas in the responsive webinterface makes things light up, when you press submit it will get sent to the device.
|
||||
|
||||
### Camera
|
||||

|
||||
|
@ -46,3 +46,10 @@ The webinterface allows you to capture your camera and submit images from there.
|
|||

|
||||
|
||||
A simple web interface is included for drawing on the device. Defaults to port 8080.
|
||||
|
||||
### Coding
|
||||

|
||||
|
||||
[](http://www.youtube.com/watch?v=4mPzOF_h1kQ)
|
||||
|
||||
With an advanced editor you can write simple animations in the browser using a secure sandboxed javascript. Documentation will follow here once the API is final.
|
||||
|
|
|
@ -11,6 +11,7 @@ class VMController
|
|||
this.delta = 0;
|
||||
this.sandbox = {};
|
||||
this.vm = null;
|
||||
this.runNextFrame = false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -34,9 +35,11 @@ class VMController
|
|||
}
|
||||
|
||||
resetSandbox() {
|
||||
this.previousTime = this.getTimeData();
|
||||
let matrixSize = this.driver.getSize();
|
||||
|
||||
this.sandbox = {
|
||||
'sandbox': {},
|
||||
'WIDTH': matrixSize.width,
|
||||
'HEIGHT': matrixSize.height,
|
||||
|
||||
|
@ -51,7 +54,8 @@ class VMController
|
|||
'drawCircle': this.driver.drawCircle.bind( this.driver ),
|
||||
'write': this.driver.write.bind( this.driver ),
|
||||
|
||||
'delta': this.getDelta.bind( this )
|
||||
'delta': this.getDelta.bind( this ),
|
||||
'run': this.run.bind( this )
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -60,17 +64,18 @@ class VMController
|
|||
let delta = 0;
|
||||
let tmd = this.getTimeData();
|
||||
|
||||
if ( this.previousTime === 0 ) {
|
||||
this.previousTime = tmd;
|
||||
} else {
|
||||
delta = tmd - this.previousTime;
|
||||
this.previousTime = tmd;
|
||||
}
|
||||
delta = tmd - this.previousTime;
|
||||
|
||||
this.delta = delta;
|
||||
this.previousTime = tmd;
|
||||
|
||||
this.delta = delta / 1000000;
|
||||
|
||||
this.vm.run( this.runningVmScript, 'pixdisp-sandbox.js' );
|
||||
|
||||
if ( this.runNextFrame === true ) {
|
||||
this.runNextFrame = false;
|
||||
setTimeout( this.runScript.bind( this ), 1 );
|
||||
}
|
||||
}
|
||||
|
||||
getTimeData() {
|
||||
|
@ -85,6 +90,10 @@ class VMController
|
|||
getDelta() {
|
||||
return this.delta;
|
||||
}
|
||||
|
||||
run() {
|
||||
this.runNextFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
exports.VMController = VMController;
|
Loading…
Add table
Reference in a new issue