From cce150ac8c1e16fda42e618e55b4f5def422c4e6 Mon Sep 17 00:00:00 2001 From: francisli Date: Thu, 27 Jan 2005 06:48:42 +0000 Subject: [PATCH] Initial mobile website check in --- mobile/web/css/mobile.css | 178 ++++++++++++++++++ mobile/web/download/index.php | 19 ++ mobile/web/footer.inc.php | 8 + mobile/web/header.inc.php | 81 ++++++++ mobile/web/index.php | 17 ++ mobile/web/info.php | 3 + mobile/web/reference/API/Array.xml | 93 +++++++++ mobile/web/reference/API/Object.xml | 84 +++++++++ mobile/web/reference/API/String.xml | 108 +++++++++++ mobile/web/reference/API/String_charAt.xml | 48 +++++ mobile/web/reference/API/String_equals.xml | 51 +++++ mobile/web/reference/API/String_indexOf.xml | 54 ++++++ mobile/web/reference/API/String_length.xml | 48 +++++ mobile/web/reference/API/String_substring.xml | 55 ++++++ .../web/reference/API/String_toLowerCase.xml | 48 +++++ .../web/reference/API/String_toUpperCase.xml | 48 +++++ mobile/web/reference/API/abs.xml | 51 +++++ mobile/web/reference/API/addassign.xml | 59 ++++++ mobile/web/reference/API/addition.xml | 80 ++++++++ mobile/web/reference/API/append.xml | 53 ++++++ mobile/web/reference/API/arrayaccess.xml | 66 +++++++ mobile/web/reference/API/assign.xml | 58 ++++++ mobile/web/reference/API/background.xml | 96 ++++++++++ mobile/web/reference/API/beginShape.xml | 170 +++++++++++++++++ mobile/web/reference/API/bezier.xml | 101 ++++++++++ mobile/web/reference/API/bezierVertex.xml | 68 +++++++ mobile/web/reference/API/bitwiseAND.xml | 74 ++++++++ mobile/web/reference/API/bitwiseOR.xml | 71 +++++++ mobile/web/reference/API/blue.xml | 57 ++++++ mobile/web/reference/API/boolean.xml | 65 +++++++ mobile/web/reference/API/booleanconvert.xml | 60 ++++++ mobile/web/reference/API/break.xml | 60 ++++++ mobile/web/reference/API/brightness.xml | 58 ++++++ mobile/web/reference/API/byte.xml | 61 ++++++ mobile/web/reference/API/byteconvert.xml | 61 ++++++ mobile/web/reference/API/case.xml | 69 +++++++ mobile/web/reference/API/ceil.xml | 51 +++++ mobile/web/reference/API/char.xml | 58 ++++++ mobile/web/reference/API/charconvert.xml | 63 +++++++ mobile/web/reference/API/class.xml | 80 ++++++++ mobile/web/reference/API/color.xml | 78 ++++++++ mobile/web/reference/API/colorMode.xml | 91 +++++++++ mobile/web/reference/API/color_datatype.xml | 66 +++++++ mobile/web/reference/API/comma.xml | 57 ++++++ mobile/web/reference/API/comment.xml | 53 ++++++ mobile/web/reference/API/concat.xml | 51 +++++ mobile/web/reference/API/conditional.xml | 66 +++++++ mobile/web/reference/API/constrain.xml | 66 +++++++ mobile/web/reference/API/contract.xml | 55 ++++++ mobile/web/reference/API/curlybraces.xml | 66 +++++++ mobile/web/reference/API/curve.xml | 91 +++++++++ mobile/web/reference/API/curveVertex.xml | 71 +++++++ mobile/web/reference/API/day.xml | 73 +++++++ mobile/web/reference/API/decrement.xml | 54 ++++++ mobile/web/reference/API/default.xml | 64 +++++++ mobile/web/reference/API/delay.xml | 57 ++++++ mobile/web/reference/API/dist.xml | 80 ++++++++ mobile/web/reference/API/divide.xml | 57 ++++++ mobile/web/reference/API/dot.xml | 90 +++++++++ mobile/web/reference/API/draw.xml | 69 +++++++ mobile/web/reference/API/ellipse.xml | 65 +++++++ mobile/web/reference/API/ellipseMode.xml | 47 +++++ mobile/web/reference/API/else.xml | 88 +++++++++ mobile/web/reference/API/endShape.xml | 55 ++++++ mobile/web/reference/API/equality.xml | 63 +++++++ mobile/web/reference/API/expand.xml | 61 ++++++ mobile/web/reference/API/false.xml | 56 ++++++ mobile/web/reference/API/fill.xml | 90 +++++++++ mobile/web/reference/API/floor.xml | 51 +++++ mobile/web/reference/API/for.xml | 102 ++++++++++ mobile/web/reference/API/greaterthan.xml | 63 +++++++ .../reference/API/greaterthanorequalto.xml | 63 +++++++ mobile/web/reference/API/green.xml | 57 ++++++ mobile/web/reference/API/height.xml | 53 ++++++ mobile/web/reference/API/hour.xml | 62 ++++++ mobile/web/reference/API/hue.xml | 61 ++++++ mobile/web/reference/API/if.xml | 63 +++++++ mobile/web/reference/API/increment.xml | 54 ++++++ mobile/web/reference/API/inequality.xml | 64 +++++++ mobile/web/reference/API/int.xml | 60 ++++++ mobile/web/reference/API/intconvert.xml | 57 ++++++ mobile/web/reference/API/join.xml | 110 +++++++++++ mobile/web/reference/API/key.xml | 86 +++++++++ mobile/web/reference/API/keyPressed.xml | 72 +++++++ mobile/web/reference/API/keyPressed_var.xml | 68 +++++++ mobile/web/reference/API/keyReleased.xml | 72 +++++++ mobile/web/reference/API/leftshift.xml | 77 ++++++++ mobile/web/reference/API/lerp.xml | 86 +++++++++ mobile/web/reference/API/lessthan.xml | 63 +++++++ .../web/reference/API/lessthanorequalto.xml | 63 +++++++ mobile/web/reference/API/line.xml | 87 +++++++++ mobile/web/reference/API/loadBytes.xml | 68 +++++++ mobile/web/reference/API/loadStrings.xml | 56 ++++++ mobile/web/reference/API/log.xml | 54 ++++++ mobile/web/reference/API/logicalAND.xml | 64 +++++++ mobile/web/reference/API/logicalNOT.xml | 60 ++++++ mobile/web/reference/API/logicalOR.xml | 61 ++++++ mobile/web/reference/API/loop.xml | 73 +++++++ mobile/web/reference/API/max.xml | 63 +++++++ mobile/web/reference/API/millis.xml | 60 ++++++ mobile/web/reference/API/min.xml | 63 +++++++ mobile/web/reference/API/minus.xml | 69 +++++++ mobile/web/reference/API/minute.xml | 64 +++++++ mobile/web/reference/API/modulo.xml | 70 +++++++ mobile/web/reference/API/month.xml | 73 +++++++ mobile/web/reference/API/multilinecomment.xml | 58 ++++++ mobile/web/reference/API/multiply.xml | 57 ++++++ mobile/web/reference/API/new.xml | 70 +++++++ mobile/web/reference/API/nf.xml | 86 +++++++++ mobile/web/reference/API/nfp.xml | 82 ++++++++ mobile/web/reference/API/nfs.xml | 87 +++++++++ mobile/web/reference/API/noFill.xml | 44 +++++ mobile/web/reference/API/noLoop.xml | 73 +++++++ mobile/web/reference/API/noStroke.xml | 51 +++++ mobile/web/reference/API/parentheses.xml | 71 +++++++ mobile/web/reference/API/point.xml | 64 +++++++ mobile/web/reference/API/pow.xml | 58 ++++++ mobile/web/reference/API/print.xml | 70 +++++++ mobile/web/reference/API/println.xml | 72 +++++++ mobile/web/reference/API/quad.xml | 83 ++++++++ mobile/web/reference/API/random.xml | 71 +++++++ mobile/web/reference/API/randomSeed.xml | 58 ++++++ mobile/web/reference/API/rect.xml | 66 +++++++ mobile/web/reference/API/rectMode.xml | 54 ++++++ mobile/web/reference/API/red.xml | 60 ++++++ mobile/web/reference/API/redraw.xml | 61 ++++++ mobile/web/reference/API/return.xml | 90 +++++++++ mobile/web/reference/API/reverse.xml | 50 +++++ mobile/web/reference/API/rightshift.xml | 71 +++++++ mobile/web/reference/API/saturation.xml | 58 ++++++ mobile/web/reference/API/saveBytes.xml | 60 ++++++ mobile/web/reference/API/saveStrings.xml | 61 ++++++ mobile/web/reference/API/second.xml | 64 +++++++ mobile/web/reference/API/semicolon.xml | 52 +++++ mobile/web/reference/API/setup.xml | 64 +++++++ mobile/web/reference/API/shorten.xml | 52 +++++ mobile/web/reference/API/slice.xml | 64 +++++++ mobile/web/reference/API/sort.xml | 66 +++++++ mobile/web/reference/API/splice.xml | 71 +++++++ mobile/web/reference/API/split.xml | 72 +++++++ mobile/web/reference/API/sq.xml | 56 ++++++ mobile/web/reference/API/sqrt.xml | 57 ++++++ mobile/web/reference/API/strconvert.xml | 58 ++++++ mobile/web/reference/API/stroke.xml | 82 ++++++++ mobile/web/reference/API/subtractassign.xml | 52 +++++ mobile/web/reference/API/switch.xml | 118 ++++++++++++ mobile/web/reference/API/triangle.xml | 75 ++++++++ mobile/web/reference/API/trim.xml | 47 +++++ mobile/web/reference/API/true.xml | 56 ++++++ mobile/web/reference/API/vertex.xml | 101 ++++++++++ mobile/web/reference/API/void.xml | 61 ++++++ mobile/web/reference/API/while.xml | 61 ++++++ mobile/web/reference/API/width.xml | 54 ++++++ mobile/web/reference/API/year.xml | 74 ++++++++ mobile/web/reference/index.php | 113 +++++++++++ mobile/web/reference/reference.php | 127 +++++++++++++ mobile/web/settings.inc.php | 5 + 157 files changed, 10493 insertions(+) create mode 100644 mobile/web/css/mobile.css create mode 100644 mobile/web/download/index.php create mode 100644 mobile/web/footer.inc.php create mode 100644 mobile/web/header.inc.php create mode 100644 mobile/web/index.php create mode 100644 mobile/web/info.php create mode 100644 mobile/web/reference/API/Array.xml create mode 100644 mobile/web/reference/API/Object.xml create mode 100644 mobile/web/reference/API/String.xml create mode 100644 mobile/web/reference/API/String_charAt.xml create mode 100644 mobile/web/reference/API/String_equals.xml create mode 100644 mobile/web/reference/API/String_indexOf.xml create mode 100644 mobile/web/reference/API/String_length.xml create mode 100644 mobile/web/reference/API/String_substring.xml create mode 100644 mobile/web/reference/API/String_toLowerCase.xml create mode 100644 mobile/web/reference/API/String_toUpperCase.xml create mode 100644 mobile/web/reference/API/abs.xml create mode 100644 mobile/web/reference/API/addassign.xml create mode 100644 mobile/web/reference/API/addition.xml create mode 100644 mobile/web/reference/API/append.xml create mode 100644 mobile/web/reference/API/arrayaccess.xml create mode 100644 mobile/web/reference/API/assign.xml create mode 100644 mobile/web/reference/API/background.xml create mode 100644 mobile/web/reference/API/beginShape.xml create mode 100644 mobile/web/reference/API/bezier.xml create mode 100644 mobile/web/reference/API/bezierVertex.xml create mode 100644 mobile/web/reference/API/bitwiseAND.xml create mode 100644 mobile/web/reference/API/bitwiseOR.xml create mode 100644 mobile/web/reference/API/blue.xml create mode 100644 mobile/web/reference/API/boolean.xml create mode 100644 mobile/web/reference/API/booleanconvert.xml create mode 100644 mobile/web/reference/API/break.xml create mode 100644 mobile/web/reference/API/brightness.xml create mode 100644 mobile/web/reference/API/byte.xml create mode 100644 mobile/web/reference/API/byteconvert.xml create mode 100644 mobile/web/reference/API/case.xml create mode 100644 mobile/web/reference/API/ceil.xml create mode 100644 mobile/web/reference/API/char.xml create mode 100644 mobile/web/reference/API/charconvert.xml create mode 100644 mobile/web/reference/API/class.xml create mode 100644 mobile/web/reference/API/color.xml create mode 100644 mobile/web/reference/API/colorMode.xml create mode 100644 mobile/web/reference/API/color_datatype.xml create mode 100644 mobile/web/reference/API/comma.xml create mode 100644 mobile/web/reference/API/comment.xml create mode 100644 mobile/web/reference/API/concat.xml create mode 100644 mobile/web/reference/API/conditional.xml create mode 100644 mobile/web/reference/API/constrain.xml create mode 100644 mobile/web/reference/API/contract.xml create mode 100644 mobile/web/reference/API/curlybraces.xml create mode 100644 mobile/web/reference/API/curve.xml create mode 100644 mobile/web/reference/API/curveVertex.xml create mode 100644 mobile/web/reference/API/day.xml create mode 100644 mobile/web/reference/API/decrement.xml create mode 100644 mobile/web/reference/API/default.xml create mode 100644 mobile/web/reference/API/delay.xml create mode 100644 mobile/web/reference/API/dist.xml create mode 100644 mobile/web/reference/API/divide.xml create mode 100644 mobile/web/reference/API/dot.xml create mode 100644 mobile/web/reference/API/draw.xml create mode 100644 mobile/web/reference/API/ellipse.xml create mode 100644 mobile/web/reference/API/ellipseMode.xml create mode 100644 mobile/web/reference/API/else.xml create mode 100644 mobile/web/reference/API/endShape.xml create mode 100644 mobile/web/reference/API/equality.xml create mode 100644 mobile/web/reference/API/expand.xml create mode 100644 mobile/web/reference/API/false.xml create mode 100644 mobile/web/reference/API/fill.xml create mode 100644 mobile/web/reference/API/floor.xml create mode 100644 mobile/web/reference/API/for.xml create mode 100644 mobile/web/reference/API/greaterthan.xml create mode 100644 mobile/web/reference/API/greaterthanorequalto.xml create mode 100644 mobile/web/reference/API/green.xml create mode 100644 mobile/web/reference/API/height.xml create mode 100644 mobile/web/reference/API/hour.xml create mode 100644 mobile/web/reference/API/hue.xml create mode 100644 mobile/web/reference/API/if.xml create mode 100644 mobile/web/reference/API/increment.xml create mode 100644 mobile/web/reference/API/inequality.xml create mode 100644 mobile/web/reference/API/int.xml create mode 100644 mobile/web/reference/API/intconvert.xml create mode 100644 mobile/web/reference/API/join.xml create mode 100644 mobile/web/reference/API/key.xml create mode 100644 mobile/web/reference/API/keyPressed.xml create mode 100644 mobile/web/reference/API/keyPressed_var.xml create mode 100644 mobile/web/reference/API/keyReleased.xml create mode 100644 mobile/web/reference/API/leftshift.xml create mode 100644 mobile/web/reference/API/lerp.xml create mode 100644 mobile/web/reference/API/lessthan.xml create mode 100644 mobile/web/reference/API/lessthanorequalto.xml create mode 100644 mobile/web/reference/API/line.xml create mode 100644 mobile/web/reference/API/loadBytes.xml create mode 100644 mobile/web/reference/API/loadStrings.xml create mode 100644 mobile/web/reference/API/log.xml create mode 100644 mobile/web/reference/API/logicalAND.xml create mode 100644 mobile/web/reference/API/logicalNOT.xml create mode 100644 mobile/web/reference/API/logicalOR.xml create mode 100644 mobile/web/reference/API/loop.xml create mode 100644 mobile/web/reference/API/max.xml create mode 100644 mobile/web/reference/API/millis.xml create mode 100644 mobile/web/reference/API/min.xml create mode 100644 mobile/web/reference/API/minus.xml create mode 100644 mobile/web/reference/API/minute.xml create mode 100644 mobile/web/reference/API/modulo.xml create mode 100644 mobile/web/reference/API/month.xml create mode 100644 mobile/web/reference/API/multilinecomment.xml create mode 100644 mobile/web/reference/API/multiply.xml create mode 100644 mobile/web/reference/API/new.xml create mode 100644 mobile/web/reference/API/nf.xml create mode 100644 mobile/web/reference/API/nfp.xml create mode 100644 mobile/web/reference/API/nfs.xml create mode 100644 mobile/web/reference/API/noFill.xml create mode 100644 mobile/web/reference/API/noLoop.xml create mode 100644 mobile/web/reference/API/noStroke.xml create mode 100644 mobile/web/reference/API/parentheses.xml create mode 100644 mobile/web/reference/API/point.xml create mode 100644 mobile/web/reference/API/pow.xml create mode 100644 mobile/web/reference/API/print.xml create mode 100644 mobile/web/reference/API/println.xml create mode 100644 mobile/web/reference/API/quad.xml create mode 100644 mobile/web/reference/API/random.xml create mode 100644 mobile/web/reference/API/randomSeed.xml create mode 100644 mobile/web/reference/API/rect.xml create mode 100644 mobile/web/reference/API/rectMode.xml create mode 100644 mobile/web/reference/API/red.xml create mode 100644 mobile/web/reference/API/redraw.xml create mode 100644 mobile/web/reference/API/return.xml create mode 100644 mobile/web/reference/API/reverse.xml create mode 100644 mobile/web/reference/API/rightshift.xml create mode 100644 mobile/web/reference/API/saturation.xml create mode 100644 mobile/web/reference/API/saveBytes.xml create mode 100644 mobile/web/reference/API/saveStrings.xml create mode 100644 mobile/web/reference/API/second.xml create mode 100644 mobile/web/reference/API/semicolon.xml create mode 100644 mobile/web/reference/API/setup.xml create mode 100644 mobile/web/reference/API/shorten.xml create mode 100644 mobile/web/reference/API/slice.xml create mode 100644 mobile/web/reference/API/sort.xml create mode 100644 mobile/web/reference/API/splice.xml create mode 100644 mobile/web/reference/API/split.xml create mode 100644 mobile/web/reference/API/sq.xml create mode 100644 mobile/web/reference/API/sqrt.xml create mode 100644 mobile/web/reference/API/strconvert.xml create mode 100644 mobile/web/reference/API/stroke.xml create mode 100644 mobile/web/reference/API/subtractassign.xml create mode 100644 mobile/web/reference/API/switch.xml create mode 100644 mobile/web/reference/API/triangle.xml create mode 100644 mobile/web/reference/API/trim.xml create mode 100644 mobile/web/reference/API/true.xml create mode 100644 mobile/web/reference/API/vertex.xml create mode 100644 mobile/web/reference/API/void.xml create mode 100644 mobile/web/reference/API/while.xml create mode 100644 mobile/web/reference/API/width.xml create mode 100644 mobile/web/reference/API/year.xml create mode 100644 mobile/web/reference/index.php create mode 100644 mobile/web/reference/reference.php create mode 100644 mobile/web/settings.inc.php diff --git a/mobile/web/css/mobile.css b/mobile/web/css/mobile.css new file mode 100644 index 000000000..366d6c3bb --- /dev/null +++ b/mobile/web/css/mobile.css @@ -0,0 +1,178 @@ +body { + background: #fff; + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + font-weight: normal; + color: #553; + text-decoration: none; + margin-top: 0; + margin-left: 0; + margin-right: 0; + margin-bottom: 0; +} + +h3 { + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + font-size: 19px; + font-weight: normal; + font-decoration: none; + color: #996; + padding: 0px; + margin: 0px; +} + +h4 { + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + text-decoration: none; + color: #998; + padding: 0px; + margin: 0px; +} + +td { + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + color: #663 +} + +select { + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + background-color : #fff; + height: 15px; + width: 200px; + color: #663; + border: 1px #06c solid +} + +pre { + margin-top: 0px; +} + +a:link { + color: #d60; + font-size: 11px; + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + text-decoration: underlined; + background-color : transparent; +} + +a:visited { + color: #d60; + font-size: 11px; + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + text-decoration: underlined; + background-color : transparent; +} + +a:hover { + color: #bb3; + font-size: 11px; + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + text-decoration: underlined; + background-color : #000; +} + +a:active { + color: #d60; + font-size: 11px; + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + text-decoration: none; + background-color : transparent; +} + +.inputnav { + font-family: Geneva, Tahoma, Verdana, Arial, Helvetica, sans-serif; + font-size: 11px; + font-weight: normal; + color: #333333; +} + +.pad { + padding-right: 10px; +} + +.unlinked { + font-size: 11px; + color: #999966; + font-family: Geneva, Arial, Helvetica, sans-serif; +} + +.subtitle { + font-size: 11px; + font-style: italic; + color: #666633; +} + +.backslash { + color: #996600; +} + +.column { + float: left; + width: 250px; + margin: 0px; + padding: 0px; +} + +.column2x { + float: left; + width: 500px; + margin: 0px; + padding: 0px; +} + +.reffieldheader { + vertical-align: top; + width: 100px; + padding-right: 20px; + padding-bottom: 40px; +} + +.reffield { + vertical-align: top; + width: 560px; + padding-bottom: 40px; +} + +#head { + position: relative; + left: 0px; + width: 750px; + margin: 5px 50px 0px 50px; + padding: 0px 0px 0px 0px; +} + +#navigation { + position: relative; + left: 0px; + width: 750px; + margin: 0px 50px 0px 50px; + padding: 0px 0px 0px 0px; +} + +#backnavigation { + position: relative; + left: 0px; + width: 800px; + margin: 40px 50px 0px 0px; + padding: 0px 0px 0px 0px; +} + +#content { + position: relative; + left: 0px; + width: 750px; + margin: 40px 50px 0px 50px; + padding: 0px 0px 0px 0px; +} + +#footer { + position: relative; + clear: both; + left: 0px; + width: 750px; + margin: 0px 50px 20px 50px; + padding: 100px 0px 0px 0px; +} diff --git a/mobile/web/download/index.php b/mobile/web/download/index.php new file mode 100644 index 000000000..a6e1496ea --- /dev/null +++ b/mobile/web/download/index.php @@ -0,0 +1,19 @@ +> Download"; + +require '../header.inc.php'; +?> +

Processing Mobile pre-Alpha

+
    +
  1. Download and install the Wireless Toolkit (WTK) from Sun. The latest version is 2.1.

    +http://java.sun.com/products/j2mewtoolkit/
     
  2. +
  3. Download and install Processing Mobile.

    +0071 pre-ALPHA  |  17 10 2004  Windows Expert
     
  4. +
  5. Modify preferences.txt to include the following line, based on the installation location of the WTK:
    +
    +wtk.path=C:\WTK21
     
  6. +
+ + \ No newline at end of file diff --git a/mobile/web/footer.inc.php b/mobile/web/footer.inc.php new file mode 100644 index 000000000..660b746b8 --- /dev/null +++ b/mobile/web/footer.inc.php @@ -0,0 +1,8 @@ + + + + diff --git a/mobile/web/header.inc.php b/mobile/web/header.inc.php new file mode 100644 index 000000000..6736094fe --- /dev/null +++ b/mobile/web/header.inc.php @@ -0,0 +1,81 @@ + + + + + +<?php echo $PAGE_TITLE ?> + + + + + + + + +
+ + + + + +
+ + + + + + Index + +
+
+ +
diff --git a/mobile/web/index.php b/mobile/web/index.php new file mode 100644 index 000000000..bc5edb774 --- /dev/null +++ b/mobile/web/index.php @@ -0,0 +1,17 @@ + + +
+  +
+
+
+ Processing Mobile allows software written using the Processing programming + language and development environment to run on Java Powered mobile devices. +
+ \ No newline at end of file diff --git a/mobile/web/info.php b/mobile/web/info.php new file mode 100644 index 000000000..cf6086080 --- /dev/null +++ b/mobile/web/info.php @@ -0,0 +1,3 @@ + diff --git a/mobile/web/reference/API/Array.xml b/mobile/web/reference/API/Array.xml new file mode 100644 index 000000000..04f4a61b0 --- /dev/null +++ b/mobile/web/reference/API/Array.xml @@ -0,0 +1,93 @@ + + + +Array + +Data + +Composite + +Web & Application + + + + +int[] numbers = new int[3]; +numbers[0] = 90; +numbers[1] = 150; +numbers[2] = 30; +int a = numbers[0] + numbers[1]; // Sets variable a to 240 +int b = numbers[1] + numbers[2]; // Sets variable b to 180 + + + + + + +int[] numbers = { 90, 150, 30 }; +int a = numbers[0] + numbers[1]; // Sets variable a to 240 +int b = numbers[1] + numbers[2]; // Sets variable b to 180 + + + + + + +int degrees = 360; +float[] cos_vals = new float[degrees]; +for(int i=0; i < degrees; i++) { + cos_vals[i] = cos(TWO_PI/degrees * i); +} + + + + +An array is a list of data. It is possible to have an array of any type of data. Each piece of data in an array is identified by an index number representing its position in the array. The first element in the array is [0], the second element is [1], and so on. Arrays are similar to objects, so they must be created with the keyword new. Every array has a variable length which is an integer value for the total number of elements in the array. + + + +datatype[] var +var[element] = value +var.length + + + + +any primitive or compound datatype, including user defined classes + + + + +any valid variable name + + + + +int: must not exceed the length of the array - 1 + + + + +data to assign to the array element, must be the same datatype as the array + + + + + + +1.0 + +Object + +PDE + + + + + + + + + + + diff --git a/mobile/web/reference/API/Object.xml b/mobile/web/reference/API/Object.xml new file mode 100644 index 000000000..012b7ae6a --- /dev/null +++ b/mobile/web/reference/API/Object.xml @@ -0,0 +1,84 @@ + + +Object + +Data + +Composite + +Web & Application + + + + +// Declare and contruct two objects (h1, h2) from the class HLine +HLine h1 = new HLine(20, 2.0); +HLine h2 = new HLine(50, 2.5); + +void setup() +{ + size(200, 200); + framerate(30); +} + +void loop() { + background(204); + h1.update(); + h2.update(); +} + +class HLine { + float ypos, speed; + HLine (float y, float s) { + ypos = y; + speed = s; + } + void update() { + ypos += speed; + if (ypos > width) { + ypos = 0; + } + line(0, ypos, width, ypos); + } +} + + + + +Objects are instances of classes. A class is a grouping of related methods (functions) and fields (variables and constants). + + + +class instance + + + + +the class to created the object from + + + + +any variable name + + + + + +class + + +1.0 + +Object + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/String.xml b/mobile/web/reference/API/String.xml new file mode 100644 index 000000000..79187d305 --- /dev/null +++ b/mobile/web/reference/API/String.xml @@ -0,0 +1,108 @@ + + +String + +Data + +Composite + +Web & Application + + + + +String str1 = "CCCP"; +char data[] = {'C', 'C', 'C', 'P'}; +String str2 = new String(data); +println(str1); // Prints "CCCP" to the console +println(str2); // Prints "CCCP" to the console + + + + +A string is a sequence of characters. The class String includes methods for examining individual characters, comparing strings, searching strings, extracting parts of strings, and for converting an entire string uppercase and lowercase. Strings are always defined inside double quotes ("Abc") and characters are always defined inside single quotes('A').

There are more string methods than those linked from this page. Additional String documentation is located at http://java.sun.com/j2se/1.4.2/docs/api/ +
+ + + + + + + + + + + + + + +charAt() +Returns the character at the specified index + + +equals() +Compares a string to a specified object + + +indexOf() +Returns the index value of the first occurance of a character within the input string + + +length() +Returns the number of characters in the input string + + +substring() +Returns a new string that is part of the input string + + +toLowerCase() +Converts all the characters to lower case + + +toUpperCase() +Converts all the characters to upper case + + + +String(data) +String(data, offset, length) + + + +data +byte[] or char[]: array of bytes to be decoded into characters or array of characters to be combined into a string + + + +offset +int: index of the first character + + + +length +int: number of characters + + + + + + +char +text() + + +1.0 + +Object + +PDE + + + + + + + + +
diff --git a/mobile/web/reference/API/String_charAt.xml b/mobile/web/reference/API/String_charAt.xml new file mode 100644 index 000000000..18356c58b --- /dev/null +++ b/mobile/web/reference/API/String_charAt.xml @@ -0,0 +1,48 @@ + + + +charAt() + +String + +Method + +Web & Application + + + + +String str = "CCCP"; +char c1 = str.charAt(0); +char c2 = str.charAt(1); +char c3 = str.charAt(str.length()-1); +println(c1 + ":" + c2 + ":" + c3); // Prints 'C:C:P' + + + + +Returns the character at the specified index. An index ranges from 0 to the length of the string minus 1. The first character of the sequence is at index 0, the next at index 1, etc. + + + +charAt(index) + + + + +int: the index of the character + + +char + + + + +1.0 + +Method + +Core + + + diff --git a/mobile/web/reference/API/String_equals.xml b/mobile/web/reference/API/String_equals.xml new file mode 100644 index 000000000..a23abc970 --- /dev/null +++ b/mobile/web/reference/API/String_equals.xml @@ -0,0 +1,51 @@ + + + +equals() + +String + +Method + +Web & Application + + + + +String str1 = "CCCP"; +String str2 = "CCCP"; +// Tests to see if str1 is equal to str2 +if(str1.equals(str2) == true) { + println("Equal"); // They are equal so this line will print +} else { + println("Not equal"); +} + + + + +Compares two strings to see if they are the same. This method is necessary because it's not possible to compare strings using the equality operator (==). Returns true if the strings are the same and false if they are not. + + + +equals(str) + + + + +String: any valid String + + +Boolean + + + + +1.0 + +Method + +Core + + + diff --git a/mobile/web/reference/API/String_indexOf.xml b/mobile/web/reference/API/String_indexOf.xml new file mode 100644 index 000000000..2b58a69c5 --- /dev/null +++ b/mobile/web/reference/API/String_indexOf.xml @@ -0,0 +1,54 @@ + + + +indexOf() + +String + +Method + +Web & Application + + + + +String str = "CCCP"; +int p1 = str.indexOf("C"); +int p2 = str.indexOf("P"); +int p3 = str.indexOf("CP"); +println(p1 + ":" + p2 + ":" + p3); // Prints '0:3:2' + + + + +Tests to see if a substring is embedded in a string and returns the index position of the first occurance of the substring defined in the str parameter. If the str parameter is not found in the string, -1 is returned. + + + +indexOf(str) +indexOf(str, fromIndex) + + + + +String: the substring to search + + + + +int: the index from which to start the search + + +int + + + + +1.0 + +Method + +Core + + + diff --git a/mobile/web/reference/API/String_length.xml b/mobile/web/reference/API/String_length.xml new file mode 100644 index 000000000..a3470db76 --- /dev/null +++ b/mobile/web/reference/API/String_length.xml @@ -0,0 +1,48 @@ + + + +length() + +String + +Method + +Web & Application + + + + +String str1 = "CCCP"; +String str2 = "Rabbit"; +int l1 = str1.length(); +int l2 = str2.length(); +println(l1 + ":" + l2); // Prints '4:6' + + + + +Returns the total number of characters included in the string as an integer number.
Note: You find the size of an array with the length field which works a little differently from String's length() method. +
+ + +charAt() + + + + + + + +int + + + + +1.0 + +Method + +Core + + +
diff --git a/mobile/web/reference/API/String_substring.xml b/mobile/web/reference/API/String_substring.xml new file mode 100644 index 000000000..ab9b6b3d8 --- /dev/null +++ b/mobile/web/reference/API/String_substring.xml @@ -0,0 +1,55 @@ + + + +substring() + +String + +Method + +Web & Application + + + + +String str1 = "CCCP"; +String str2 = "Rabbit"; +String ss1 = str1.substring(2); // Returns "CP" +String ss2 = str2.substring(3); // Returns "bit" +String ss3 = str1.substring(0, 2); // Returns "CC" +println(ss1 + ":" + ss2 + ":" + ss3); // Prints 'CP:bit:CC' + + + + +Returns a new string that is a part of the original string. When using the endIndex parameter, the string between beginIndex and endIndex-1 is returned. + + + +substring(beginIndex) +substring(beginIndex, endIndex) + + + + +int: position from which to begin (inclusive) + + + + +int: position from which to end (exclusive) + + +None + + + + +1.0 + +Method + +Core + + + diff --git a/mobile/web/reference/API/String_toLowerCase.xml b/mobile/web/reference/API/String_toLowerCase.xml new file mode 100644 index 000000000..1f15f36a7 --- /dev/null +++ b/mobile/web/reference/API/String_toLowerCase.xml @@ -0,0 +1,48 @@ + + + +toLowerCase() + +String + +Method + +Web & Application + + + + +String str1 = "CCCP"; +String str2 = "Rabbit"; +str1 = str1.toLowerCase(); +str2 = str2.toLowerCase(); +println(str1 + ":" + str2); // Prints cccp:rabbit + + + + +Converts all of the characters in the string to lowercase. For example, "ABC" will convert to "abc". + + + +toLowerCase() + + + + + + + +String + + + + +1.0 + +Method + +Core + + + diff --git a/mobile/web/reference/API/String_toUpperCase.xml b/mobile/web/reference/API/String_toUpperCase.xml new file mode 100644 index 000000000..b242b6773 --- /dev/null +++ b/mobile/web/reference/API/String_toUpperCase.xml @@ -0,0 +1,48 @@ + + + +toUpperCase() + +String + +Method + +Web & Application + + + + +String str1 = "Cccp"; +String str2 = "Rabbit"; +str1 = str1.toUpperCase(); +str2 = str2.toUpperCase(); +println(str1 + ":" + str2); // Prints CCCP:RABBIT + + + + +Converts all of the characters in the string to uppercase. For example, "abc" will convert to "ABC". + + + +charAt() + + + + +int: X coordinate of the pixel in source image + + +String + + + + +1.0 + +Method + +Core + + + diff --git a/mobile/web/reference/API/abs.xml b/mobile/web/reference/API/abs.xml new file mode 100644 index 000000000..5dc8fdf9a --- /dev/null +++ b/mobile/web/reference/API/abs.xml @@ -0,0 +1,51 @@ + + +abs() + +Math + +Calcuation + +Web & Application + + + + +int a = abs(153); // Sets a to 153 +int b = abs(-15); // Sets b to 15 +float c = abs(12.234); // Sets c to 12.234 +float d = abs(-9.23); // Sets d to 9.23 + + + + +Calculates the absolute value (magnitude) of a number. The absolute value of a number is always positive. + + + +abs(value) + + + + +float or int + + +float or int (depending on the input values) + + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/addassign.xml b/mobile/web/reference/API/addassign.xml new file mode 100644 index 000000000..f2ddf6ded --- /dev/null +++ b/mobile/web/reference/API/addassign.xml @@ -0,0 +1,59 @@ + + ++= (add assign) + +Math + +Operators + +Web & Application + + + + +int a = 50; +int b = 23; +a += b; // sets "a" to 73 + + + + +Combines addition with assignment. The expression a += b is equivalent to a = a + b. + + + +value1 += value2 + + + + +int or float + + + + +any numberical value the same datatype as value1 + + + + + += (assign) ++ (add) +-= (subtract assign) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/addition.xml b/mobile/web/reference/API/addition.xml new file mode 100644 index 000000000..efad64445 --- /dev/null +++ b/mobile/web/reference/API/addition.xml @@ -0,0 +1,80 @@ + + ++ (addition) + +Math + +Operators + +Web & Application + + + + +int a = 50 + 5; // Sets a to 55 +int b = a + 5; // Sets b to 60 + + + + + + +String s1 = "Chernenko"; +String s2 = "Brezhnev"; +String sc1 = s1 + s2; +String sc2 = s1 + ", Andropov, " + s2; +println(sc1); // Prints ChernenkoBrezhnev +println(sc2); // Prints Chernenko, Andropov, Brezhnev + + + + + + +String s1 = "Gorbachev"; +int i = 1987; +String sc1 = s1 + i; +println(sc1); // Prints Gorbachev1987 + + + + +Adds two values or concatenates string values. As a mathematical operator, it calculates the sum of two values. As a string operator, it combines two strings into one and converts from primitive datatypes into the String datatype if necessary. + + + +value1 + value2 + + + + +String, int, float, char, byte, boolean + + + + +String, int, float, char, byte, boolean + + + + + +++ (increment) ++= (add assign) +- (minus) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/append.xml b/mobile/web/reference/API/append.xml new file mode 100644 index 000000000..332be40f2 --- /dev/null +++ b/mobile/web/reference/API/append.xml @@ -0,0 +1,53 @@ + + +append() + +Data + +Array Functions + +Web & Application + + + + +String sa1[] = { "OH ", "NY ", "CA "}; +String sa2[] = append(sa1, "MA "); +print(sa2); // Prints "OH NY CA MA" + + + + +Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array. + + + +append(array, element) + + + + +boolean[], byte[], char[], int[], float[], or String[] + + + + +new data for the array + + +Array (the same datatype as the input) + + +shorten() +expand() + + +1.0 + +Function + +Core + +Extended + + diff --git a/mobile/web/reference/API/arrayaccess.xml b/mobile/web/reference/API/arrayaccess.xml new file mode 100644 index 000000000..97020e739 --- /dev/null +++ b/mobile/web/reference/API/arrayaccess.xml @@ -0,0 +1,66 @@ + + +[] (array access) + +Structure + + + +Web & Application + + + + +int[] numbers = new int[3]; +numbers[0] = 90; +numbers[1] = 150; +numbers[2] = 30; +int a = numbers[0] + numbers[1]; // Sets variable a to 240 +int b = numbers[1] + numbers[2]; // Sets variable b to 180 + + + + +The array access operator is used to specify a location within an array. The data at this location can be defined with the syntax array[element] = value or read with the syntax value = array[element]. + + + +datatype[] +array[element] + + + + +any primitive or compound datatype, including user defined classes + + + + +any valid variable name + + + + +int: must not exceed the length of the array - 1 + + + + + +Array + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/assign.xml b/mobile/web/reference/API/assign.xml new file mode 100644 index 000000000..c2115db79 --- /dev/null +++ b/mobile/web/reference/API/assign.xml @@ -0,0 +1,58 @@ + + += (assign) + +Structure + + + +Web & Application + + + + +int a; +a = 30; // Assigns for value 30 to the variable "a" +a = a + 40; // Assigns the value 70 to the variable "a" + + + + +Assigns a value to a variable. The "=" sign does not mean "equals", but is used to place data within a variable. The "=" operator is formally called the assignment operator. There are many different types of variables (int, floats, strings, etc.) and the assignment operator can only assign values which are the same type as the variable it is assigning. For example, if the variable is of type int, the value must also be an int. + + + +var = value + + + + +any valid variable name + + + + +any value of the same type as the variable. For example, if the variable is of type "int", the value must also be an int + + + + + ++= (add assign) +-= (subtract assign) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/background.xml b/mobile/web/reference/API/background.xml new file mode 100644 index 000000000..ce46505e9 --- /dev/null +++ b/mobile/web/reference/API/background.xml @@ -0,0 +1,96 @@ + + +background() + +Color + +Setting + +Web & Application + + +background_.gif + +background(51); + + + + +background_2.gif + +background(255, 204, 0); + + + + +background_4.jar + +void loop() { + background(255, 204, 0); + line(0, 0, mouseX, mouseY); + line(100, 0, mouseX, mouseY); + line(100, 100, mouseX, mouseY); + line(0, 100, mouseX, mouseY); +} + + + + +background_3.jpg + +PImage b; +b = loadImage("laDefense.jpg"); +background(b); + + + + +The background() function sets the color used for the background of the Processing window. The default background is light gray. In the loop() function, the background color is used to refresh the display window between frames. It is possible to load a JPG or GIF image as the background by loading an image which is the same size as the display window. The image must be in the data directory of the sketch for it to load properly. + + + +background(value1) +background(value1, value2, value3) +background(image) + + + + +int or float: red or hue value (depending on the current color mode) + + + + +int or float: green or saturation value (depending on the current color mode) + + + + +int or float: blue or brightness value (depending on the current color mode) + + + + +PImage: the name of a PImage the same size as the display window + + +None + + +colorMode() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/beginShape.xml b/mobile/web/reference/API/beginShape.xml new file mode 100644 index 000000000..2f5a0c57d --- /dev/null +++ b/mobile/web/reference/API/beginShape.xml @@ -0,0 +1,170 @@ + + +beginShape() + +Shape + +Vertex + +Web & Application + + +beginShape_.gif + +beginShape(POINTS); +vertex(30, 20); +vertex(85, 20); +vertex(85, 75); +vertex(30, 75); +endShape(); + + + + +beginShape_2.gif + +beginShape(LINES); +vertex(30, 20); +vertex(85, 20); +vertex(85, 75); +vertex(30, 75); +endShape(); + + + + +beginShape_3.gif + +beginShape(LINE_STRIP); +vertex(30, 20); +vertex(85, 20); +vertex(85, 75); +vertex(30, 75); +endShape(); + + + + +beginShape_4.gif + +beginShape(LINE_LOOP); +vertex(30, 20); +vertex(85, 20); +vertex(85, 75); +vertex(30, 75); +endShape(); + + + + +beginShape_5.gif + +beginShape(TRIANGLES); +vertex(30, 75); +vertex(40, 20); +vertex(50, 75); +vertex(60, 20); +vertex(70, 75); +vertex(80, 20); +vertex(90, 75); +endShape(); + + + + +beginShape_6.gif + +beginShape(TRIANGLE_STRIP); +vertex(30, 75); +vertex(40, 20); +vertex(50, 75); +vertex(60, 20); +vertex(70, 75); +vertex(80, 20); +vertex(90, 75); +endShape(); + + + + +beginShape_7.gif + +beginShape(QUADS); +vertex(30, 20); +vertex(30, 75); +vertex(50, 75); +vertex(50, 20); +vertex(65, 20); +vertex(65, 75); +vertex(85, 75); +vertex(85, 20); +endShape(); + + + + +beginShape_8.gif + +beginShape(QUAD_STRIP); +vertex(30, 20); +vertex(30, 75); +vertex(50, 75); +vertex(50, 20); +vertex(65, 20); +vertex(65, 75); +vertex(85, 75); +vertex(85, 20); +endShape(); + + + + +beginShape_9.gif + +beginShape(POLYGON); +vertex(20, 20); +vertex(40, 20); +vertex(40, 40); +vertex(60, 40); +vertex(60, 60); +vertex(20, 60); +endShape(); + + + + +Using the beginShape() and endShape() functions allow creating more complex forms. beginShape() begins recording vertices for a shape and endShape() stops recording. The beginShape() function requires a parameter to tell it which type of shape to create from the provided vertices. The parameters available for beginShape() are LINES, LINE_STRIP, LINE_LOOP, TRIANGLES, TRIANGLE_STRIP, QUADS, QUAD_STRIP, and POLYGON. After calling the beginShape() function, a series of vertex() commands must follow. To stop drawing the shape, call endShape(). The vertex() function with two parameters specifies a position in 2D and the vertex() function with three parameters specifies a position in 3D. Each shape will be outlined with the current stroke color and filled with the fill color. Transformations such as translate(), rotate(), and scale() do not work within beginShape(). + + + +beginShape(MODE) + + + + +Either LINES, LINE_STRIP, LINE_LOOP, TRIANGLES, TRIANGLE_STRIP, QUADS, QUAD_STRIP, POLYGON + + +None + + +endShape() +vertex() +curveVertex() +bezierVertex() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/bezier.xml b/mobile/web/reference/API/bezier.xml new file mode 100644 index 000000000..5bec877b9 --- /dev/null +++ b/mobile/web/reference/API/bezier.xml @@ -0,0 +1,101 @@ + + +bezier() + +Shape + +Curves + +Web & Application + + +bezier_.gif + +stroke(255, 102, 0); +line(85, 20, 10, 10); +line(90, 90, 15, 80); +stroke(0, 0, 0); +bezier(85, 20, 10, 10, 90, 90, 15, 80); + + + + +bezier_2.gif + +stroke(255, 102, 0); +line(30, 20, 80, 5); +line(80, 75, 30, 75); +stroke(0, 0, 0); +bezier(30, 20, 80, 5, 80, 75, 30, 75); + + + + +Draws a Bezier curve on the screen. These curves are defined by a series of anchor and control points. The first two parameters specify the first anchor point and the last two parameters specify the other anchor point. The middle parameters specify the control points which define the shape of the curve. Bezier curves were developed by French engineer Pierre Bezier. + + + +bezier(x1, y1, x2, y2, x3, y3, x4, y4); + + + + +int or float: x-coordinate of the first anchor point + + + + +int or float: y-coordinate of the first anchor point + + + + +int or float: x-coordinate of the first control point + + + + +int or float: y-coordinate of the first control point + + + + +int or float: x-coordinate of the second control point + + + + +int or float: y-coordinate of the second control point + + + + +int or float: x-coordinate of the second anchor point + + + + +int or float: y-coordinate of the second anchor point + + +None + + +bezierVertex() +curve() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/bezierVertex.xml b/mobile/web/reference/API/bezierVertex.xml new file mode 100644 index 000000000..35330682e --- /dev/null +++ b/mobile/web/reference/API/bezierVertex.xml @@ -0,0 +1,68 @@ + + +bezierVertex() + +Shape + +Vertex + +Web & Application + + +bezierVertex_.gif + +beginShape(LINE_STRIP); +bezierVertex(30, 20); +bezierVertex(80, 0); +bezierVertex(80, 75); +bezierVertex(30, 75); +endShape(); + + + + +Specifies vertex coordinates for Bezier curves. This function must be used between beginShape() and endShape(). These curves are defined by a series of anchor and control points. Bezier curves were developed by French engineer Pierre Bezier. + + + +bezierVertex(x, y) +bezierVertex(x, y, z) + + + + +The x-coordinate of the vertex, either a float or int + + + + +The y-coordinate of the vertex, either a float or int + + + + +The z-coordinate of the vertex, either a float or int + + + + + +curveVertex() +vertex() +bezier() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/bitwiseAND.xml b/mobile/web/reference/API/bitwiseAND.xml new file mode 100644 index 000000000..995a7e3e1 --- /dev/null +++ b/mobile/web/reference/API/bitwiseAND.xml @@ -0,0 +1,74 @@ + + +& (bitwise AND) + +Math + +Bitwise Operators + +Web & Application + + + + + +int a = 207; // In binary: 11001111 +int b = 61; // In binary: 00111101 +int c = a & b; // In binary: 00001101 +println(c); // Prints "13", the decimal equivalent to 00001101 + + + + + + +color argb = color(204, 204, 51, 255); +// The sytax "& 0xFF" compares the binary +// representation of the two values and +// makes all but the last 8 bits into a 0. +// "0xFF" is 00000000000000000000000011111111 +int a = argb >> 24 & 0xFF; +int r = argb >> 16 & 0xFF; +int g = argb >> 8 & 0xFF; +int b = argb & 0xFF; +fill(r, g, b, a); +rect(30, 20, 55, 55); + + + + +Compares each corresponding bit in the binary representation of the values. For each comparison two 1's yeild 1, 1 and 0 yeild 0, and two 0's yeild 0. This is easy to see when we look at the binary representation of numbers

  11010110  // 214
& 01011100 // 92
--------
01010100 // 84

To see the binary representation of a number, use the binary() function with println(). +
+ + +value & value2 + + + + +int, char, byte + + + + +int, char, byte + + + + + + +| (bitwise OR) +binary() + + +1.0 + +Operator + +PDE + +Extended + + +
diff --git a/mobile/web/reference/API/bitwiseOR.xml b/mobile/web/reference/API/bitwiseOR.xml new file mode 100644 index 000000000..0114a5bf4 --- /dev/null +++ b/mobile/web/reference/API/bitwiseOR.xml @@ -0,0 +1,71 @@ + + +| (bitwise OR) + +Math + +Bitwise Operators + +Web & Application + + + + + +int a = 205; // In binary: 11001101 +int b = 45; // In binary: 00101101 +int c = a | b; // In binary: 11101101 +println(c); // Prints "237", the decimal equivalent to 11101101 + + + + + + +int a = 255 << 24; // Binary: 11111111000000000000000000000000 +int r = 204 << 16; // Binary: 00000000110011000000000000000000 +int g = 204 << 8; // Binary 00000000000000001100110000000000 +int b = 51; // Binary: 00000000000000000000000000110011 +// OR the values together: 11111111110011001100110000110011 +color argb = a | r | g | b; +fill(argb); +rect(30, 20, 55, 55); + + + + +Compares each corresponding bit in the binary representation of the values. For each comparison two 1's yeild 1, 1 and 0 yeild 1, and two 0's yeild 0. This is easy to see when we look at the binary representation of numbers

  11010110  // 214
& 01011100 // 92
--------
11011110 // 222

To see the binary representation of a number, use the binary() function with println(). +
+ + +value | value2 + + + + +int, char, byte + + + + +int, char, byte + + + + + + +& (bitwise AND) +binary() + + +1.0 + +Operator + +PDE + +Extended + + +
diff --git a/mobile/web/reference/API/blue.xml b/mobile/web/reference/API/blue.xml new file mode 100644 index 000000000..0d5615910 --- /dev/null +++ b/mobile/web/reference/API/blue.xml @@ -0,0 +1,57 @@ + + +blue() + +Color + +Creating & Reading + +Web & Application + + +blue_.gif + +noStroke(); +color c = color(0, 126, 255); +fill(c); +rect(15, 20, 35, 60); +float value = blue(c); // Sets "value" to "255" +fill(value); +rect(50, 20, 35, 60); + + + + +Extracts the blue element from a color. + + + +blue(color) + + + + +any value of the color datatype + + +float + + +red() +green() +hue() +saturation() +brightness() + + +1.0 + +Function + +Core + + + + + + diff --git a/mobile/web/reference/API/boolean.xml b/mobile/web/reference/API/boolean.xml new file mode 100644 index 000000000..485f3e705 --- /dev/null +++ b/mobile/web/reference/API/boolean.xml @@ -0,0 +1,65 @@ + + +boolean + +Data + +Primitive + +Web & Application + + +boolean.gif + +boolean a = false; +if (!a) { + rect(30, 20, 50, 50); +} +a = true; +if (a) { + line(20, 10, 90, 80); + line(20, 80, 90, 10); +} + + + + +Datatype for the Boolean values true and false. It is common to use booleanvalues with control statements to determine the flow of a program. The first time a variable is written, it must be declared with a statement expressing its datatype. + + + +boolean var +boolean var = booleanvalue + + + + +variable name referencing the value + + + + +true or false + + + + + +true +false + + +1.0 + +Datatype + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/booleanconvert.xml b/mobile/web/reference/API/booleanconvert.xml new file mode 100644 index 000000000..06fa751f7 --- /dev/null +++ b/mobile/web/reference/API/booleanconvert.xml @@ -0,0 +1,60 @@ + + +boolean() + +Data + +Conversion + +Web & Application + + + + +float f = 0.0; +boolean b = boolean(f); +println(f + " : " + b); // Prints "0.0 : false" + +int i = 1; +b = boolean(i); +println(i + " : " + b); // Prints "1 : true" + +i = 3445; +b = boolean(i); +println(i + " : " + b); // Prints "3445 : true" + + + + +Converts a primitive datatype, string, or array to its boolean representation. The number 0 evaluates to false and all other numbers evaluate to true. + + + +boolean(val) + + + + +int, float, char, byte, String, int[], float[], char[], byte[], String[] + + +byte + + +boolean + + +1.0 + +Function + +IDE + + + + + + + + + diff --git a/mobile/web/reference/API/break.xml b/mobile/web/reference/API/break.xml new file mode 100644 index 000000000..7fa402af8 --- /dev/null +++ b/mobile/web/reference/API/break.xml @@ -0,0 +1,60 @@ + + +break + +Control + +Conditionals + +Web & Application + + + + +char letter = 'B'; + +switch(letter) { + case 'A': + println("Alpha"); // Does not execute + break; + case 'B': + println("Bravo"); // Prints "Bravo" + break; + default: + println("Zulu"); // Does not execute + break; +} + + + + +Ends the execution of a structure such as switch(), for(), or while() and jumps to the next statement after. + + + +break + + + + + + + + + + +switch() +for() +while() + + +1.0 + +Keyword + +Java + +extended + + + diff --git a/mobile/web/reference/API/brightness.xml b/mobile/web/reference/API/brightness.xml new file mode 100644 index 000000000..e22301472 --- /dev/null +++ b/mobile/web/reference/API/brightness.xml @@ -0,0 +1,58 @@ + + +brightness() + +Color + +Creating & Reading + +Web & Application + + +brightness_.gif + +noStroke(); +colorMode(HSB, 255); +color c = color(0, 126, 255); +fill(c); +rect(15, 20, 35, 60); +float value = brightness(c); // Sets "value" to "255" +fill(value); +rect(50, 20, 35, 60); + + + + +Extracts the brightness value from a color. + + + +brightness(color) + + + + +any value of the color datatype + + +float + + +red() +green() +blue() +hue() +saturation() + + +1.0 + +Function + +Core + +Extended + + + + diff --git a/mobile/web/reference/API/byte.xml b/mobile/web/reference/API/byte.xml new file mode 100644 index 000000000..4cc7953e7 --- /dev/null +++ b/mobile/web/reference/API/byte.xml @@ -0,0 +1,61 @@ + + +byte + +Data + +Primitive + +Web & Application + + + + +byte a; // Declare variable "a" of type byte +a = 23; // Assign "a" the value 23 +byte b = -128; // Declare variable "b" and assign it the value -128 +byte c = a + b; // Declare variable "c" and assign it the sum of "a" and "b" + + + + +Datatype for bytes, 8 bits of information storing numerical values from 127 to -128. Bytes are a convenient datatype for sending information to and from the serial port and for representing letters in a simpler format than the char datatype. The first time a variable is written, it must be declared with a statement expressing its datatype. Subsequent uses of this variable must not reference the datatype because Processing will think the variable is being declared again. + + + +byte var +byte var = value + + + + +variable name referencing the value + + + + +a number between 127 to -128 + + + + + +int +float +boolean + + +1.0 + +Datatype + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/byteconvert.xml b/mobile/web/reference/API/byteconvert.xml new file mode 100644 index 000000000..37550166e --- /dev/null +++ b/mobile/web/reference/API/byteconvert.xml @@ -0,0 +1,61 @@ + + +byte() + +Data + +Conversion + +Web & Application + + + + +float f = 65.0; +byte b = byte(f); +println(f + " : " + b); // Prints "65.0 : 65" + +char c = 'E'; +b = byte(c); +println(c + " : " + b); // Prints "E : 69" + +f = 130.0; +b = byte(f); +println(f + " : " + b); // Prints "130.0 : -126" + + + + +Converts a primitive datatype, string, or array to its byte representation. A byte can only be a whole number between -128 and 127, therefore when a number outside this range is converted, its value wraps to the corresponding byte representation. + + + +byte(val) + + + + +int, float, char, boolean, String, int[], float[], char[], boolean[], String[] + + +byte + + +byte +int() + + +1.0 + +Function + +IDE + + + + + + + + + diff --git a/mobile/web/reference/API/case.xml b/mobile/web/reference/API/case.xml new file mode 100644 index 000000000..6709f47e0 --- /dev/null +++ b/mobile/web/reference/API/case.xml @@ -0,0 +1,69 @@ + + +case + +Control + +Conditionals + +Web & Application + + + + +char letter = 'B'; + +switch(letter) { + case 'A': + println("Alpha"); // Does not execute + break; + case 'B': + println("Bravo"); // Prints "Bravo" + break; + default: + println("Zulu"); // Does not execute + break; +} + + + + +Denotes the different labels to be evaluated with the parameter in the switch() structure. + + + +case label: statements + + + + +byte, char, or int + + + + +one or more valid statements + + + + + +switch() +default +break + + +1.0 + +Keyword + +Java + + +extended + + + + + + diff --git a/mobile/web/reference/API/ceil.xml b/mobile/web/reference/API/ceil.xml new file mode 100644 index 000000000..b8f21fb72 --- /dev/null +++ b/mobile/web/reference/API/ceil.xml @@ -0,0 +1,51 @@ + + +ceil() + +Math + +Calculation + +Web & Application + + + + +float x = 8.22; +float a = ceil(x); // Set "a" to 9.0 + + + + +Calculates the closest value that is greater than or equal to the value of the parameter. For example, ceil(9.03) returns the value 10.0. + + + +ceil(value) + + + + +float + + +float + + +floor() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/char.xml b/mobile/web/reference/API/char.xml new file mode 100644 index 000000000..0bf819c1a --- /dev/null +++ b/mobile/web/reference/API/char.xml @@ -0,0 +1,58 @@ + + +char + +Data + +Primitive + +Web & Application + + + + +char m; // Declare variable "m" of type char +m = 'A'; // Assign "m" the value "A" +int n = '&'; // Declare variable "n" and assign it the value "&" + + + + +Datatype for characters, typographic symbols such as A, d, and $. A char stores letters and symbols in the Unicode format, a coding system developed to support a variety of world languages. Each char is two bytes (16 bits) in length and is distinguished by surrounding it with single quotes. Character escapes may also stored as a char. For example, the representation for the "delete" key is '\377'. The first time a variable is written, it must be declared with a statement expressing its datatype. Subsequent uses of this variable must not reference the datatype because Processing will think the variable is being declared again. + + + +char var +char var = value + + + + +variable name referencing the value + + + + +any character + + + + + +String + + +1.0 + +Datatype + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/charconvert.xml b/mobile/web/reference/API/charconvert.xml new file mode 100644 index 000000000..42c56a879 --- /dev/null +++ b/mobile/web/reference/API/charconvert.xml @@ -0,0 +1,63 @@ + + +char() + +Data + +Conversion + +Web & Application + + + + +int i = 65; +char c = char(i); +println(i + " : " + c); // Prints "65 : A" + +float f = 72.4; +c = char(f); +println(f + " : " + c); // Prints "72.4 : H" + +boolean b = true; +c = char(b); +println(b + " : " + c); // Prints "true : t" + + + + +Converts a primitive datatype, string, or array to a numeric character representation. + + + +char(val) + + + + +int, float, byte, boolean, String, int[], float[], byte[], boolean[], String[] + + +char + + +char +int() +float() +byte() + + +1.0 + +Function + +IDE + + + + + + + + + diff --git a/mobile/web/reference/API/class.xml b/mobile/web/reference/API/class.xml new file mode 100644 index 000000000..e26bb8a06 --- /dev/null +++ b/mobile/web/reference/API/class.xml @@ -0,0 +1,80 @@ + + +class + +Structure + + + +Web & Application + + + + +// Declare and contruct two objects (h1, h2) from the class HLine +HLine h1 = new HLine(20, 2.0); +HLine h2 = new HLine(50, 2.5); + +void setup() +{ + size(200, 200); + framerate(30); +} + +void loop() { + background(204); + h1.update(); + h2.update(); +} + +class HLine { + float ypos, speed; + HLine (float y, float s) { + ypos = y; + speed = s; + } + void update() { + ypos += speed; + if (ypos > width) { + ypos = 0; + } + line(0, ypos, width, ypos); + } +} + + + + +Keyword used to indicate the declaration of a class. A class is a composite of data and methods (functions) which may be instantiated as objects. The first letter of a class name is usually uppercase to separate it from other kinds of variables. A related tutorial on Object-Oriented Programming is hosted from the Sun website. + + + +class ClassName { + statements +} + + + + +Any valid variable name + + + + +any valid statements + + + + + +Object + + +1.0 + +Keyword + +PDE + + + diff --git a/mobile/web/reference/API/color.xml b/mobile/web/reference/API/color.xml new file mode 100644 index 000000000..19fa9419d --- /dev/null +++ b/mobile/web/reference/API/color.xml @@ -0,0 +1,78 @@ + + +color() + +Color + +Creating & Reading + +Web & Application + + +color_.gif + +color c1 = color(102, 102, 0); +fill(c1); +noStroke(); +rect(30, 20, 55, 55); + + + + +Creates colors which may be stored in variables of the color datatype. The parameters are interpreted as RGB or HSB values depending on the current colorMode(). The default mode is RGB values from 0 to 255 and therefore, the function call color(255, 204, 0) will return a bright yellow color. The color() function packs the information input through its parameters into a 32 bit number in the following order AAAAAAAARRRRRRRRGGGGGGGGBBBBBBBB where R is the red/hue value, G is green/saturation, and B is blue/brightness. + + + +color(gray) +color(gray, alpha) +color(value1, value2, value3) +color(value1, value2, value3, alpha) + + + + +int or float: number specifying value between white and black + + + + +int or float: relative to current color range + + + + +int or float: red or hue values relative to the current color range + + + + +int or float: green or saturation values relative to the current color range + + + + +int or float: blue or brightness values relative to the current color range + + + +color + + +color +colorMode() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/colorMode.xml b/mobile/web/reference/API/colorMode.xml new file mode 100644 index 000000000..646a8fe03 --- /dev/null +++ b/mobile/web/reference/API/colorMode.xml @@ -0,0 +1,91 @@ + + +colorMode() + +Color + +Setting + +Web & Application + + +colorMode_.jpg + +noStroke(); +colorMode(RGB, 100); +for(int i=0; i<100; i++) { + for(int j=0; j<100; j++) { + stroke(i, j, 0); + point(i, j); + } +} + + + + +colorMode_2.jpg + +noStroke(); +colorMode(HSB, 100); +for(int i=0; i<100; i++) { + for(int j=0; j<100; j++) { + stroke(i, j, 100); + point(i, j); + } +} + + + + +Changes the way Processing interprets color data. By default, fill(), stroke(), and background() colors are set by values between 0 and 255 using the RGB color model. It is possible to change the numerical range used for specifying colors and to switch color systems. For example, calling colorMode(RGB, 1.0) will specify that values are specified between 0 and 1. The limits for defining colors are altered by setting the parameters range1, range2, and range 3. + + + +colorMode(mode); +colorMode(mode, range); +colorMode(mode, range1, range2, range3); + + + + +Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness + + + + +int or float: range for all color elements + + + + +int or float: range for the red or hue depending on the current color mode + + + + +int or float: range for the green or saturation depending on the current color mode + + + + +int or float: range for the blue or brightness depending on the current color mode + + +None + + +background() +fill() +stroke() + + +1.0 + +Function + +Core + +Extended + + + diff --git a/mobile/web/reference/API/color_datatype.xml b/mobile/web/reference/API/color_datatype.xml new file mode 100644 index 000000000..8c5c61262 --- /dev/null +++ b/mobile/web/reference/API/color_datatype.xml @@ -0,0 +1,66 @@ + + +color + +Data + +Primitive + +Web & Application + + +color.gif + +color c1 = color(204, 153, 0); +color c2 = #FFCC00; +noStroke(); +fill(c1); +rect(0, 0, 25, 100); +fill(c2); +rect(25, 0, 25, 100); +color c3 = get(10, 50); +fill(c3); +rect(50, 0, 50, 100); + + + + +Datatype for storing color values. Colors may be assigned with get() and color() or they may be specified directly using hexadecimal notation such as #FFCC00. Colors are 32 bits of information ordered as AAAAAAAARRRRRRRRGGGGGGGGBBBBBBBB where the A's contain the alpha value, the R's are the red/hue value, G's are green/saturation, and B's are blue/brightness. Color is a datatype unique to Processing. + + + +color var +color var = colorvalue + + + + +variable name referencing the value + + + + +any color value + + + + + +colorMode() +color() + + +1.0 + +Datatype + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/comma.xml b/mobile/web/reference/API/comma.xml new file mode 100644 index 000000000..3bf873339 --- /dev/null +++ b/mobile/web/reference/API/comma.xml @@ -0,0 +1,57 @@ + + +, (comma) + +Structure + + + +Web & Application + + + + + +// Comma used to separate a list of variable declarations +int a=20, b=30, c=80; + +// Comma used to separate a list of values assigned to an array +int[] d = { 20, 60, 80 }; + +// Comma used to separate a list of parameters passed to a function +line(a, b, c, b); +line(d[0], d[1], d[2], d[1]); + + + + +Separates parameters in function calls and elements during assignment. + + + +value1, ..., valueN + + + + +any int, float, byte, boolean, color, char, String + + + + + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/comment.xml b/mobile/web/reference/API/comment.xml new file mode 100644 index 000000000..b04b0bee0 --- /dev/null +++ b/mobile/web/reference/API/comment.xml @@ -0,0 +1,53 @@ + + +// (comment) + +Structure + + + +Web & Application + + + + +// Draws two lines which divides the window +// into four quadrants +line(0, 50, 100, 50); // Draw the horizontal line +line(50, 0, 50, 100); // Draw the vertical line + + + + +Explanatory notes embedded within the code. Comments are used to remind yourself and to inform others about the function of your program. Single-line comments are signified with the // characters. Comments are ignored by the compiler. + + + +// comment + + + + +any sequence of characters + + + + + +/* */ (multiline comment) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/concat.xml b/mobile/web/reference/API/concat.xml new file mode 100644 index 000000000..e27f47114 --- /dev/null +++ b/mobile/web/reference/API/concat.xml @@ -0,0 +1,51 @@ + + +concat() + +Data + +Array Functions + +Web & Application + + + + +String sa1[] = { "OH ", "NY ", "CA "}; +String sa2[] = { "KY ", "IN ", "MA "}; +String sa3[] = concat(sa1, sa2); +print(sa3); // Prints "OH NY CA KY IN MA " + + + + +Concatenates two arrays. For example, concatenating the array { 1, 2, 3 } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters must be arrays of the same datatype. + + + +concat(array1, array2) + + + + +booleans[], bytes[], chars[], ints[], floats[], or Strings[] + + +Array (the same datatype as the input) + + +splice() + + +1.0 + +Function + +Core + + +Extended + + + + diff --git a/mobile/web/reference/API/conditional.xml b/mobile/web/reference/API/conditional.xml new file mode 100644 index 000000000..d4295df4a --- /dev/null +++ b/mobile/web/reference/API/conditional.xml @@ -0,0 +1,66 @@ + + +?: (conditional) + +Control + +Conditionals + +Web & Application + + + + +int s = 0; +for(int i=5; i<100; i+=5) { + s = (i < 50) ? 0 : 255; + stroke(s); + line(30, i, 80, i); +} + + + + +A shortcut for writing an if() and else structure. If the condition evaluates to true, expression1 is evaluated and returned. If the condition evaluates to false, expression2 is evaluated and returned.

The following conditional:
condition : expression1 ? expression2

is equivalent to this structure:
if(condition) {
expression1
} else {
expression2
}
+
+ + +condition ? expression1 : expression2 + + + + +any valid expression which evaluates to true or false + + + + +any valid expression + + + + +any valid expression + + +Variable, dependent on the datatype of the expressions + + +if() +else + + +1.0 + +Structure + +PDE + + +Extended + + + + + +
diff --git a/mobile/web/reference/API/constrain.xml b/mobile/web/reference/API/constrain.xml new file mode 100644 index 000000000..517e35de2 --- /dev/null +++ b/mobile/web/reference/API/constrain.xml @@ -0,0 +1,66 @@ + + +constrain() + +Math + +Calculation + +Web & Application + + +constrain_.jar + +void loop() +{ + background(204); + float mx = constrain(mouseX, 30, 70); + rect(mx-10, 40, 20, 20); +} + + + + +Constrains a value to not exceed a maximum and minimum value. + + + +constrain(value, min, max) + + + + +int or float: the value to constrain + + + + +int or float: minimum limit + + + + +int or float: maximum limit + + +float or int (depending on the input values) + + +max() +min() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/contract.xml b/mobile/web/reference/API/contract.xml new file mode 100644 index 000000000..5de189dbd --- /dev/null +++ b/mobile/web/reference/API/contract.xml @@ -0,0 +1,55 @@ + + + +contract() + +Data + +Array Functions + +Web & Application + + + + +int[] ia = {0, 1, 2, 3, 4, 5, 6, 7}; +println(ia.length); // Prints "8" +ia = contract(ia, 5); +println(ia.length); // Prints "5" + + + + +Decreases the size of an array. The required newSize parameter provides precise control over the decrease in size. + + + +contract(array, newSize) + + + + +booleans[], bytes[], chars[], ints[], floats[], or Strings[] + + + + +positive int: new size for the array + + +Array (the same datatype as the input) + + +expand() + + +1.0 + +Function + +Core + +Extended + + + diff --git a/mobile/web/reference/API/curlybraces.xml b/mobile/web/reference/API/curlybraces.xml new file mode 100644 index 000000000..d90e7b36f --- /dev/null +++ b/mobile/web/reference/API/curlybraces.xml @@ -0,0 +1,66 @@ + + +{} (curly braces) + +Structure + + + +Web & Application + + + + +int[] a = { 5, 20, 25, 45, 70 }; + +void setup() { + size(100, 100); +} + +void loop() { + for(int i=0; i<a.length; i++) { + line(0, a[i], 50, a[i]); + } +} + + + + +Define the beginning and end of functions blocks and statement blocks such as the for() and if() structures. Curly braces are also used for defining inital values in array declarations. + + + +{ statements } +{ ele0, ..., eleN } + + + + +any sequence of valid statements + + + + +list of elements separated by commas + + + + + +() (parentheses) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/curve.xml b/mobile/web/reference/API/curve.xml new file mode 100644 index 000000000..c08ec1daf --- /dev/null +++ b/mobile/web/reference/API/curve.xml @@ -0,0 +1,91 @@ + + +curve() + +Shape + +Curves + +Web & Application + + +curve_.gif + +stroke(255, 102, 0); +curve(5, 26, 5, 26, 73, 24, 73, 61); +stroke(0); +curve(5, 26, 73, 24, 73, 61, 15, 65); +stroke(255, 102, 0); +curve(73, 24, 73, 61, 15, 65, 15, 65); + + + + +Draws a curved line on the screen. The first and second parameters specify the first anchor point and the last two parameters specify the second anchor. The middle parameters specify the points for defining the shape of the curve. Longer curves can be created by putting a series of curve() functions together. An additional function called curveTightness() provides control for the visual quality of the curve. The curve() function is an implementation of Catmull-Rom splines. + + + +curve(x1, y1, x2, y2, x3, y3, x4, y4); + + + + +int or float: x-coordinate of the first anchor + + + + +int or float: y-coordinate of the first anchor + + + + +int or float: x-coordinate of the first point + + + + +int or float: y-coordinate of the first point + + + + +int or float: x-coordinate of the second point + + + + +int or float: y-coordinate of the second point + + + + +int or float: x-coordinate of the second anchor + + + + +int or float: y-coordinate of the second anchor + + +None + + +curveVertex() +bezier() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/curveVertex.xml b/mobile/web/reference/API/curveVertex.xml new file mode 100644 index 000000000..b8fead772 --- /dev/null +++ b/mobile/web/reference/API/curveVertex.xml @@ -0,0 +1,71 @@ + + +curveVertex() + +Shape + +Vertex + +Application & Web + + +curveVertex_.gif + +beginShape(LINE_STRIP); +curveVertex(84, 91); +curveVertex(84, 91); +curveVertex(68, 19); +curveVertex(21, 17); +curveVertex(32, 100); +curveVertex(32, 100); +endShape(); + + + + +Specifies vertex coordinates for curves. This function may only be called between beginShape() and endShape(). The curveVertex() function is an implementation of Catmull-Rom splines. + + + +curveVertex(x, y) +curveVertex(x, y, z) + + + + +The x-coordinate of the vertex, either a float or int + + + + +The y-coordinate of the vertex, either a float or int + + + + +The z-coordinate of the vertex, either a float or int + + +None + + +beginShape() +endShape() +vertex() +bezierVertex() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/day.xml b/mobile/web/reference/API/day.xml new file mode 100644 index 000000000..7ee229eef --- /dev/null +++ b/mobile/web/reference/API/day.xml @@ -0,0 +1,73 @@ + + +day() + +Input/Output + +Time & Date + +Web & Application + + +day_.jar + +void setup() { + PFont metaBold; + metaBold = loadFont("fonts/Meta-Bold.vlw.gz"); + setFont(metaBold, 44); + hint(SMOOTH_IMAGES); +} + +void loop() { + int d = day(); // Values from 1 - 31 + int m = month(); // Values from 1 - 12 + int y = year(); // 2003, 2004, 2005, etc. + String s = String.valueOf(d); + text(s, 10, 28); + s = String.valueOf(m); + text(s, 10, 56); + s = String.valueOf(y); + text(s, 10, 84); +} + + + + +Processing communicates with the clock on your computer. The day() function returns the current day as a value from 1 - 31. + + + +day() + + + + + + + +int + + +millis() +second() +minute() +hour() +day() +month() +year() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/decrement.xml b/mobile/web/reference/API/decrement.xml new file mode 100644 index 000000000..f194c1931 --- /dev/null +++ b/mobile/web/reference/API/decrement.xml @@ -0,0 +1,54 @@ + + +-- (decrement) + +Math + +Operators + +Web & Application + + + + +int a = 5; // Sets "a" to 5 +int b = a--; // Sets "b" to 5, then decrements "a" to 4 +int c = a; // Sets "c" to 4 + + + + +Substracts the value of an integer variable by 1. Equivalent to the operation i = i - 1. If the value of the variable i is five, then the expression i-- decreases the value of i to 4. + + + +var-- + + + + +int + + + + + +- (minus) +-= (subtract assign) +++ (increment) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/default.xml b/mobile/web/reference/API/default.xml new file mode 100644 index 000000000..b46ee8bcf --- /dev/null +++ b/mobile/web/reference/API/default.xml @@ -0,0 +1,64 @@ + + +default + +Control + +Conditionals + +Web & Application + + + + +char letter = 'F'; + +switch(letter) { + case 'A': + println("Alpha"); // Does not execute + break; + case 'B': + println("Bravo"); // Does not execute + break; + default: + println("Zulu"); // Prints "Zulu" + break; +} + + + + +Keyword for defining the default condition of a switch(). If none of the case labels match the switch() parameter, the statement(s) after the default syntax are executed. Switch structures don't require a default. + + + +default: statements + + + + +one or more valid statements to be executed + + + + + +switch() +break +case + + +1.0 + +Keyword + +Java + + +Extended + + + + + + diff --git a/mobile/web/reference/API/delay.xml b/mobile/web/reference/API/delay.xml new file mode 100644 index 000000000..89a610c93 --- /dev/null +++ b/mobile/web/reference/API/delay.xml @@ -0,0 +1,57 @@ + + +delay() + +Environment + + + +Web & Application + + +delay_.jar + +int pos = 0; +void loop() { + background(204); + pos++; + line(pos, 20, pos, 80); + if(pos > width) { + pos = 0; + } + delay(250); // Stops the program for 250 milliseconds +} + + + + +Forces the program to stop running for a specified time. Delay times are specified in thousandths of a second. The function call delay(3000) will stop the program for three seconds. This function causes the program to stop as soon as it is called, except if the program is running the loop() for the first time, it will complete the loop before stopping. + + + +delay(milliseconds) + + + + +int: specified as milliseconds (there are 1000 milliseconds in 1 second) + + +None + + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/dist.xml b/mobile/web/reference/API/dist.xml new file mode 100644 index 000000000..9ab1ed301 --- /dev/null +++ b/mobile/web/reference/API/dist.xml @@ -0,0 +1,80 @@ + + +dist() + +Math + +Calculation + +Web & Application + + +dist_.jar + +// Sets the background gray value based on +// the distance of the mouse from the center +void loop() { + float d = dist(50, 50, mouseX, mouseY); + fill(d*4); + rect(0, 0, 99, 99); +} + + + + +Calculates the distance between two points. + + + +dist(x1, y1, x2, y2); +dist(x1, y1, z1, x2, y2, z2); + + + + +int or float: x-coordinate of the first point + + + + +int or float: y-coordinate of the first point + + + + +int or float: z-coordinate of the first point + + + + +int or float: x-coordinate of the second point + + + + +int or float: y-coordinate of the second point + + + + +int or float: z-coordinate of the second point + + +float + + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/divide.xml b/mobile/web/reference/API/divide.xml new file mode 100644 index 000000000..5829b89c8 --- /dev/null +++ b/mobile/web/reference/API/divide.xml @@ -0,0 +1,57 @@ + + +/ (divide) + +Math + +Operators + +Web & Application + + + + +int g = 50 / 5; // Sets g 10 +int h = g / 5; // Sets h 2 + + + + +Divides the value of the second parameter by the value of the first parameter. The answer to the equation 20 / 4 is 5. The number 20 is the sum of 4 of the number 5. As an equation we see that 4 + 4 + 4 + 4 + 4 = 20. + + + +value1 / value2 + + + + +int or float + + + + +int or float, but not zero (it is not possible divide by zero) + + + + + +* (multiply) +% (modulo) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/dot.xml b/mobile/web/reference/API/dot.xml new file mode 100644 index 000000000..310ad6d52 --- /dev/null +++ b/mobile/web/reference/API/dot.xml @@ -0,0 +1,90 @@ + + +. (dot) + +Structure + + + +Web & Application + + + + +// Declare and contruct two objects (h1, h2) from the class HLine +HLine h1 = new HLine(20, 1.0); +HLine h2 = new HLine(50, 5.0); + +void setup() { + size(200, 200); +} + +void loop() { + if(h2.speed > 1.0) { + h2.speed -= 0.01; + } + h1.update(); + h2.update(); +} + +class HLine { + float ypos, speed; + HLine (float y, float s) { + ypos = y; + speed = s; + } + void update() { + ypos += speed; + if (ypos > width) { + ypos = 0; + } + line(0, ypos, width, ypos); + } +} + + + + +Provides access to an object's methods and data. An object is an instance of a class and contains is a grouping of methods (object functions) and data (object variables and constants). The dot operator directs the program to the information encapsulated within an object. + + + +object.method() +object.data + + + + +the object you want to access + + + + +method encapsulated in the object + + + + +variable or constant encapsulated in the object + + + + + +Object + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/draw.xml b/mobile/web/reference/API/draw.xml new file mode 100644 index 000000000..a2875f590 --- /dev/null +++ b/mobile/web/reference/API/draw.xml @@ -0,0 +1,69 @@ + + +draw() + +Structure + + + +Web & Application + + + + + +void setup() { + size(200, 200); + noStroke(); +} + +int a = 0; + +void draw() { + fill(a); + a = a + 1; + if (a > width) { + a = 0; + } + rect(a, 0, 2, 200); +} + + + + +Continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called. Calling redraw() will cause the code inside draw() to execute once and calling loop() will cause the code inside draw() to execute continuously. The draw() function is used in conjunction with setup(). The number of times draw() executes in each second may be controlled with the delay() and framerate() functions. + + + +draw() { + statements +} + + + + +A sequence of statements to be executed over and over again + + +None + + +setup() +loop() +noLoop() + + +1.0 + +Processing Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/ellipse.xml b/mobile/web/reference/API/ellipse.xml new file mode 100644 index 000000000..a0f97d965 --- /dev/null +++ b/mobile/web/reference/API/ellipse.xml @@ -0,0 +1,65 @@ + + +ellipse() + +Shape + +2D Primitives + +Web & Application + + +ellipse_.gif + +ellipse(56, 46, 55, 55); + + + + +Draws an ellipse (oval) in the display window. An ellipse with an equal width and height is a circle. The first two parameters set the location, the third sets the width, and the fourth sets the height. The origin may be changed with the ellipseMode() function. + + + +ellipse(x, y, width, height) + + + + +int or float: x-coordinate of the ellipse + + + + +int or float: y-coordinate of the ellipse + + + + +int or float: width of the ellipse + + + + +int or float: height of the ellipse + + +None + + +ellipseMode() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/ellipseMode.xml b/mobile/web/reference/API/ellipseMode.xml new file mode 100644 index 000000000..a9173d649 --- /dev/null +++ b/mobile/web/reference/API/ellipseMode.xml @@ -0,0 +1,47 @@ + + +ellipseMode() + +Shape + +2D Primitives + +Web & Application + + +ellipseMode_.gif + +ellipseMode(CENTER); +ellipse(35, 35, 50, 50); +ellipseMode(CORNER); +fill(102); +ellipse(35, 35, 50, 50); + + + + +The origin of the ellipse is modified by the ellipseMode() function. The default configuration is ellipseMode(CENTER), which specifies the location of the ellipse as the center of the shape. The CENTER_RADIUS mode is the same, but the width and height parameters to ellipse() specify the radius of the ellipse, rather than the diameter. The CORNER mode draws the shape from the upper-left corner of its bounding box. The CORNERS mode uses the four parameters to ellipse() to set two opposing corners of the ellipse's bounding box. The parameter must be written in "ALL CAPS" because Processing is a case sensitive language. + + + +ellipseMode(MODE) + + + + +Either CENTER, CENTER_RADIUS, CORNER, CORNERS. + + +None + + +ellipse() + + +1.0 + +Function + +Core + + diff --git a/mobile/web/reference/API/else.xml b/mobile/web/reference/API/else.xml new file mode 100644 index 000000000..a8f2b083a --- /dev/null +++ b/mobile/web/reference/API/else.xml @@ -0,0 +1,88 @@ + + +else + +Control + +Conditionals + +Web & Application + + +else.gif + +for(int i = 5; i < 95; i += 5) { + if(i < 35) { + line( 30, i, 80, i ); + } else { + line( 20, i, 90, i ); + } +} + + + + +else2.gif + +for(int i = 5; i < 95; i += 5) { + if(i < 35) { + line( 30, i, 80, i ); + } else if (i < 65) { + line( 20, i, 90, i ); + } else { + line( 0, i, 100, i ); + } +} + + + + +Extends the if() structure allowing the program to choose between two or more block of code. It specifies a block of code to execute when the expression in if() is false. + + + +if(expression) { + statements +} else { + statements +} + +if(expression) { + statements +} else if(expression) { + statements +} else { + statements +} + + + + +any valid expression that evaluates to true or false + + + + +one or more statements to be executed + + + + + +if() + + +1.0 + +Keyword + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/endShape.xml b/mobile/web/reference/API/endShape.xml new file mode 100644 index 000000000..f5df676db --- /dev/null +++ b/mobile/web/reference/API/endShape.xml @@ -0,0 +1,55 @@ + + +endShape() + +Shape + +Vertex + +Web & Application + + +endShape_.gif + +beginShape(LINE_STRIP); +vertex(30, 20); +vertex(85, 20); +vertex(85, 75); +vertex(30, 75); +endShape(); + + + + +The endShape() function is the companion to beginShape() and may only be called after the later. When endshape() is called, all of image data defined since the previous call to beginShape() is written into the image buffer. + + + +beginShape() + + + + + + + +None + + +beginShape() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/equality.xml b/mobile/web/reference/API/equality.xml new file mode 100644 index 000000000..1b03adc10 --- /dev/null +++ b/mobile/web/reference/API/equality.xml @@ -0,0 +1,63 @@ + + +== (equality) + +Control + +Relational Operators + +Web & Application + + + + +int a = 23; +int b = 23; +if(a == b) { + println("variables a and b are equal"); +} + + + + +Determines if two values are equivalent. The equality operator is different from the assignment operator. + + + +value1 == value2 + + + + +int, float, char, byte, boolean, String + + + + +int, float, char, byte, boolean, String + + + + + +> (greater than) +< (less than) +>= (greater than or equal to) +<= (less than or equal to) +!= (inequality) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/expand.xml b/mobile/web/reference/API/expand.xml new file mode 100644 index 000000000..436c4f792 --- /dev/null +++ b/mobile/web/reference/API/expand.xml @@ -0,0 +1,61 @@ + + +expand() + +Data + +Array Functions + +Web & Application + + + + +int[] ia = {0, 1, 3, 4}; +println(ia.length); // Prints "4" +ia = expand(ia); +println(ia.length); // Prints "8" +ia = expand(ia, 512); +println(ia.length); // Prints "512" + + + + +Increases the size of an array. By default, this function doubles the size of the array, but the optional newSize parameter provides precise control over the increase in size. + + + +expand(array) +expand(array, newSize) + + + + +booleans[], bytes[], chars[], ints[], floats[], or Strings[] + + + + +positive int: new size for the array + + +Array (the same datatype as the input) + + +contract() + + +1.0 + +Function + +Core + + +Extended + + + + + + diff --git a/mobile/web/reference/API/false.xml b/mobile/web/reference/API/false.xml new file mode 100644 index 000000000..64105e356 --- /dev/null +++ b/mobile/web/reference/API/false.xml @@ -0,0 +1,56 @@ + + +false + +Structure + + + +Web & Application + + + + +rect(30, 20, 50, 50); +boolean b = false; +if(b == false) { + line(20, 10, 90, 80); // This line draws +} else { + line(20, 80, 90, 10); +} + + + + +Reserved word representing the logical value "false". Only variables of type boolean may be assigned the value false + + + +false + + + + + + + + + +any valid statements + + + + + +true +boolean + + +1.0 + +Keyword + +PDE + + + diff --git a/mobile/web/reference/API/fill.xml b/mobile/web/reference/API/fill.xml new file mode 100644 index 000000000..a8ce8bd7e --- /dev/null +++ b/mobile/web/reference/API/fill.xml @@ -0,0 +1,90 @@ + + +fill() + +Color + +Setting + +Web & Application + + +fill_.gif + +fill(153); +rect(30, 20, 55, 55); + + + + +fill_2.gif + +fill(204, 102, 0); +rect(30, 20, 55, 55); + + + + +Sets the color used to fill shapes. For example, if you call fill(204, 102, 0) and draw a rectangle it will be filled with orange. This color is either specified in terms of the RGB or HSB color depending on the current colorMode(). The default color space is RGB, with each value in the range from 0 to 255. The version of fill() with one parameter specifies a gray value, the version with three parameters specifies a color, and the version with four parameters specifies a color with an alpha value. Note: the value for the parameter "gray" must be less than or equal to the current maximum value as specified by colorMode(). The default value is 255. + + + +fill(gray) +fill(gray, alpha) +fill(value1, value2, value3) +fill(color) +fill(color, alpha) +fill(value1, value2, value3, alpha) + + + + +int or float: number specifying value between white and black + + + + +int or float: red or hue value + + + + +int or float: green or saturation value + + + + +int or float: blue or brightness value + + + + +int or float: opacity of the fill + + + + +color: any value of the color datatype + + +None + + +noFill() +colorMode() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/floor.xml b/mobile/web/reference/API/floor.xml new file mode 100644 index 000000000..9a4586fd2 --- /dev/null +++ b/mobile/web/reference/API/floor.xml @@ -0,0 +1,51 @@ + + +floor() + +Math + +Calculation + +Web & Application + + + + +float x = 2.88; +float a = floor(x); // Set "a" to 2.0 + + + + +Calculates the closest value that is less than or equal to the value of the parameter. + + + +floor(value) + + + + +float + + +float + + +ceil() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/for.xml b/mobile/web/reference/API/for.xml new file mode 100644 index 000000000..54e82ae15 --- /dev/null +++ b/mobile/web/reference/API/for.xml @@ -0,0 +1,102 @@ + + +for() + +Control + +Iteration + +Web & Application + + +for_.gif + + +for(int i=0; i<40; i=i+1) { + line(30, i, 80, i); +} + + + + +for_2.gif + + +for(int i=0; i<80; i=i+5) { + line(30, i, 80, i); +} + + + + +for_3.gif + + +for(int i=40; i<80; i=i+5) { + line(30, i, 80, i); +} + + + + +for_4.gif + + +for(int i=30; i<80; i=i+5) { + for(int j=0; j<80; j=j+5) { + point(i, j); + } +} + + + + +Controls a sequence of repetitions. A for() structure has three parts: init, test, and update. Each part must be separated by a semi-colon ";". The loop continues until the test evaluates to false. When a for() structure is executed, the following sequence of events occurs:
1. The init statement is executed
2. The test is evaluated to be true or false
3. If the test is true, jump to step 4. If the test is False, jump to step 6
4. Execute the statements within the block
5. Execute the update statement and jump to step 2
6. Exit the loop. +
+ + +for(init; test; update) { + statements +} + + + + +statement executed once when beginning loop + + + + +if the test evaluates to true, the statements execute + + + + +executes at the end of each iteration + + + + +collection of statements executed each time through the loop + + + + + +while() + + +1.0 + +Structure + +PDE + + + + + + + + +
diff --git a/mobile/web/reference/API/greaterthan.xml b/mobile/web/reference/API/greaterthan.xml new file mode 100644 index 000000000..30b8167cd --- /dev/null +++ b/mobile/web/reference/API/greaterthan.xml @@ -0,0 +1,63 @@ + + +> (greater than) + +Control + +Relational Operators + +Web & Application + + + + +int a = 5; +int b = 13; +if(b > a) { + println("variable b is larger the variable a"); +} + + + + +Tests if the value on the left is larger than the value on the right. + + + +value1 > value2 + + + + +int or float + + + + +int or float + + + + + +< (less than) +>= (greater than or equal to) +<= (less than or equal to) +== (equality) +!= (inequality) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/greaterthanorequalto.xml b/mobile/web/reference/API/greaterthanorequalto.xml new file mode 100644 index 000000000..3fdc1fb09 --- /dev/null +++ b/mobile/web/reference/API/greaterthanorequalto.xml @@ -0,0 +1,63 @@ + + +>= (greater than or equal to) + +Control + +Relational Operators + +Web & Application + + + + +int a = 23; +int b = 23; +if(a >= b) { + println("variable a is greater or equal to variable b ") +} + + + + +Tests if the value on the left is larger than the value on the right or if the values are equivalent. + + + +value1 >= value2 + + + + +int or float + + + + +int or float + + + + + +> (greater than) +< (less than) +<= (less than or equal to) +== (equality) +!= (inequality) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/green.xml b/mobile/web/reference/API/green.xml new file mode 100644 index 000000000..b2a6821c1 --- /dev/null +++ b/mobile/web/reference/API/green.xml @@ -0,0 +1,57 @@ + + +green() + +Color + +Creating & Reading + +Web & Application + + +green_.gif + +noStroke(); +color c = color(0, 126, 255); +fill(c); +rect(15, 20, 35, 60); +float value = green(c); // Sets "value" to "126" +fill(value); +rect(50, 20, 35, 60); + + + + +Extracts the green value from a color. + + + +green(color) + + + + +any value of the color datatype + + +float + + +red() +blue() +hue() +saturation() +brightness() + + +1.0 + +Function + +Core + + + + + + diff --git a/mobile/web/reference/API/height.xml b/mobile/web/reference/API/height.xml new file mode 100644 index 000000000..db383aec9 --- /dev/null +++ b/mobile/web/reference/API/height.xml @@ -0,0 +1,53 @@ + + +height + +Environment + + + +Web & Application + + +height.gif + +noStroke(); +background(0); +rect(40, 0, 20, height); +rect(60, 0, 20, height/2); + + + + +System variable which stores the height of the display window. This value is set by the second parameter of the size() function. For example, the function call size(320, 240) sets the height variable to the value 240. The value of height is zero until size() is called. + + + +height + + + + + + + + + + +width + + +1.0 + +System variable + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/hour.xml b/mobile/web/reference/API/hour.xml new file mode 100644 index 000000000..8cb7bd643 --- /dev/null +++ b/mobile/web/reference/API/hour.xml @@ -0,0 +1,62 @@ + + +hour() + +Input/Output + +Time & Date + +Web & Application + + +hour_.jar + +void loop() { + background(204); + int s = second(); // Values from 0 - 59 + int m = minute(); // Values from 0 - 59 + int h = hour(); // Values from 0 - 23 + line(s, 0, s, 33); + line(m, 33, m, 66); + line(h, 66, h, 100); +} + + + + +Processing communicates with the clock on your computer. The hour() function returns the current hour as a value from 0 - 23. + + + +hour() + + + + + + + +int + + +millis() +second() +minute() +day() +month() +year() + + +1.0 + +Function + +Core + + + + + + + + diff --git a/mobile/web/reference/API/hue.xml b/mobile/web/reference/API/hue.xml new file mode 100644 index 000000000..1c8a0985a --- /dev/null +++ b/mobile/web/reference/API/hue.xml @@ -0,0 +1,61 @@ + + +hue() + +Color + +Creating & Reading + +Web & Application + + +hue_.gif + +noStroke(); +colorMode(HSB, 255); +color c = color(0, 126, 255); +fill(c); +rect(15, 20, 35, 60); +float value = hue(c); // Sets "value" to "0" +fill(value); +rect(50, 20, 35, 60); + + + + +Extracts the hue value from a color. + + + +hue(color) + + + + +any value of the color datatype + + +float + + +red() +green() +blue() +saturation() +brightness() + + +1.0 + +Function + +Core + +Extended + + + + + + + diff --git a/mobile/web/reference/API/if.xml b/mobile/web/reference/API/if.xml new file mode 100644 index 000000000..baf7cd092 --- /dev/null +++ b/mobile/web/reference/API/if.xml @@ -0,0 +1,63 @@ + + +if() + +Control + +Conditionals + +Web & Application + + +if_.gif + +for(int i=5; i<height; i+=5) { + stroke(255); //Set the color to white + if(i < 35) { //When "i" is less than "35"... + stroke(0); //...set the color to black + } + line(30, i, 80, i); +} + + + + +Allows the program to make a decision about which code to execute. If the expression evaluates to true, the statements enclosed within the block are executed and if the expression evaluates to false the statements are not executed. + + + +if(expression) { + statements +} + + + + +any valid expression that evaluates to true or false + + + + +one or more statements to be executed + + + + + +else + + +1.0 + +Structure + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/increment.xml b/mobile/web/reference/API/increment.xml new file mode 100644 index 000000000..58ecb5a62 --- /dev/null +++ b/mobile/web/reference/API/increment.xml @@ -0,0 +1,54 @@ + + +++ (increment) + +Math + +Operators + +Web & Application + + + + +int a = 1; // Sets "a" to 1 +int b = a++; // Sets "b" to 1, then increments "a" to 2 +int c = a; // Sets "c" to 2 + + + + +Increases the value of an integer variable by 1. Equivalent to the operation i = i + 1. If the value of the variable i is five, then the expression i++ increases the value of i to 6. + + + +value++ + + + + +int + + + + + ++ (add) ++= (add assign) +-- (decrement) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/inequality.xml b/mobile/web/reference/API/inequality.xml new file mode 100644 index 000000000..7a798beea --- /dev/null +++ b/mobile/web/reference/API/inequality.xml @@ -0,0 +1,64 @@ + + +!= (inequality) + +Control + +Relational Operators + +Web & Application + + + + +int a = 22; +int b = 23; +if(a != b) { + println("variable a is not equal to variable b"); +} + + + + +Determines if one expression is not equivalent to another. + + + +value1 != value2 + + + + +int, float, char, byte, boolean, String + + + + +int, float, char, byte, boolean, String + + + + + +> (greater than) +< (less than) +>= (greater than or equal to) +<= (less than or equal to) +== (equality) + + +1.0 + +Operator + +PDE + + + + + + + + + + diff --git a/mobile/web/reference/API/int.xml b/mobile/web/reference/API/int.xml new file mode 100644 index 000000000..e4e9c4e56 --- /dev/null +++ b/mobile/web/reference/API/int.xml @@ -0,0 +1,60 @@ + + +int + +Data + +Primitive + +Web & Application + + + + +int a; // Declare variable "a" of type int +a = 23; // Assign "a" the value 23 +int b = -256; // Declare variable "b" and assign it the value -256 +int c = a + b; // Declare variable "c" and assign it the sum of "a" and "b" + + + + +Datatype for integers, numbers without a decimal point. Integers can be as large as 2,147,483,647 and as low as -2,147,483,648. They are stored as 32 bits of information. The first time a variable is written, it must be declared with a statement expressing its datatype. Subsequent uses of this variable must not reference the datatype because Processing will think the variable is being declared again. + + + +int var +int var = value + + + + +variable name referencing the value + + + + +any integer value + + + + + +splitInts() +float + + +1.0 + +Datatype + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/intconvert.xml b/mobile/web/reference/API/intconvert.xml new file mode 100644 index 000000000..86ccca86c --- /dev/null +++ b/mobile/web/reference/API/intconvert.xml @@ -0,0 +1,57 @@ + + +int() + +Data + +Conversion + +Web & Application + + + + +float f = 65.0; +int i = int(f); +println(f + " : " + i); // Prints "65.0 : 65" + +char c = 'E'; +i = int(c); +println(c + " : " + i); // Prints "E : 69" + + + + +Converts a primitive datatype, string, or array to its integer representation. + + + +int(value) + + + + +float, char, byte, boolean, String, float[], char[], byte[], boolean[], String[] + + +int + + +int +float() + + +1.0 + +Function + +IDE + + + + + + + + + diff --git a/mobile/web/reference/API/join.xml b/mobile/web/reference/API/join.xml new file mode 100644 index 000000000..482fbbf44 --- /dev/null +++ b/mobile/web/reference/API/join.xml @@ -0,0 +1,110 @@ + + +join() + +Data + +String Functions + +Web & Application + + + + +// works identically with float[] and String[] +int list[] = new list[3]; +list[0] = 8; +list[1] = 67; +list[2] = 5; +String formatted = join(list, ", "); +// formatted now contains "8, 67, 5" + +// to format the number of digits used +// the '3' means to pad with zeroes up to 3 digits +String withzeroes = join(list, " ", 3); +// withzeros now contains "008 067 005" + +// for floats, formatting is more complicated because +// there are also digits after the decimal point. +float f[] = new float[3]; +f[0] = 1.3; +f[1] = 92.8; +f[2] = 0.7; +// 3 digits on the left of the decimal point +// 2 digits to the right of the decimal point +String zerofloats = join(f, " ", 3, 2); +// zerofloats now contains "001.30 092.80 007.70" + +// or if you don't want to pad the left-hand side +// a zero will say to ignore and don't pad +String lesspadding = join(f, " ", 0, 2); +// lesspadding now contains "1.30 92.80 7.70" + + + + + +Combines an array of elements into one String. + + + +join(anyArray, separator) +join(intArray, separator, digits) +join(floatArray, separator, left, right) + + + + +array of strings, ints, or floats + + + + +array of ints + + + + +array of floats + + + + +String: a string to be placed between each item + + + + +int: number of digits to pad with zeroes + + + + +int: number of digits to the left of the decimal point + + + + +int: number of digits to the right of the decimal point + + +String + + +split() + + +1.0 + +Function + +Core + + +Extended + + + + + + diff --git a/mobile/web/reference/API/key.xml b/mobile/web/reference/API/key.xml new file mode 100644 index 000000000..286ef0ee2 --- /dev/null +++ b/mobile/web/reference/API/key.xml @@ -0,0 +1,86 @@ + + +key + +Input/Output + +Keyboard + +Web & Application + + +key.jar + +// Click on the window to give it focus +// and press the 'B' key + +void loop() { + if(keyPressed) { + if (key == 'b' || key == 'B') { + fill(0); + } + } else { + fill(255); + } + rect(25, 25, 50, 50); +} + + + + +key2.jar + +// Click on the window to give it focus +// and press the up and down arrow keys + +void loop() { + if(keyPressed) { + if (key == UP) { + fill(255); + } else if (key == DOWN) { + fill(0); + } + } else { + fill(126); + } + rect(25, 25, 50, 50); +} + + + + +The system variable key always contains the value of the most recently pressed key on the keyboard. For detecting the arrow keys, the key variable is set to either UP, DOWN, LEFT, or RIGHT. Other special key constants are ALT, CONTROL, and SHIFT. + + + +key + + + + + + + + + + +keyPressed +keyCode +keyPressed() +keyReleased() + + +1.0 + +System variable + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/keyPressed.xml b/mobile/web/reference/API/keyPressed.xml new file mode 100644 index 000000000..a877002b7 --- /dev/null +++ b/mobile/web/reference/API/keyPressed.xml @@ -0,0 +1,72 @@ + + +keyPressed() + +Input/Output + +Keyboard + +Web & Application + + +keyPressed_.jar + +// Click on the image to give it focus, +// and then press any key + +int value = 0; + +void loop() { + fill(value); + rect(25, 25, 50, 50); +} + +void keyPressed() +{ + if(value == 0) { + value = 255; + } else { + value = 0; + } +} + + + + +The keyPressed() function is called once every time a key is pressed. As a general rule, nothing should be draw within the keyPressed() block. + + + +void keyPressed() { + statements +} + + + + + + + +None + + +keyPressed +key +keyCode +keyReleased() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/keyPressed_var.xml b/mobile/web/reference/API/keyPressed_var.xml new file mode 100644 index 000000000..58872d18c --- /dev/null +++ b/mobile/web/reference/API/keyPressed_var.xml @@ -0,0 +1,68 @@ + + +keyPressed + +Input/Output + +Keyboard + +Web & Application + + +keyPressed.jar + +// Click on the image to give it focus +// and press any key + +// Note: the rectangle in this example may +// flicker as the operating system may +// register a long key press as a repetition +// of key presses + +void loop() { + if (keyPressed == true) { + fill(0); + } else { + fill(255); + } + rect(25, 25, 50, 50); +} + + + + +The boolean system variable keyPressed is true if any key is pressed and false if no keys are pressed. + + + +keyPressed + + + + + + + + + + +key +keyCode +keyPressed() +keyReleased() + + +1.0 + +System variable + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/keyReleased.xml b/mobile/web/reference/API/keyReleased.xml new file mode 100644 index 000000000..056aaa9bc --- /dev/null +++ b/mobile/web/reference/API/keyReleased.xml @@ -0,0 +1,72 @@ + + +keyReleased() + +Input/Output + +Keyboard + +Web & Application + + +keyReleased_.jar + +// Click on the image to give it focus, +// and then press any key + +int value = 0; + +void loop() { + fill(value); + rect(25, 25, 50, 50); +} + +void keyReleased() +{ + if(value == 0) { + value = 255; + } else { + value = 0; + } +} + + + + +The keyReleased() function is called once every time a key is released. As a general rule, nothing should be draw within the keyReleased() block. + + + +void keyReleased() { + statements +} + + + + + + + +None + + +keyPressed +key +keyCode +keyPressed() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/leftshift.xml b/mobile/web/reference/API/leftshift.xml new file mode 100644 index 000000000..6e128ef8e --- /dev/null +++ b/mobile/web/reference/API/leftshift.xml @@ -0,0 +1,77 @@ + + +<< (left shift) + +Math + +Bitwise Operators + +Web & Application + + + + +int m = 1 << 3; // In binary: 1 to 1000 +println(m); // Prints "8" +int n = 1 << 8; // In binary: 1 to 100000000 +println(n); // Prints "256" +int o = 2 << 3; // In binary: 10 to 10000 +println(o); // Prints "16" +int p = 13 << 1; // In binary: 1101 to 11010 +println(p); // Prints "26" + + + + + + +// Packs four 8 bit numbers into one 32 bit number +int a = 255; // Binary: 00000000000000000000000011111111 +int r = 204; // Binary: 00000000000000000000000011001100 +int g = 204; // Binary: 00000000000000000000000011001100 +int b = 51; // Binary: 00000000000000000000000000110011 +a = a << 24; // Binary: 11111111000000000000000000000000 +r = r << 16; // Binary: 00000000110011000000000000000000 +g = g << 8; // Binary: 00000000000000001100110000000000 + +// Equivalent to "color argb = color(r, g, b, a)" but faster +color argb = a | r | g | b; +fill(argb); +rect(30, 20, 55, 55); + + + + +Shifts bits to the left. The number to the left of the operator is shifted the number of places specified by the number to the right. Each shift to the left doubles the number, therefore each left shift multiplies the original number by 2. Use the left shift for fast multiplication or to pack a group of numbers together into one larger number. Left shifting only works with integers or numbers which automatically convert to an integer such at byte and char. + + + +value << n + + + + +int: the value to shift + + + + +int: the number of places to shift left + + + + + +>> (right shift) + + +1.0 + +Operator + +PDE + +Extended + + + diff --git a/mobile/web/reference/API/lerp.xml b/mobile/web/reference/API/lerp.xml new file mode 100644 index 000000000..767f86d50 --- /dev/null +++ b/mobile/web/reference/API/lerp.xml @@ -0,0 +1,86 @@ + + + + +lerp() + +Math + +Calculation + +Web & Application + + +lerp_.gif + +float a = 20; +float b = 80; +float c = lerp(a, b, .2); +float d = lerp(a, b, .5); +float e = lerp(a, b, .8); +beginShape(POINTS); +vertex(a, 50); +vertex(b, 50); +vertex(c, 50); +vertex(d, 50); +vertex(e, 50); +endShape(); + + + + +lerp_2.gif + +int x1 = 15; +int y1 = 10; +int x2 = 80; +int y2 = 90; +line(x1, y1, x2, y2); +for(int i=0; i<=10; i++) { + float x = lerp(x1, x2, i/10.0) + 10; + float y = lerp(y1, y2, i/10.0); + point(x, y); +} + + + + +Calculates a number between two numbers at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 equal to the first point, 0.1 is very near the first point, 0.5 is half-way in between, etc. The lerp function is convenient for creating motion along a strait path and for drawing dotted lines. + + + +lerp(value1, value2, amt) + + + + +float or int: first value + + + + +float or int: second value + + + + +float: between 0.0 and 1.0 + + +float + + +curvePoint() +bezierPoint() + + +1.0 + +Function + +Core + +Extended + + + diff --git a/mobile/web/reference/API/lessthan.xml b/mobile/web/reference/API/lessthan.xml new file mode 100644 index 000000000..642139da3 --- /dev/null +++ b/mobile/web/reference/API/lessthan.xml @@ -0,0 +1,63 @@ + + +< (less than) + +Control + +Relational Operators + +Web & Application + + + + +int a = 22; +int b = 23; +if(a < b) { + println("variable a is less then variable b "); +} + + + + +Tests if the value on the left is smaller than the value on the right. + + + +value1 < value2 + + + + +int or float + + + + +int or float + + + + + +> (greater than) +>= (greater than or equal to) +<= (less than or equal to) +== (equality) +!= (inequality) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/lessthanorequalto.xml b/mobile/web/reference/API/lessthanorequalto.xml new file mode 100644 index 000000000..9af840331 --- /dev/null +++ b/mobile/web/reference/API/lessthanorequalto.xml @@ -0,0 +1,63 @@ + + +<= (less than or equal to) + +Control + +Relational Operators + + + + + + +int a = 22; +int b = 23; +if(a <= b) { + println("variable a is less or equal to variable b "); +} + + + + +Tests if the value on the left is less than the value on the right or if the values are equivalent. + + + +value1 <= value2 + + + + +int or float + + + + +int or float + + + + + +> (greater than) +< (less than) +>= (greater than or equal to) +== (equality) +!= (inequality) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/line.xml b/mobile/web/reference/API/line.xml new file mode 100644 index 000000000..178ad6357 --- /dev/null +++ b/mobile/web/reference/API/line.xml @@ -0,0 +1,87 @@ + + +line() + +Shape + +2D Primitives + +Web & Application + + +line_.gif + +line(30, 20, 85, 75); + + + + +line_2.gif + +line(30, 20, 85, 20); +stroke(126); +line(85, 20, 85, 75); +stroke(255); +line(85, 75, 30, 75); + + + + +A line is a direct path between two points. The version of line() with four parameters draws the line in the XY plane at Z=0. The version with six parameters allows the line to be placed anywhere within XYZ space. To color a line, use the stroke() function. A line cannot be filled, therefore the fill() method will not affect the color of a line. Lines are drawn with a width of one pixel. + + + +line(x1, y1, x2, y2); +line(x1, y1, z1, x2, y2, z2); + + + + +int or float: x-coordinate of the first point + + + + +int or float: y-coordinate of the first point + + + + +int or float: z-coordinate of the first point + + + + +int or float: x-coordinate of the second point + + + + +int or float: y-coordinate of the second point + + + + +int or float: z-coordinate of the second point + + +None + + +beginShape() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/loadBytes.xml b/mobile/web/reference/API/loadBytes.xml new file mode 100644 index 000000000..01cea5e9b --- /dev/null +++ b/mobile/web/reference/API/loadBytes.xml @@ -0,0 +1,68 @@ + + +loadBytes() + +Input/Output + +Files + +Web & Application + + + + +// open a file and read its binary data +byte b[] = loadBytes("something.dat"); + +// print each value, from 0 to 255 +for (int i = 0; i < b.length; i++) { + // every tenth number, start a new line + if ((i % 10) == 0) { + println(); + } + + // bytes are from -128 to 127, this converts to 0 to 255 + int a = b[i] & 0xff; + print(a + " "); +} +// print a blank line at the end +println(); + + + + + +Reads the contents of a file or url and places it in a byte array. If a file is specified, it must be located in the sketch's "data" directory/folder. + + + +loadBytes(filename); + + + + +String: name of a file in the data folder or a url. + + +byte[] + + +loadStrings() +saveStrings() +saveBytes() + + +1.0 + +Function + +Core + + +Extended + + + + + + diff --git a/mobile/web/reference/API/loadStrings.xml b/mobile/web/reference/API/loadStrings.xml new file mode 100644 index 000000000..718554a4c --- /dev/null +++ b/mobile/web/reference/API/loadStrings.xml @@ -0,0 +1,56 @@ + + +loadStrings() + +Input/Output + +Files + +Web & Application + + + + +String lines[] = loadStrings("list.txt"); +println("there are " + lines.length + " lines"); +for (int i=0; i < lines.length; i++) { + println(lines[i]); +} + + + + +Reads the contents of a file or url and creates a String array of its individual lines. If a file is specified, it must be located in the sketch's "data" directory/folder. + + + +loadStrings(filename) + + + + +String: name of the file or url to load + + +String[] + + +loadBytes() +saveStrings() +saveBytes() + + +1.0 + +Function + +Core + + +Extended + + + + + + diff --git a/mobile/web/reference/API/log.xml b/mobile/web/reference/API/log.xml new file mode 100644 index 000000000..81531be1a --- /dev/null +++ b/mobile/web/reference/API/log.xml @@ -0,0 +1,54 @@ + + +log() + +Math + +Calculation + +Web & Application + + + + +void setup() { + int i = 12; + println(log(i)); + println(log10(i)); +} + +// Calculates the base-10 logarithm of a number +float log10 (int x) { + return (log(x) / log(10)); +} + + + + +Calculates the natural logarithm (the base-e logarithm) of a number. This function expects the values greater than 0.0. + + + +log(value) + + + + +int or float: number must be greater then 0.0 + + +float + + + + +1.0 + +Function + +Core + +Extended + + + diff --git a/mobile/web/reference/API/logicalAND.xml b/mobile/web/reference/API/logicalAND.xml new file mode 100644 index 000000000..4949b83b0 --- /dev/null +++ b/mobile/web/reference/API/logicalAND.xml @@ -0,0 +1,64 @@ + + +&& (logical AND) + +Control + +Logical Operators + +Web & Application + + +logicalAND.gif + +for(int i=5; i<=95; i+=5) { + if((i > 35) && (i < 60)) { + stroke(0); //Set color to black + } else { + stroke(255); //Set color to white + } + line(30, i, 80, i); +} + + + + +Compares two expressions and returns true only if both evaluate to true. Returns false if one or both evaluate to false. The following list shows all possible combinations:

true && false // Evaluates false because the second is false
false && true // Evaluates false because the first is false
true && true // Evaluates true because both are true
false && false // Evaluates false because both are false
+
+ + +expression1 && expression2 + + + + +any valid expression + + + + +any valid expression + + + + + +|| (logical OR) +! (logical NOT) +if() + + +1.0 + +Operator + +PDE + + + + + + + + +
diff --git a/mobile/web/reference/API/logicalNOT.xml b/mobile/web/reference/API/logicalNOT.xml new file mode 100644 index 000000000..cd96b7899 --- /dev/null +++ b/mobile/web/reference/API/logicalNOT.xml @@ -0,0 +1,60 @@ + + +! (logical NOT) + +Control + +Logical Operators + +Web & Application + + +logicalNOT.gif + +boolean a = false; +if (!a) { + rect(30, 20, 50, 50); +} +a = true; +if (a) { + line(20, 10, 90, 80); + line(20, 80, 90, 10); +} + + + + +Inverts the Boolean value of an expression. Returns true if the expression is false and returns false if the expression is true. If the expression (a>b) evaluates to true, then !(a>b) evaluates to false. + + + +!expression + + + + +any valid expression + + + + + +|| (logical OR) +&& (logical AND) +if() + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/logicalOR.xml b/mobile/web/reference/API/logicalOR.xml new file mode 100644 index 000000000..9c1067e83 --- /dev/null +++ b/mobile/web/reference/API/logicalOR.xml @@ -0,0 +1,61 @@ + + +|| (logical OR) + +Control + +Logical Operators + +Web & Application + + +logicalOR.gif + +for(int i=5 ; i<=95; i+=5) { + if((i < 35) || (i > 60)) { + line(30, i, 80, i); + } +} + + + + +Compares two expressions and returns true if one or both evaluate to true. Returns false only if both expressions are false. The following list shows all possible combinations:

true || false // Evaluates true because the first is true
false || true // Evaluates true because the second is true
true || true // Evaluates true because both are true
false || false // Evaluates false because both are false
+
+ + +expression1 || expression2 + + + + +any valid expression + + + + +any valid expression + + + + + +&& (logical AND) +! (logical NOT) +if() + + +1.0 + +Operator + +PDE + + + + + + + + +
diff --git a/mobile/web/reference/API/loop.xml b/mobile/web/reference/API/loop.xml new file mode 100644 index 000000000..e48ac9e48 --- /dev/null +++ b/mobile/web/reference/API/loop.xml @@ -0,0 +1,73 @@ + + +loop() + +Structure + + + +Web & Application + + + + + +void setup() { + size(200, 200); + noLoop(); +} + +float x = 0; + +void draw() { + background(204); + x = x + .1; + if (x > width) { + x = 0; + } + line(x, 0, x, height); +} + +void mousePressed() { + loop(); +} + +void mouseReleased() { + noLoop(); +} + + + + +Causes Processing to continuously execute the code within draw(). If noLoop() is called, the code in draw() stops executing. + + + +loop() + + + + + + + +None + + +noLoop() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/max.xml b/mobile/web/reference/API/max.xml new file mode 100644 index 000000000..e078e36b8 --- /dev/null +++ b/mobile/web/reference/API/max.xml @@ -0,0 +1,63 @@ + + +max() + +Math + +Calculation + +Web & Application + + + + +int a = max(5, 9); // Sets "a" to 9 +int b = max(-4, -12); // Sets "b" to -4 +float c = max(12.3, 230.24); // Sets "c" to 230.24 + + + + +Determines the largest value in a sequence of numbers. + + + +max(value1, value2) +max(value1, value2, value 3) + + + + +int or float + + + + +int or float + + + + +int or float + + +int or float (depending on the inputs) + + +min() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/millis.xml b/mobile/web/reference/API/millis.xml new file mode 100644 index 000000000..67190ca9a --- /dev/null +++ b/mobile/web/reference/API/millis.xml @@ -0,0 +1,60 @@ + + +millis() + +Input/Output + +Time & Date + +Web & Application + + +millis_.jar + +void loop() { + float m = millis(); + fill(m % 255); + rect(25, 25, 50, 50); +} + + + + +Returns the number of milliseconds (thousandths of a second) since starting an applet. This information is often used for timing animation sequences. + + + +millis() + + + + + + + +int + + +millis() +second() +minute() +hour() +day() +month() +year() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/min.xml b/mobile/web/reference/API/min.xml new file mode 100644 index 000000000..f5a76766c --- /dev/null +++ b/mobile/web/reference/API/min.xml @@ -0,0 +1,63 @@ + + +min() + +Math + +Calculation + +Web & Application + + + + +int d = min(5, 9); // Sets "d" to 5 +int e = min(-4, -12); // Sets "e" to -12 +float f = min(12.3, 230.24); // Sets "f" to 12.3 + + + + +Determines the smallest value in a sequence of numbers. + + + +min(value1, value2) +min(value1, value2, value 3) + + + + +int or float + + + + +int or float + + + + +int or float + + +int or float (depending on the inputs) + + +max() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/minus.xml b/mobile/web/reference/API/minus.xml new file mode 100644 index 000000000..9f551be7d --- /dev/null +++ b/mobile/web/reference/API/minus.xml @@ -0,0 +1,69 @@ + + +- (minus) + +Math + +Operators + +Web & Application + + + + +int c = 50 - 5; // Sets c to 45 +int d = c - 5; // Sets d to 40 +int e = d - 60; // Sets e to -20 + + + + + + +int a = 5; // Sets "a" to 5 +int b = -a; // Sets "b" to -5 +int c = -(5 + 3); // Sets "c" to -8 + + + + +Subtracts one value from another and may also be used to negate a value. As a subtraction operator, the value of the second parameter is subtracted from the first. For example, 5 - 3 yields the number 2. As a negation operator, it is equivalent to multiplying a number by -1. For example, -5 is the same as 5 * -1. + + + +-value1 +value1 - value2 + + + + +int or float + + + + +int or float + + + + + +-- (decrement) +-= (subtract assign) ++ (add) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/minute.xml b/mobile/web/reference/API/minute.xml new file mode 100644 index 000000000..bf20f3ab5 --- /dev/null +++ b/mobile/web/reference/API/minute.xml @@ -0,0 +1,64 @@ + + +minute() + +Input/Output + +Time & Date + +Web & Application + + +minute_.jar + +void loop() { + background(204); + int s = second(); // Values from 0 - 59 + int m = minute(); // Values from 0 - 59 + int h = hour(); // Values from 0 - 23 + line(s, 0, s, 33); + line(m, 33, m, 66); + line(h, 66, h, 100); +} + + + + +Processing communicates with the clock on your computer. The minute() function returns the current minute as a value from 0 - 59. + + + +minute() + + + + + + + +int + + +millis() +second() +minute() +hour() +day() +month() +year() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/modulo.xml b/mobile/web/reference/API/modulo.xml new file mode 100644 index 000000000..0325dd641 --- /dev/null +++ b/mobile/web/reference/API/modulo.xml @@ -0,0 +1,70 @@ + + +% (modulo) + +Math + +Operators + +Web & Application + + + + +int a = 20%100; // Sets a to 20 +int b = 20%100; // Sets b to 20 +int c = 75%100; // Sets c to 75 +int d = 275%100; // Sets d to 75 + + + + + + +float a = 0.0; +void loop() { + background(204); + a = (a + 0.5)%width; + line(a, 0, a, height); +} + + + + +Calculates the remainer when one number is divided by another. It is extremely useful for keeping numbers within a boundary such as keeping a shape on the screen. + + + +value1%value2 + + + + +int + + + + +int + + + + + +/ (divide) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/month.xml b/mobile/web/reference/API/month.xml new file mode 100644 index 000000000..86b72e988 --- /dev/null +++ b/mobile/web/reference/API/month.xml @@ -0,0 +1,73 @@ + + +month() + +Input/Output + +Time & Date + +Web & Application + + +month_.jar + +void setup() { + PFont metaBold; + metaBold = loadFont("fonts/Meta-Bold.vlw.gz"); + setFont(metaBold, 44); + hint(SMOOTH_IMAGES); +} + +void loop() { + int d = day(); // Values from 1 - 31 + int m = month(); // Values from 1 - 12 + int y = year(); // 2003, 2004, 2005, etc. + String s = String.valueOf(d); + text(s, 10, 28); + s = String.valueOf(m); + text(s, 10, 56); + s = String.valueOf(y); + text(s, 10, 84); +} + + + + +Processing communicates with the clock on your computer. The month() function returns the current month as a value from 1 - 12. + + + +month() + + + + + + + +int + + +millis() +second() +minute() +hour() +day() +month() +year() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/multilinecomment.xml b/mobile/web/reference/API/multilinecomment.xml new file mode 100644 index 000000000..a650d1eb1 --- /dev/null +++ b/mobile/web/reference/API/multilinecomment.xml @@ -0,0 +1,58 @@ + + +/* */ (multiline comment) + +Structure + + + +Web & Application + + + + +/* + Draws two lines which divides the window + into four quadrants. First draws a horizonal + line and then the vertical line +*/ +line(0, 50, 100, 50); +line(50, 0, 50, 100); + + + + +Explanatory notes embedded within the code. Comments are used to remind yourself and to inform others about the function of your program. Multiline comments are used for large text descriptions of code or to comment out chunks of code while debugging applications. Comments are ignored by the compiler + + + +/* + comment +*/ + + + + +any sequence of characters + + + + + +// (comment) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/multiply.xml b/mobile/web/reference/API/multiply.xml new file mode 100644 index 000000000..9d169690c --- /dev/null +++ b/mobile/web/reference/API/multiply.xml @@ -0,0 +1,57 @@ + + +* (multiply) + +Math + +Operators + +Web & Application + + + + +int e = 50 * 5; // Sets e to 250 +int f = e * 5; // Sets f to 1250 + + + + +Multiplies the values of the two parameters. Multiplication is equivalent to a sequence of addition. For example 5 * 4 is equivalent to 5 + 5 + 5 + 5. + + + +value1 * value2 + + + + +int, float, byte, or char + + + + +int, float, byte, or char + + + + + ++ (add) +/ (divide) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/new.xml b/mobile/web/reference/API/new.xml new file mode 100644 index 000000000..495d66e1c --- /dev/null +++ b/mobile/web/reference/API/new.xml @@ -0,0 +1,70 @@ + + +new + +Structure + + + +Web & Application + + + + +HLine h1 = new HLine(); +float[] speeds = new float[3]; +float ypos; + +void setup() { + size(200, 200); + speeds[0] = 0.1; + speeds[1] = 2.0; + speeds[2] = 0.5; +} + +void loop() { + ypos += speeds[int(random(3))]; + if (ypos > width) { + ypos = 0; + } + h1.update(ypos); +} + +class HLine { + void update(float y) { + line(0, y, width, y); + } +} + + + + +Dynamically creates an object. + + + +new + + + + + + + + + + +1.0 + +keyword + +PDE + +Extended + + + + + + + diff --git a/mobile/web/reference/API/nf.xml b/mobile/web/reference/API/nf.xml new file mode 100644 index 000000000..4865bb1a4 --- /dev/null +++ b/mobile/web/reference/API/nf.xml @@ -0,0 +1,86 @@ + + +nf() + +Data + +String Functions + +Web & Application + + + + +int a=200, b=40, c=90; +String sa = nf(a, 10); +println(sa); // prints "0000000200" +String sb = nf(b, 5); +println(sb); // prints "00040" +String sc = nf(c, 3); +println(sc); // prints "090" + +float d = 200.94, e = 40.2, f = 9.012; +String sd = nf(d, 10, 4); +println(sd); // prints "0000000200.9400" +String se = nf(e, 5, 3); +println(se); // prints "00040.200" +String sf = nf(f, 3, 5); +println(sf); // prints "009.01200" + + + + +Utility function for formatting numbers into strings. There are two versions, one for formatting floats and one for formatting ints. The values for the digits, left, and right parameters should always be positive integers. + + + +nf(intValue, digits) +nf(floatValue, left, right) + + + + +int: the number to format + + + + +int: number of digits to pad with zeroes + + + + +float: the number to format + + + + +int: number of digits to the left of the decimal point + + + + +int: number of digits to the right of the decimal point + + +String + + +nfs() +nfp() + + +1.0 + +Function + +Core + + +Extended + + + + + + diff --git a/mobile/web/reference/API/nfp.xml b/mobile/web/reference/API/nfp.xml new file mode 100644 index 000000000..2ff03e5c8 --- /dev/null +++ b/mobile/web/reference/API/nfp.xml @@ -0,0 +1,82 @@ + + +nfp() + +Data + +String Functions + +Web & Application + + + + +int a=200, b=-40, c=90; +String sa = nfp(a, 10); +println(sa); // prints "+0000000200" +String sb = nfp(b, 5); +println(sb); // prints "-00040" +String sc = nfp(c, 3); +println(sc); // prints "+090" + +float d = -200.94, e = 40.2, f = -9.012; +String sd = nfp(d, 10, 4); +println(sd); // prints "-0000000200.9400" +String se = nfp(e, 5, 3); +println(se); // prints "+00040.200" +String sf = nfp(f, 3, 5); +println(sf); // prints "-009.01200" + + + + +Utility function for formatting numbers into strings. Similar to nf() but puts a "+" in front of positive numbers and a "-" in front of negative numbers. There are two versions, one for formatting floats and one for formatting ints. The values for the digits, left, and right parameters should always be positive integers. + + + +nfp(intValue, digits) +nfp(floatValue, left, right) + + + + +int: the number to format + + + + +int: number of digits to pad with zeroes + + + + +float: the number to format + + + + +int: number of digits to the left of the decimal point + + + + +int: number of digits to the right of the decimal point + + +String + + +nfs() +nf() + + +1.0 + +Function + +Core + +Extended + + + diff --git a/mobile/web/reference/API/nfs.xml b/mobile/web/reference/API/nfs.xml new file mode 100644 index 000000000..dfc23af62 --- /dev/null +++ b/mobile/web/reference/API/nfs.xml @@ -0,0 +1,87 @@ + + +nfs() + +Data + +String Functions + +Web & Application + + + + +int a=200, b=-40, c=90; +String sa = nfs(a, 10); +println(sa); // prints " 0000000200" +String sb = nfs(b, 5); +println(sb); // prints "-00040" +String sc = nfs(c, 3); +println(sc); // prints " 090" + +float d = -200.94, e = 40.2, f = -9.012; +String sd = nfs(d, 10, 4); +println(sd); // prints "-0000000200.9400" +String se = nfs(e, 5, 3); +println(se); // prints " 00040.200" +String sf = nfs(f, 3, 5); +println(sf); // prints "-009.01200" + + + + +Utility function for formatting numbers into strings. Similar to nf() but leaves a blank space in front of positive numbers so they align with negative numbers in spite of the minus symbol. There are two versions, one for formatting floats and one for formatting ints. The values for the digits, left, and right parameters should always be positive integers. + + + +nfs(intValue, digits) +nfs(floatValue, left, right) + + + + +int: the number to format + + + + +int: number of digits to pad with zeroes + + + + +float: the number to format + + + + +int: number of digits to the left of the decimal point + + + + +int: number of digits to the right of the decimal point + + + +String or String[] + + +nf() +nfp() + + +1.0 + +Function + +Core + + +Extended + + + + + + diff --git a/mobile/web/reference/API/noFill.xml b/mobile/web/reference/API/noFill.xml new file mode 100644 index 000000000..79aff0eae --- /dev/null +++ b/mobile/web/reference/API/noFill.xml @@ -0,0 +1,44 @@ + + +noFill() + +Color + +Setting + +Web & Application + + +noFill_.gif + +rect(15, 10, 55, 55); +noFill(); +rect(30, 20, 55, 55); + + + + +Disables filling geometry. If both noStroke() and noFill() are called, nothing will be drawn to the screen. + + + +noFill() + + + + + + + +None + + +fill() + + +1.0 + +Function + +Core + diff --git a/mobile/web/reference/API/noLoop.xml b/mobile/web/reference/API/noLoop.xml new file mode 100644 index 000000000..ccc5d560d --- /dev/null +++ b/mobile/web/reference/API/noLoop.xml @@ -0,0 +1,73 @@ + + +noLoop() + +Structure + + + +Web & Application + + + + + +void setup() { + size(200, 200); + noLoop(); +} + +float x = 0; + +void draw() { + background(204); + x = x + .1; + if (x > width) { + x = 0; + } + line(x, 0, x, height); +} + +void mousePressed() { + loop(); +} + +void mouseReleased() { + noLoop(); +} + + + + +Stops Processing from continuously executing the code within draw(). If loop() is called, the code in draw() is executed continuously. + + + +noLoop() + + + + + + + +None + + +loop() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/noStroke.xml b/mobile/web/reference/API/noStroke.xml new file mode 100644 index 000000000..b3c9cb277 --- /dev/null +++ b/mobile/web/reference/API/noStroke.xml @@ -0,0 +1,51 @@ + + +noStroke() + +Color + +Setting + +Web & Application + + +noStroke_.gif + +noStroke(); +rect(30, 20, 55, 55); + + + + +Disables drawing the stroke (outline). If both noStroke() and noFill() are called, nothing will be drawn to the screen. + + + +noStroke() + + + + + + + +None + + +stroke() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/parentheses.xml b/mobile/web/reference/API/parentheses.xml new file mode 100644 index 000000000..b12f91304 --- /dev/null +++ b/mobile/web/reference/API/parentheses.xml @@ -0,0 +1,71 @@ + + +() (parentheses) + +Structure + + + +Web & Application + + + + +int a; +a = (4 + 3) * 2; // Grouping expressions +if (a > 10) { // Containing expressions + line(a, 0, a, 100); // Containing a list of parameters +} + + + + +Grouping and containing expressions and parameters. Parentheses have multiple functions relating to functions and structures. They are used to contain a list of parameters passed to functions and control structures and they are used to group expressions to control the order of execution. Some functions have no parameters and in this case, the space between parentheses is blank. + + + +function() +function(p1, ..., pN) +structure(expression) + + + + +any function + + + + +list of parameters specific to the function + + + + +Control structure such as if(), for(), while() + + + + +any valid expression or group of expression + + + + + +, (comma) + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/point.xml b/mobile/web/reference/API/point.xml new file mode 100644 index 000000000..38dc96592 --- /dev/null +++ b/mobile/web/reference/API/point.xml @@ -0,0 +1,64 @@ + + +point() + +Shape + +2D Primitives + +Web & Application + + +point_.gif + +point(30, 20); +point(85, 20); +point(85, 75); +point(30, 75); + + + + +A point is a coordinate in space. In Processing, points have a dimension of one pixel. The first parameter is the horizontal value for the point, the second value is the vertical value for the point, and the optional third value is the depth value. + + + +point(x1, y1); +point(x1, y1, z1); + + + + +int or float: x-coordinate of the point + + + + +int or float: y-coordinate of the point + + + + +int or float: z-coordinate of the point + + +None + + +beginShape() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/pow.xml b/mobile/web/reference/API/pow.xml new file mode 100644 index 000000000..03482b562 --- /dev/null +++ b/mobile/web/reference/API/pow.xml @@ -0,0 +1,58 @@ + + +pow() + +Math + +Calculation + +Web & Application + + + + +float a = pow( 1, 3); // Sets "a" to 1*1*1 = 1 +float b = pow( 3, 5); // Sets "b" to 3*3*3*3*3 = 243 +float c = pow( 3,-5); // Sets "c" to 1 / 3*3*3*3*3 = 1 / 243 = .0041 +float d = pow(-3, 5); // Sets "d" to -3*-3*-3*-3*-3 = -243 + + + + +Facilitates exponential expressions. The pow() function is an efficient way of multiplying numbers by themselves (or their reciprocal) in large quantities. For example, pow(3, 5) is equivalent to the expression 3*3*3*3*3 and pow(3, -5) is equivalent to 1 / 3*3*3*3*3. + + + +pow(base, exponent) + + + + +int or float: base of the exponential expression + + + + +int or float: power of which to raise the base + + +float + + +sqrt() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/print.xml b/mobile/web/reference/API/print.xml new file mode 100644 index 000000000..a1c5cd4f7 --- /dev/null +++ b/mobile/web/reference/API/print.xml @@ -0,0 +1,70 @@ + + +print() + +Input/Output + +Text Output + +IDE + + + + +print("begin- "); +float f = 0.3; +int i = 1024; +print("f is " + f + " and i is " + 1024); +String s = " -end"; +println(s); + +// The above code prints: +// begin- f is 0.3 and i is 1024 -end + + + + + + +float[] f = { 0.3, 0.4, 0.5 }; +print(f); + +// The above code prints: +// 0.30.40.5 + + + + + +Writes to the console area of the Processing environment. This is often helpful for looking at the data a program is producing. The companion function println() works like print(), but creates a new line of text for each call to the function. Individual elements can be separated with quotes ("") and joined with the addition operator (+) except when printing array data. + + + +print(data) + + + + +boolean, byte, char, color, int, float, String, boolean[], byte[], char[], color[], int[], float[], or String[] + + + + + +println() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/println.xml b/mobile/web/reference/API/println.xml new file mode 100644 index 000000000..a4834f2c7 --- /dev/null +++ b/mobile/web/reference/API/println.xml @@ -0,0 +1,72 @@ + + +println() + +Input/Output + +Text Output + +IDE + + + + +println("begin"); +float f = 0.3; +println("f is equal to " + f + " and i is equal to " + 1024); +String s = "end"; +println(s); + +// The above code prints the following lines: +// begin +// f is equal to 0.3 and i is equal to 1024 +// end + + + + + + +float[] f = { 0.3, 0.4, 0.5 }; +println(f); + +// The above code prints: +// 0.3 +// 0.4 +// 0.5 + + + + +Writes to the text area of the Processing environment's console. This is often helpful for looking at the data a program is producing. Each call to this function creates a new line of output. Individual elements can be separated with quotes ("") and joined with the string concatenation operator (+) except when printing array data. + + + +println(data) + + + + +boolean, byte, char, color, int, float, String, boolean[], byte[], char[], color[], int[], float[], or String[] + + +None + + +print() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/quad.xml b/mobile/web/reference/API/quad.xml new file mode 100644 index 000000000..b0b48f275 --- /dev/null +++ b/mobile/web/reference/API/quad.xml @@ -0,0 +1,83 @@ + + +quad() + +Shape + +2D Primitives + +Web & Application + + +quad_.gif + +quad(38, 31, 86, 20, 69, 63, 30, 76); + + + + +A quad is a quadrilateral, a four sided polygon. It is similar to a rectangle, but the angles between its edges are not constrained to ninety degrees. + + + +quad(x1, y1, x2, y2, x3, y3, x4, y4); + + + + +int or float: x-coordinate of the first corner + + + + +int or float: y-coordinate of the first corner + + + + +int or float: x-coordinate of the second corner + + + + +int or float: y-coordinate of the second corner + + + + +int or float: x-coordinate of the third corner + + + + +int or float: y-coordinate of the third corner + + + + +int or float: x-coordinate of the fourth corner + + + + +int or float: y-coordinate of the fourth corner + + +None + + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/random.xml b/mobile/web/reference/API/random.xml new file mode 100644 index 000000000..2e6e4387d --- /dev/null +++ b/mobile/web/reference/API/random.xml @@ -0,0 +1,71 @@ + + +random() + +Math + +Random + +Web & Application + + +random_.jar + +for(int i=0; i<100; i++) { + float r = random(50); + stroke(r*5); + line(50, i, 50+r, i); +} + + + + +random_2.jar + +for(int i=0; i<100; i++) { + float r = random(-50, 50); + stroke(abs(r*5)); + line(50, i, 50+r, i); +} + + + + +Generates random numbers. Each time the random() function is called, it returns an unexpected value within the specified range. If one parameter is passed to the function it will return a float between zero and the value of the parameter. The function call random(5) returns values between 0 and 5. If two parameters are passed, it will return a float with a value between the the parameters. The function call random(-5, 10.2) returns values between -5 and 10.2. To convert a floating-point random number to an integer, use the int() function. + + + +random(value1); +random(value1, value2); + + + + +int or float + + + + +int or float + + +float + + +noise() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/randomSeed.xml b/mobile/web/reference/API/randomSeed.xml new file mode 100644 index 000000000..dc32a543e --- /dev/null +++ b/mobile/web/reference/API/randomSeed.xml @@ -0,0 +1,58 @@ + + +randomSeed() + +Math + +Random + +Web & Application + + + + +randomSeed(0); +for(int i=0; i<100; i++) { + float r = random(0, 255); + stroke(r); + line(i, 0, i, 100); +} + + + + + +Sets the seed value for random(). By default, random() produces different results each time the program is run. Set the value parameter to a constant to return the same pseudo-random numbers each time the software is run. + + + +random(value); + + + + +int + + +None + + +random() +noise() +noiseSeed() + + +1.0 + +Function + +Core + + +Extended + + + + + + diff --git a/mobile/web/reference/API/rect.xml b/mobile/web/reference/API/rect.xml new file mode 100644 index 000000000..062065860 --- /dev/null +++ b/mobile/web/reference/API/rect.xml @@ -0,0 +1,66 @@ + + +rect() + +Shape + +2D Primitives + +Web & Application + + +rect_.gif + +rect(30, 20, 55, 55); + + + + +Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. The first two parameters set the location, the third sets the width, and the fourth sets the height. The origin is changed with the rectMode() function. + + + +rect(x, y, width, height); + + + + +int or float: x-coordinate of the rectangle + + + + +int or float: y-coordinate of the rectangle + + + + +int or float: width of the rectangle + + + + +int or float: height of the rectangle + + +None + + +rectMode() +quad() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/rectMode.xml b/mobile/web/reference/API/rectMode.xml new file mode 100644 index 000000000..1a027b16a --- /dev/null +++ b/mobile/web/reference/API/rectMode.xml @@ -0,0 +1,54 @@ + + +rectMode() + +Shape + +2D Primitives + +Web & Application + + +rectMode_.gif + +rectMode(CENTER); +rect(35, 35, 50, 50); +rectMode(CORNER); +fill(102); +rect(35, 35, 50, 50); + + + + +Modifies the location from which rectangles draw. The default mode is rectMode(CORNER), which specifies the location to be the upper left corner of the shape and uses the third and fourth parameters of rect() to specify the width and height. The syntax rectMode(CORNERS) uses the first and second parameters of rect() to set the location of one corner and uses the third and fourth parameters to set the opposite corner. The syntax rectMode(CENTER) draws the image from its center point and uses the third and forth parameters to rect() to specify the image's width and height. The parameter must be written in "ALL CAPS" because Processing is a case sensitive language. + + + +rectMode(MODE) + + + + +Either CORNER, CORNERS, CENTER + + +None + + +rect() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/red.xml b/mobile/web/reference/API/red.xml new file mode 100644 index 000000000..d84fb494f --- /dev/null +++ b/mobile/web/reference/API/red.xml @@ -0,0 +1,60 @@ + + +red() + +Color + +Creating & Reading + +Web & Application + + +red_.gif + +noStroke(); +color c = color(0, 126, 255); +fill(c); +rect(15, 20, 35, 60); +float value = red(c); // Sets "value" to "0" +fill(value); +rect(50, 20, 35, 60); + + + + +Extracts the red value from a color. + + + +red(color) + + + + +any value of the color datatype + + +float + + +green() +blue() +hue() +saturation() +brightness() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/redraw.xml b/mobile/web/reference/API/redraw.xml new file mode 100644 index 000000000..90f5c00fd --- /dev/null +++ b/mobile/web/reference/API/redraw.xml @@ -0,0 +1,61 @@ + + +redraw() + +Structure + + + +Web & Application + + + + + +float x = 0; + +void setup() { + size(200, 200); + noLoop(); +} + +void draw() { + background(204); + line(x, 0, x, height); +} + +void mousePressed() { + x += 1; + redraw(); +} + + + + +Causes Processing to execute the code within draw() one time. This gives control for updating the display window only when it's necessary. + + + +redraw() + + + + + + + +None + + +noLoop() +loop() + + +1.0 + +Function + +PDE + + + diff --git a/mobile/web/reference/API/return.xml b/mobile/web/reference/API/return.xml new file mode 100644 index 000000000..76f8f70d7 --- /dev/null +++ b/mobile/web/reference/API/return.xml @@ -0,0 +1,90 @@ + + +return + +Structure + + + +Web & Application + + + + +int val = 30; + +void draw() { + int t = timestwo(val); + println(t); +} + +int timestwo(int doubledVal) { + doubledVal = doubledVal * 2; + return doubledVal; +} + + + + + + +int[] vals = {10, 20, 30}; + +void draw() { + int[] t = timestwo(vals); + println(t); +} + +int[] timestwo(int[] doubledVals) { + for(int i=0; i<b.length; i++) { + b[i] = b[i] * 2; + } + return doubledVals; +} + + + + +Keyword used to indicate the value to return from a function. The value being returned must be the same datatype as defined in the function declaration. Functions declared with void can't return values and shouldn't include a return value. Functions can't include more than one return and the statement including return must be the last line in the function. + + + +type function { + statements + return value +} + + + + +boolean, byte, char, int, float, String, boolean[], byte[], char[], int[], float[], String[] + + + + +any function that is being defined + + + + +any valid statements + + + + +must be the same datatype as the type parameter + + + + + + + +1.0 + +Keyword + +PDE + + + diff --git a/mobile/web/reference/API/reverse.xml b/mobile/web/reference/API/reverse.xml new file mode 100644 index 000000000..04c758a25 --- /dev/null +++ b/mobile/web/reference/API/reverse.xml @@ -0,0 +1,50 @@ + + +reverse() + +Data + +Array Functions + +Web & Application + + + + +String sa[] = { "OH ", "NY ", "MA ", "CA "}; +sa = reverse(sa); +print(sa); // Prints "CA MA NY OH " + + + + +Reverses the order of an array. + + + +reverse(array) + + + + +booleans[], bytes[], chars[], ints[], floats[], or Strings[] + + +Array (the same datatype as the input) + + +sort() + + +1.0 + +Function + +Core + + +Extended + + + + diff --git a/mobile/web/reference/API/rightshift.xml b/mobile/web/reference/API/rightshift.xml new file mode 100644 index 000000000..bd47726f7 --- /dev/null +++ b/mobile/web/reference/API/rightshift.xml @@ -0,0 +1,71 @@ + + +>> (right shift) + +Math + +Bitwise Operators + +Web & Application + + + + +int m = 8 >> 3; // In binary: 1000 to 1 +println(m); // Prints "1" +int n = 256 >> 6; // In binary: 100000000 to 100 +println(n); // Prints "4" +int o = 16 >> 3; // In binary: 10000 to 10 +println(o); // Prints "2" +int p = 26 >> 1; // In binary: 11010 to 1101 +println(p); // Prints "13" + + + + + + +color argb = color(204, 204, 51, 255); +int a = argb >> 24 & 0xFF; +int r = argb >> 16 & 0xFF; // Faster way of getting red(argb) +int g = argb >> 8 & 0xFF; // Faster way of getting green(argb) +int b = argb & 0xFF; // Faster way of getting blue(argb) +fill(r, g, b, a); +rect(30, 20, 55, 55); + + + + +Shifts bits to the right. The number to the left of the operator is shifted the number of places specified by the number to the right. Each shift to the right halves the number, therefore each left shift divides the original number by 2. Use the right shift for fast divisions or to extract an individual number from a packed number. Right shifting only works with integers or numbers which automatically convert to an integer such at byte and char. + + + +value >> n + + + + +int: the value to shift + + + + +int: the number of places to shift right + + + + + +<< (left shift) + + +1.0 + +Operator + +PDE + +Extended + + + diff --git a/mobile/web/reference/API/saturation.xml b/mobile/web/reference/API/saturation.xml new file mode 100644 index 000000000..fd9c96e6c --- /dev/null +++ b/mobile/web/reference/API/saturation.xml @@ -0,0 +1,58 @@ + + +saturation() + +Color + +Creating & Reading + +Web & Application + + +saturation_.gif + +noStroke(); +colorMode(HSB, 255); +color c = color(0, 126, 255); +fill(c); +rect(15, 20, 35, 60); +float value = saturation(c); // Sets "value" to "126" +fill(value); +rect(50, 20, 35, 60); + + + + +Extracts the saturation value from a color. + + + +saturation(color) + + + + +any value of the color datatype + + +float + + +red() +green() +blue() +hue() +brightness() + + +1.0 + +Function + +Core + +Extended + + + + diff --git a/mobile/web/reference/API/saveBytes.xml b/mobile/web/reference/API/saveBytes.xml new file mode 100644 index 000000000..9bd438b54 --- /dev/null +++ b/mobile/web/reference/API/saveBytes.xml @@ -0,0 +1,60 @@ + + +saveBytes() + +Input/Output + +Files + +Application + + + + +byte[] nums = { 0, 34, 5, 127, 52}; + +// now write the bytes to a file +saveBytes("numbers.txt", nums); + + + + +Opposite of loadBytes(), will write an entire array of bytes to a file. This file is saved to the sketch's folder, which is opened by selecting "Show sketch folder" from the "Sketch" menu. + + + +saveBytes(filename, bytes) + + + + +name of file to write to + + + + +array of bytes to be written + + +None + + +loadStrings() +loadBytes() +saveStrings() + + +1.0 + +Function + +Core + +Extended + + + + + + + diff --git a/mobile/web/reference/API/saveStrings.xml b/mobile/web/reference/API/saveStrings.xml new file mode 100644 index 000000000..4e79e156f --- /dev/null +++ b/mobile/web/reference/API/saveStrings.xml @@ -0,0 +1,61 @@ + + +saveStrings() + +Input/Output + +Files + +Application + + + + +String words = "apple bear cat dog"; +String list[] = splitStrings(words); + +// now write the strings to a file, each on a separate line +saveStrings("nouns.txt", list); + + + + +Writes an array of strings to a file, one line per string. This file is saved to the sketch's folder, which is opened by selecting "Show sketch folder" from the "Sketch" menu. + + + +saveStrings(filename, strings) + + + + +filename for output + + + + +string array to be written + + + + + +loadStrings() +loadBytes() +saveBytes() + + +1.0 + +Function + +Core + + +Extended + + + + + + diff --git a/mobile/web/reference/API/second.xml b/mobile/web/reference/API/second.xml new file mode 100644 index 000000000..9831bce81 --- /dev/null +++ b/mobile/web/reference/API/second.xml @@ -0,0 +1,64 @@ + + +second() + +Input/Output + +Time & Date + +Web & Application + + +second_.jar + +void loop() { + background(204); + int s = second(); // Values from 0 - 59 + int m = minute(); // Values from 0 - 59 + int h = hour(); // Values from 0 - 23 + line(s, 0, s, 33); + line(m, 33, m, 66); + line(h, 66, h, 100); +} + + + + +Processing communicates with the clock on your computer. The second() function returns the current second as a value from 0 - 59. + + + +second + + + + + + + +int + + +millis() +second() +minute() +hour() +day() +month() +year() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/semicolon.xml b/mobile/web/reference/API/semicolon.xml new file mode 100644 index 000000000..3ab159655 --- /dev/null +++ b/mobile/web/reference/API/semicolon.xml @@ -0,0 +1,52 @@ + + +; (semicolon) + +Structure + + + +Web & Application + + + + +int a; // Declaration statement +a = 30; // Assignment statement +println(i); // Function statement + + + + +A statement terminator which separates elements of the program. A statement is a complete instruction to the computer and the semicolon is used to separate instructions (this is similar to the period "." in written English). Semicolons are also used to separate the different elements of a for() structure. + + + +statement; + + + + +a single statement to execute + + + + + +for() + + +1.0 + +Operator + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/setup.xml b/mobile/web/reference/API/setup.xml new file mode 100644 index 000000000..10c6f9525 --- /dev/null +++ b/mobile/web/reference/API/setup.xml @@ -0,0 +1,64 @@ + + +setup() + +Structure + + + +Web & Application + + + + +void setup() { + size(200, 200); + background(0); + noStroke(); + fill(102); +} + +int a = 0; + +void draw() { + rect(a++%width, 10, 2, 80); +} + + + + +Function called once when the program begins running. Used to define initial enviroment properties such as screen size, background color, loading images, etc. before the draw() begins executing. Variables declared within setup() are not accessible within draw(). + + + +void setup() { + statements +} + + + + +any valid statements + + +None + + +loop() +size() + + +1.0 + +Processing Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/shorten.xml b/mobile/web/reference/API/shorten.xml new file mode 100644 index 000000000..190d273bc --- /dev/null +++ b/mobile/web/reference/API/shorten.xml @@ -0,0 +1,52 @@ + + + +shorten() + +Data + +Array Functions + +Web & Application + + + + +String sa1[] = { "OH ", "NY ", "CA "}; +String sa2[] = shorten(sa1); +print(sa1); // Prints "OH NY " +println(); +sa2 = shorten(sa2); +print(sa2); // Prints "OH " + + + + +Decreases an array by one element and returns the shortened array. + + + +append(array) + + + + +boolean[], byte[], char[], int[], float[], or String[] + + +Array (the same datatype as the input) + + +append() +expand() + + +1.0 + +Function + +Core + +Extended + + diff --git a/mobile/web/reference/API/slice.xml b/mobile/web/reference/API/slice.xml new file mode 100644 index 000000000..57cd50fca --- /dev/null +++ b/mobile/web/reference/API/slice.xml @@ -0,0 +1,64 @@ + + + + +slice() + +Data + +Array Functions + +Web & Application + + + + +String sa1[] = { "OH ", "NY ", "CA ", "VA ", "CO ", "IL "}; +String sa2[] = slice(sa1, 1); +print(sa2); // Prints "NY CA VA CO IL " +println(); +String sa3[] = slice(sa1, 2, 3); +print(sa3); // Prints "CA VA CO " + + + + +Extracts an array of elements from an existing array. The array parameter defines the array from which the elements will be copied and the offset and length parameters determine which elements to extract. If no length is given, elements will be extracted from the offset to the end of the array. When specifying the offset remember the first array element is 0. This function does not change the source array. + + + +slice(array, offset) +slice(array, offset, length) + + + + +booleans[], bytes[], chars[], ints[], floats[], or Strings[]: base array + + + + +int: position to begin + + + + +int: number of values to extract + + +Array (the same datatype as the input) + + +splice() + + +1.0 + +Function + +Core + +Extended + + + diff --git a/mobile/web/reference/API/sort.xml b/mobile/web/reference/API/sort.xml new file mode 100644 index 000000000..784233c3b --- /dev/null +++ b/mobile/web/reference/API/sort.xml @@ -0,0 +1,66 @@ + + +sort() + +Data + +Array Functions + +Web & Application + + + + +float a[] = { 3.4, 3.6, 2, 0, 7.1 }; +sort(a); +for (int i = 0; i < a.length; i++) { + println(a[i]); +} + + + + + + +String s[] = { "deer", "elephant", "bear", "apple", "car" }; +sort(s); +for (int i = 0; i < s.length; i++) { + println(s[i]); +} + + + + +Sorts an array of numbers from smallest to largest and puts an array of words in alphabetical order. + + + +sort(array) + + + + +String[], int[], or float[] + + + + + +reverse() + + +1.0 + +Function + +Core + + +Extended + + + + + + + diff --git a/mobile/web/reference/API/splice.xml b/mobile/web/reference/API/splice.xml new file mode 100644 index 000000000..1d3e87614 --- /dev/null +++ b/mobile/web/reference/API/splice.xml @@ -0,0 +1,71 @@ + + + + +splice() + +Data + +Array Functions + +Web & Application + + + + +String sa1[] = { "OH ", "NY ", "CA "}; +sa1 = splice(sa1, "KY ", 1); +print(sa1); // Prints "OH KY NY CA " +println(); +String sa2[] = { "VA ", "CO ", "IL " }; +sa1 = splice(sa1, sa2, 2); +print(sa1); // Prints "OH KY VA CO IL NY CA " + + + + +Inserts a value or array of values into an existing array. The first two parameters must be of the same datatype. The array parameter defines the array which will be modified and the second parameter defines the data which will be inserted. + + + +splice(array, value, index) +splice(array, array2, index) + + + + +booleans[], bytes[], chars[], ints[], floats[], or Strings[]: base array + + + + +booleans, bytes, chars, ints, floats, or Strings: value to be spliced in + + + + +booleans[], bytes[], chars[], ints[], floats[], Strings[]: array to be spliced in + + + + +int: position in the array from which to insert data + + +Array (the same datatype as the input) + + +contract() +slice() + + +1.0 + +Function + +Core + +Extended + + + diff --git a/mobile/web/reference/API/split.xml b/mobile/web/reference/API/split.xml new file mode 100644 index 000000000..29aa64e3d --- /dev/null +++ b/mobile/web/reference/API/split.xml @@ -0,0 +1,72 @@ + + +split() + +Data + +String Functions + +Web & Application + + + + +String numbers = "Putin Yeltsin Gorbachev"; +String list[] = split(numbers); +// list[0] is now Putin, list[1] is now Yeltsin, ... + + + + + + +String numbers = "Chernenko,Andropov,Brezhnev"; +String list[] = splitInts(numbers, ','); +// list[0] is now Chernenko, list[1] is Andropov, ... + + + + + + +String numbers = "8 67 5 309"; +int list[] = int(splitInts(numbers)); +// list[0] is now 8, list[1] is now 67, ... + + + + +A utility function which separates a series of data embedded into a String into an array of Strings. The delim parameter specifies the character or characters which mark the boundaries between each data element. If no delim character is specified, a whitespace character is used as the split character. Whitespace characters include tab (\t), line feed (\n), carriage return (\r), and form feed (\f), and space. To convert a String to an array of integers or floats, use the datatype conversion functions int() and float() to convert the array of Strings (see example above). + + + +split(str) +split(str, delim) + + + + +the string to be split + + + + +the character or String used to separate the data + + +String[] + + +join() + + +1.0 + +Function + +Core + +Extended + + + diff --git a/mobile/web/reference/API/sq.xml b/mobile/web/reference/API/sq.xml new file mode 100644 index 000000000..d585be5d5 --- /dev/null +++ b/mobile/web/reference/API/sq.xml @@ -0,0 +1,56 @@ + + +sq() + +Math + +Calculation + +Web & Application + + +sq_.gif + +noStroke(); +float a = sq(1); // Sets a to 1 +float b = sq(-5); // Sets b to 25 +float c = sq(9); // Sets c to 81 +rect(0, 25, a, 10); +rect(0, 45, b, 10); +rect(0, 65, c, 10); + + + + +Squares a number (multiplies a number by itself). The result is always a positive number, as multiplying two negative numbers always yields a positive result. For example, -1 * -1 = 1. + + + +sq(value) + + + + +int or float + + +float + + +sqrt() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/sqrt.xml b/mobile/web/reference/API/sqrt.xml new file mode 100644 index 000000000..bfa434fd6 --- /dev/null +++ b/mobile/web/reference/API/sqrt.xml @@ -0,0 +1,57 @@ + + +sqrt() + +Math + +Calculation + +Web & Application + + +sqrt_.gif + +noStroke(); +float a = sqrt(6561); // Sets a to 81 +float b = sqrt(625); // Sets b to 25 +float c = sqrt(1); // Sets c to 1 +rect(0, 25, a, 10); +rect(0, 45, b, 10); +rect(0, 65, c, 10); + + + + +Calculates the square root of a number. The square root of a number is always positive, even though there may be a valid negative root. The square root s of number a is such that s*s = a. It is the opposite of squaring. + + + +sqrt(value) + + + + +int or float: non-negative number + + +float + + +pow() +sq() + + +1.0 + +Function + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/strconvert.xml b/mobile/web/reference/API/strconvert.xml new file mode 100644 index 000000000..382539989 --- /dev/null +++ b/mobile/web/reference/API/strconvert.xml @@ -0,0 +1,58 @@ + + + +str() + +Data + +Conversion + +Web & Application + + + + +boolean b = false; +byte y = -28; +char c = 'R'; +float f = -32.6; +int i = 1024; + +String sb = str(b); +String sy = str(y); +String sc = str(c); +String sf = str(f); +String si = str(i); + +sb = sb + sy + sc + sf + si + sh; + +println(sb); // Prints 'false-28R-32.61024' + + + + +Returns the string representation of primitive datatypes and arrays. For example the integer 3 will return the string "3", the float -12.6 will return the string "-12.6", and a boolean value true will return the string "true". + + + +str(data) + + + + +boolean, byte, char, float, int, boolean[], byte[], char[], float[], int[] + + +String or String[] + + + + +1.0 + +Function + +Core + + + diff --git a/mobile/web/reference/API/stroke.xml b/mobile/web/reference/API/stroke.xml new file mode 100644 index 000000000..09f4678cf --- /dev/null +++ b/mobile/web/reference/API/stroke.xml @@ -0,0 +1,82 @@ + + +stroke() + +Color + +Setting + +Web & Application + + +stroke_.gif + +stroke(153); +rect(30, 20, 55, 55); + + + + +stroke_2.gif + +stroke(204, 102, 0); +rect(30, 20, 55, 55); + + + + +Sets the stroke color which is the color used to draw lines and borders around shapes. This color is either specified in terms of the RGB or HSB color depending on the current colorMode(). The default color space is RGB, with each value in the range from 0 to 255. The version of stroke() with one parameter specifies a gray value, the version with three parameters specifies a color, and the version with four parameters specifies a color with an alpha value. Note: the value for the parameter "gray" must be less than or equal to the current maximum value as specified by colorMode(). The default value is 255. + + + +stroke(gray) +stroke(value1, value2, value3); +stroke(color); + + + + +int or float: specifies a value between white and black + + + + +int or float: red or hue value (depending on the current color mode) + + + + +int or float: green or saturation value (depending on the current color mode) + + + + +int or float: blue or brightness value (depending on the current color mode) + + + + +color: any value of the color datatype + + +None + + +noStroke() +colorMode() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/subtractassign.xml b/mobile/web/reference/API/subtractassign.xml new file mode 100644 index 000000000..3454df63e --- /dev/null +++ b/mobile/web/reference/API/subtractassign.xml @@ -0,0 +1,52 @@ + + +-= (subtract assign) + +Math + +Operators + +Web & Application + + + + +int a = 50; +int b = 23; +a -= b; // sets "a" to 27 + + + + +Combines subtraction with assignment. The expression a -= b is equivalent to a = a - b. + + + +value1 -= value2 + + + + +int or float + + + + +int or float + + + + ++= (add assign) +- (minus) + + +1.0 + +Operator + +Core + + + + diff --git a/mobile/web/reference/API/switch.xml b/mobile/web/reference/API/switch.xml new file mode 100644 index 000000000..e6ec70964 --- /dev/null +++ b/mobile/web/reference/API/switch.xml @@ -0,0 +1,118 @@ + + +switch() + +Control + +Conditionals + +Web & Application + + + + +int num = 1; + +switch(num) { + case 0: + println("Zero"); // Does not execute + break; + case 1: + println("One"); // Prints "One" + break; +} + + + + + + +char letter = 'N'; + +switch(letter) { + case 'A': + println("Alpha"); // Does not execute + break; + case 'B': + println("Bravo"); // Does not execute + break; + default: // Default executes if the case labels + println("None"); // don't match the switch parameter + break; +} + + + + + + +// Removing a "break" enables testing +// for more than one value at once + +char letter = 'b'; + +switch(letter) { + case 'a': + case 'A': + println("Alpha"); // Does not execute + break; + case 'b': + case 'B': + println("Bravo"); // Prints "Bravo" + break; +} + + + + + +Works like an if else structure, but switch() is more convenient when you need to select between three or more alternatives. Program controls jumps to the case with the same value as the expression. All remaining statements in the switch are executed unless redirectly by a break. Only primitive datatypes which can convert to an integer (byte, char, and int) may be used as the expression parameter. The default is optional. + + + +switch(expression) +{ + case label: + statements + case label: // Optional + statements // " + default: // " + statements // " +} + + + + +byte, char, or int + + + + +byte, char, or int + + + + +one or more statements to be executed + + + + + +case +default +break +if() +else + + +1.0 + +Function + +Java + +extended + + + diff --git a/mobile/web/reference/API/triangle.xml b/mobile/web/reference/API/triangle.xml new file mode 100644 index 000000000..2eaf663be --- /dev/null +++ b/mobile/web/reference/API/triangle.xml @@ -0,0 +1,75 @@ + + +triangle() + +Shape + +2D Primitives + +Web & Application + + +triangle_.gif + +triangle(30, 75, 58, 20, 86, 75); + + + + +A triangle is a plane created by connecting three points. The first two arguments specify the first point, the middle two arguments specify the second point, and the last two arguments specify the third point. + + + +triangle(x1, y1, x2, y2, x3, y3); + + + + +int or float: x-coordinate of the first point + + + + +int or float: y-coordinate of the first point + + + + +int or float: x-coordinate of the second point + + + + +int or float: y-coordinate of the second point + + + + +int or float: x-coordinate of the third point + + + + +int or float: y-coordinate of the third point + + +None + + +beginShape() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/trim.xml b/mobile/web/reference/API/trim.xml new file mode 100644 index 000000000..78fa28281 --- /dev/null +++ b/mobile/web/reference/API/trim.xml @@ -0,0 +1,47 @@ + + +trim() + +Data + +String Functions + +Web & Application + + + + +String s = " Somerville MA "; +println(s); // Prints " Somerville MA " +String s2 = trim(s); +println(s2); // Prints "Somerville MA" + + + + +Removes whitespace characters from the beginning and end of a String. In addition to standard whitespace characters such as space, carriage return, and tab, this function also removes the Unicode "nbsp" character. + + + +trim(str) + + + + +any String + + +String + + + + +1.0 + +Function + +Core + +Extended + + diff --git a/mobile/web/reference/API/true.xml b/mobile/web/reference/API/true.xml new file mode 100644 index 000000000..ad8425956 --- /dev/null +++ b/mobile/web/reference/API/true.xml @@ -0,0 +1,56 @@ + + +true + +Structure + + + +Web & Application + + + + +rect(30, 20, 50, 50); +boolean b = true; +if(b == true) { + line(20, 10, 90, 80); // This line draws +} else { + line(20, 80, 90, 10); +} + + + + +Reserved word representing the logical value "true". Only variables of type boolean may be assigned the value true + + + +false + + + + + + + + + +any valid statements + + + + + +false +boolean + + +1.0 + +Keyword + +PDE + + + diff --git a/mobile/web/reference/API/vertex.xml b/mobile/web/reference/API/vertex.xml new file mode 100644 index 000000000..3771e7338 --- /dev/null +++ b/mobile/web/reference/API/vertex.xml @@ -0,0 +1,101 @@ + + +vertex() + +Shape + +Vertex + +Application & Web + + +vertex_.gif + +beginShape(POINTS); +vertex(30, 20); +vertex(85, 20); +vertex(85, 75); +vertex(30, 75); +endShape(); + + + + +vertex_2.gif + +noStroke(); +BImage a = loadImage("arch.jpg"); +beginShape(); +texture(a); +// "arch.jpg" is 100x100 pixels in size so +// the values 0 and 100 are used for the +// parameters "u" and "v" to map it directly +// to the vertex points +vertex(10, 20, 0, 0); +vertex(80, 5, 100, 0); +vertex(95, 90, 100, 100); +vertex(40, 95, 0, 100); +endShape(); + + + + +All shapes are constructed by connecting a series of vertices. vertex() is used to specify the vertex coordinates for points, lines, triangles, quads, and polygons and is used exclusively within the beginShape() and endShape() function. This function is also used to map a texture onto the geometry. The texture() function declares the texture to apply to the geometry and the u and v coordinates set define the mapping of this texture to the form. By default, the coordinates used for u and v are specified in relation to the image's size in pixels, but this relation can be changed with textureMode(). + + + +vertex(x, y); +vertex(x, y, z); +vertex(x, y, u, v); +vertex(x, y, z, u, v); + + + + +int or float: x-coordinate of the vertex + + + + +int or float: y-coordinate of the vertex + + + + +int or float: z-coordinate of the vertex + + + + +int or float: horizontal coordinate for the texture mapping + + + + +int or float: vertical coordinate for the texture mapping + + +None + + +beginShape() +endShape() +bezierVertex() +curveVertex() +texture() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/void.xml b/mobile/web/reference/API/void.xml new file mode 100644 index 000000000..ce60eeecc --- /dev/null +++ b/mobile/web/reference/API/void.xml @@ -0,0 +1,61 @@ + + +void + +Structure + + + +Web & Application + + + + +void setup() { + size(200, 200); +} + +void loop() { + line(10, 100, 190, 100); +} + + + + +Keyword used indicate a function returns no value. Each function must either return a value of a specific datatype or use the keyword void to specify the function returns nothing. + + + +void function { + statements +} + + + + +any function that is being defined or implemented + + + + +any valid statements + + + + + + +1.0 + +Keyword + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/while.xml b/mobile/web/reference/API/while.xml new file mode 100644 index 000000000..b93434f27 --- /dev/null +++ b/mobile/web/reference/API/while.xml @@ -0,0 +1,61 @@ + + +while() + +Control + +Iteration + +Web & Application + + +while_.gif + +int i=0; +while(i<80) { + line(30, i, 80, i); + i = i + 5; +} + + + + +Controls a sequence of repetitions. The while structure executes a series of statements continuously while the expression is true. The expression must be updated during the repetitions or the program will never "break out" of while(). + + + +while(expression) { + statements +} + + + + +a valid expression + + + + +one or more statements + + + + + +for() + + +1.0 + +Structure + +PDE + + + + + + + + + diff --git a/mobile/web/reference/API/width.xml b/mobile/web/reference/API/width.xml new file mode 100644 index 000000000..6fe6e71ed --- /dev/null +++ b/mobile/web/reference/API/width.xml @@ -0,0 +1,54 @@ + + +width + +Environment + + + +Web & Application + + +width.gif + +noStroke(); +background(0); +rect(0, 40, width, 20); +rect(0, 60, width/2, 20); + + + + +System variable which stores the width of the display window. This value is set by the first parameter of the size() function. For example, the function call size(320, 240) sets the width variable to the value 320. The value of width is zero until size() is called. + + + + +width + + + + + + + + + + +height + + +1.0 + +System variable + +Core + + + + + + + + + diff --git a/mobile/web/reference/API/year.xml b/mobile/web/reference/API/year.xml new file mode 100644 index 000000000..5fb6060d0 --- /dev/null +++ b/mobile/web/reference/API/year.xml @@ -0,0 +1,74 @@ + + +year() + +Input/Output + +Time & Date + +Web & Application + + +year_.jar + +void setup() { + PFont metaBold; + metaBold = loadFont("fonts/Meta-Bold.vlw.gz"); + setFont(metaBold, 44); + hint(SMOOTH_IMAGES); +} + +void loop() { + int d = day(); // Values from 1 - 31 + int m = month(); // Values from 1 - 12 + int y = year(); // 2003, 2004, 2005, etc. + String s = String.valueOf(d); + text(s, 10, 28); + s = String.valueOf(m); + text(s, 10, 56); + s = String.valueOf(y); + text(s, 10, 84); +} + + + + + +Processing communicates with the clock on your computer. The year() function returns the current year as an integer (2003, 2004, 2005, etc). + + + +year() + + + + + + + +int + + +millis() +second() +minute() +hour() +day() +month() +year() + + +1.0 + +Function + +Core + + + + + + + + + diff --git a/mobile/web/reference/index.php b/mobile/web/reference/index.php new file mode 100644 index 000000000..529d8af6b --- /dev/null +++ b/mobile/web/reference/index.php @@ -0,0 +1,113 @@ + array(), + 'Environment' => array(), + 'Data' => array('Primitive' => array(), + 'Composite' => array(), + 'Conversion' => array(), + 'String Functions' => array(), + 'Array Functions' => array()), + 'Control' => array('Relational Operators' => array(), + 'Iteration' => array(), + 'Conditionals' => array(), + 'Logical Operators' => array()), + 'Shape' => array('2D Primitives' => array(), + 'Curves' => array(), + '3D Primitives' => array(), + 'Stroke attributes' => array(), + 'Vertex' => array()), + 'Input/Output' => array('Mouse' => array(), + 'Keyboard' => array(), + 'Time & Date' => array(), + 'Text Output' => array(), + 'Files' => array(), + 'Web' => array()), + 'Color' => array('Setting' => array(), + 'Creating & Reading' => array()), + /* + 'Image' => array('PImage' => array(), + 'Loading & Displaying' => array(), + 'Pixels' => array()), + 'Typography' => array('PFont' => array(), + 'Loading & Displaying' => array()), + */ + 'Math' => array('Operators' => array(), + 'Bitwise Operators' => array(), + 'Calculation' => array(), + 'Trigonometry' => array(), + 'Random' => array()), +); + +$PAGE_TITLE = "Processing Mobile Language"; +require '../header.inc.php'; + +$total = 0; + +$dir = opendir('API'); +$filename = readdir($dir); +while ($filename !== false) { + $filename = readdir($dir); + if (strstr($filename, '.xml') !== false) { + $dom = @domxml_open_file('API/' . $filename); + + $shortname = substr($filename, 0, strlen($filename) - 4); + + $name = $dom->get_elements_by_tagname('name'); + $name = trim($name[0]->get_content()); + + $cat = $dom->get_elements_by_tagname('category'); + $cat = trim($cat[0]->get_content()); + + $subcat = $dom->get_elements_by_tagname('subcategory'); + $subcat = trim($subcat[0]->get_content()); + + $categories[$cat][$subcat][] = $shortname."\n".$name; + + $total++; + } +} + +?> +
+  +
+ + + + +
This reference is a work in progress. The descriptions have been copied from the Processing project and have not yet been updated to reflect the additional constraints of Processing Mobile.
+
+
+ + $entry) { ?> +
+
+ $e) { ?> + 0) { ?> + + +
+ + + + "> + +
+ +
+ + +
+
+ ($total / 4)) { ?> + +
+
+ + +
+ \ No newline at end of file diff --git a/mobile/web/reference/reference.php b/mobile/web/reference/reference.php new file mode 100644 index 000000000..3d3c3293f --- /dev/null +++ b/mobile/web/reference/reference.php @@ -0,0 +1,127 @@ +> Language (API)"; +$PAGE_SHOWBACKINDEX = true; + +require '../header.inc.php'; + +$dom = @domxml_open_file("API/{$_GET['name']}.xml"); +$root = $dom->document_element(); +$value = array(); +$child = $root->first_child(); + +while ($child) { + $tag = $child->node_name(); + if (($tag == 'example') || ($tag == 'parameter')) { + if (!isset($value[$tag])) { + $value[$tag] = array(); + } + $subvalue = array(); + $gchild = $child->first_child(); + while ($gchild) { + $gtag = $gchild->node_name(); + $content = trim($gchild->get_content()); + if ($content != "") { + $subvalue[$gtag] = $content; + } + + $gchild = $gchild->next_sibling(); + } + $value[$tag][] = $subvalue; + } else if ($tag[0] == '#') { + //// skip + } else { + $content = trim($child->get_content()); + if ($content != "") { + $value[$tag] = $content; + } + } + + $child = $child->next_sibling(); +} +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name +

+
Examples + + + + + + + + + +
+ + + + + + +  
+
+ +
Description + +
Syntax +
+
Parameters + + + + + + + + +
 
+
Usage + +
+ diff --git a/mobile/web/settings.inc.php b/mobile/web/settings.inc.php new file mode 100644 index 000000000..fdc0d8109 --- /dev/null +++ b/mobile/web/settings.inc.php @@ -0,0 +1,5 @@ + \ No newline at end of file