JavaScript mode examples updated for Processing 1.4.0

This commit is contained in:
fjenett
2012-08-03 18:39:49 +00:00
parent 6d4a1b941d
commit 99be4df137
13 changed files with 13 additions and 15 deletions

View File

@@ -14,7 +14,7 @@
// Get the instance. We just use the first one. Another way would be to use
// the automaticaly generated ID "colorFinder", see <canvas> in index.html
var mySketchInstance = Processing.instances[0];
var mySketchInstance = Processing.getInstanceById( getProcessingSketchID() );
if ( mySketchInstance == undefined ) { // means it has not started
setTimeout( makeTheLink, 200 ); // try again later

View File

@@ -5,7 +5,7 @@ window.onload = function () {
}
function tryFindSketch () {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById( getProcessingSketchID() );
if ( sketch == undefined )
setTimeout(tryFindSketch, 200); // retry after 0.2 secs
else

View File

@@ -12,7 +12,7 @@ window.onload = function () {
// this is called (repeatedly) to find the sketch
function getSketchInstance() {
var s = Processing.instances[0];
var s = Processing.getInstanceById(getProcessingSketchID());
if ( s == undefined ) {
setTimeout(getSketchInstance, 200); // try again a bit later

View File

@@ -4,7 +4,7 @@ window.onload = function () {
}
function tryFindSketch() {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById(getProcessingSketchID());
if ( sketch == undefined )
return setTimeout(tryFindSketch, 200); // retry soon

View File

@@ -6,7 +6,7 @@ window.onload = function () {
// find sketch instance
function tryFindSketch () {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById(getProcessingSketchID());
if ( sketch == undefined )
setTimeout( tryFindSketch, 200 ); // try again in 0.2 secs
else

View File

@@ -4,7 +4,7 @@ window.onload = function () {
var audioNode = document.getElementsByTagName("audio")[0];
function tryFindSketch () {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById(getProcessingSketchID());
if ( sketch == undefined )
setTimeout(tryFindSketch,200); // retry
else

View File

@@ -6,7 +6,7 @@ window.onload = function () {
// try and find the sketch
function tryLinkSketch() {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById( getProcessingSketchID() );
if ( sketch == undefined )
setTimeout(tryLinkSketch, 200); /*try again later*/
else {

View File

@@ -6,7 +6,7 @@ window.onload = function () {
}
function tryFindSketch () {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById(getProcessingSketchID());
if ( sketch == undefined )
return setTimeout(tryFindSketch, 200); // try again ..

View File

@@ -3,7 +3,7 @@ window.onload = function () {
}
function tryFindSketch () {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById(getProcessingSketchID());
if ( sketch == undefined ) return setTimeout(tryFindSketch, 200);
var controller = new Controller(sketch,"form-form");

View File

@@ -13,14 +13,12 @@
* <video width="480" height="360" style="display:none">
* <source src="charmy.mp4" />
* <source src="charmy.ogv" />
* <source src="charmy.webm" />
* </video>
*/
Video video;
PImage frame;
float fSec = 1/25.0;
int fMillis = int(1000 * fSec);
int ts = 0;
void setup ()
{

View File

@@ -11,7 +11,7 @@ window.onload = function () {
// try to get the sketch instance from Processing.js
function tryFindSketch () {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById(getProcessingSketchID());
if ( sketch == undefined )
return setTimeout( tryFindSketch, 200 ); // retry

View File

@@ -18,7 +18,7 @@ window.onload = function () {
var sendImage = null;
function tryFindSketch () {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById(getProcessingSketchID());
if ( sketch == undefined )
return setTimeout(tryFindSketch, 200); //retry later

View File

@@ -6,7 +6,7 @@ window.onload = function () {
var sendTweet = null;
function tryFindSketch () {
var sketch = Processing.instances[0];
var sketch = Processing.getInstanceById(getProcessingSketchID());
if ( sketch == undefined )
return setTimeout(tryFindSketch, 200); //retry later