diff --git a/javascript/examples/Environment/DocumentObjectModel/colorFinder/colorFinder.pde b/javascript/examples/Environment/DocumentObjectModel/colorFinder/colorFinder.pde index bf0a77107..09bc9498d 100644 --- a/javascript/examples/Environment/DocumentObjectModel/colorFinder/colorFinder.pde +++ b/javascript/examples/Environment/DocumentObjectModel/colorFinder/colorFinder.pde @@ -1,9 +1,6 @@ /** *

This example shows you how to manipulate the DOM of a - * HTML page that this sketch is placed in.

- * - *

Click and drag inside the sketch area to change the - * text color of the page

+ * HTML page from a sketch.

*/ color mColor = 255; @@ -16,6 +13,9 @@ void setup () void draw () { background( mColor ); + + textAlign(CENTER); fill(0); + text("<< click and drag here >>", width/2, height/2); } void mouseDragged () @@ -26,15 +26,16 @@ void mouseDragged () if ( js ) { + // call JavaScript function, see "jsinterface.js" js.setColor(red(mColor), green(mColor), blue(mColor)); } } /** * Define an interface that will act as glue between this sketch - * and "real" JavaScript running in the HTML page. The name does not matter. + * and "real" JavaScript running in the HTML page. * - * The interface must define any functions that one intends to call + * The interface must define all functions that you intend to call * from inside the sketch. */ interface JavaScriptInterface diff --git a/javascript/examples/Environment/DocumentObjectModel/colorFinder/jsinterface.js b/javascript/examples/Environment/DocumentObjectModel/colorFinder/jsinterface.js index b44711305..4803a894c 100644 --- a/javascript/examples/Environment/DocumentObjectModel/colorFinder/jsinterface.js +++ b/javascript/examples/Environment/DocumentObjectModel/colorFinder/jsinterface.js @@ -1,6 +1,6 @@ /** * This code will be embedded into the HTML page as "normal" - * JavaScript code with a