{ "patcher" : { "fileversion" : 1, "rect" : [ 279.0, 44.0, 758.0, 806.0 ], "bgcolor" : [ 0.933333, 0.933333, 0.933333, 1.0 ], "bglocked" : 0, "defrect" : [ 279.0, 44.0, 758.0, 806.0 ], "openrect" : [ 0.0, 0.0, 0.0, 0.0 ], "openinpresentation" : 0, "default_fontsize" : 12.0, "default_fontface" : 0, "default_fontname" : "Arial", "gridonopen" : 0, "gridsize" : [ 15.0, 15.0 ], "gridsnaponopen" : 0, "toolbarvisible" : 1, "boxanimatetime" : 200, "imprint" : 0, "enablehscroll" : 1, "enablevscroll" : 1, "devicewidth" : 0.0, "boxes" : [ { "box" : { "maxclass" : "comment", "text" : "(quiet)", "numinlets" : 1, "patching_rect" : [ 525.0, 510.0, 150.0, 20.0 ], "numoutlets" : 0, "id" : "obj-23", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"\nfunction draw() {}\n\"", "linecount" : 3, "numinlets" : 2, "patching_rect" : [ 405.0, 510.0, 105.0, 46.0 ], "numoutlets" : 1, "id" : "obj-10", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "draw() is called on each screen update.", "presentation_rect" : [ 406.0, 464.0, 0.0, 0.0 ], "numinlets" : 1, "patching_rect" : [ 360.0, 465.0, 245.0, 20.0 ], "numoutlets" : 0, "id" : "obj-3", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"\nfunction draw() {\n fs.cmd(['model rnd xyz', \n Math.random()*320, Math.random()*480, 0,\n Math.random()*320, Math.random()*480, 0,\n ].join(' '));\n}\"", "linecount" : 7, "presentation_rect" : [ 138.0, 473.0, 0.0, 0.0 ], "numinlets" : 2, "patching_rect" : [ 75.0, 465.0, 264.0, 101.0 ], "numoutlets" : 1, "id" : "obj-1", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "Message box is not the ideal javascript editor. Notice the careful placement of spaces and quotes:", "linecount" : 2, "numinlets" : 1, "patching_rect" : [ 105.0, 1065.0, 285.0, 34.0 ], "numoutlets" : 0, "id" : "obj-54", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "number", "numinlets" : 1, "patching_rect" : [ 405.0, 1050.0, 50.0, 20.0 ], "numoutlets" : 2, "id" : "obj-13", "fontname" : "Arial", "outlettype" : [ "int", "bang" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"circle('foo', \" $1 \") ;\"", "numinlets" : 2, "patching_rect" : [ 405.0, 1080.0, 130.0, 18.0 ], "numoutlets" : 1, "id" : "obj-8", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"log('yes, it works.');\"", "numinlets" : 2, "patching_rect" : [ 150.0, 285.0, 132.0, 18.0 ], "numoutlets" : 1, "id" : "obj-89", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "toggle", "numinlets" : 1, "patching_rect" : [ 180.0, 1185.0, 20.0, 20.0 ], "numoutlets" : 1, "id" : "obj-83", "outlettype" : [ "int" ] } } , { "box" : { "maxclass" : "message", "text" : "opengl $1", "numinlets" : 2, "patching_rect" : [ 180.0, 1215.0, 63.0, 18.0 ], "numoutlets" : 1, "id" : "obj-81", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "If you turn opengl off and on, javascript is stopped until next js or jsurl command.", "linecount" : 2, "numinlets" : 1, "patching_rect" : [ 90.0, 1245.0, 232.0, 34.0 ], "numoutlets" : 0, "id" : "obj-69", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "(Go to pinktwins.com for the LP.)", "numinlets" : 1, "patching_rect" : [ 510.0, 1140.0, 185.0, 20.0 ], "numoutlets" : 0, "id" : "obj-65", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "Images!", "numinlets" : 1, "patching_rect" : [ 645.0, 1110.0, 52.0, 20.0 ], "numoutlets" : 0, "id" : "obj-63", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"fs.cmd('model bg image http://pinktwins.com/fantastick/pt4m.jpg'); fs.cmd('model bg scale 0.6125 0.5 1.0');\"", "numinlets" : 2, "patching_rect" : [ 45.0, 1110.0, 595.0, 18.0 ], "numoutlets" : 1, "id" : "obj-43", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "Here's what the circle.js file looks like:", "numinlets" : 1, "patching_rect" : [ 180.0, 825.0, 221.0, 20.0 ], "numoutlets" : 0, "id" : "obj-45", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "a way to draw circles!", "numinlets" : 1, "patching_rect" : [ 405.0, 735.0, 272.0, 20.0 ], "numoutlets" : 0, "id" : "obj-39", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "model foo position 160 240", "numinlets" : 2, "patching_rect" : [ 240.0, 765.0, 155.0, 18.0 ], "numoutlets" : 1, "id" : "obj-38", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"circle( 'foo', 150 )\"", "numinlets" : 2, "patching_rect" : [ 270.0, 735.0, 122.0, 18.0 ], "numoutlets" : 1, "id" : "obj-36", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "jsurl will fetch and evaluate a javascript file.", "numinlets" : 1, "patching_rect" : [ 405.0, 705.0, 272.0, 20.0 ], "numoutlets" : 0, "id" : "obj-33", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "jsurl http://pinktwins.com/fantastick/circle.js", "numinlets" : 2, "patching_rect" : [ 150.0, 705.0, 239.0, 18.0 ], "numoutlets" : 1, "id" : "obj-32", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"\nvar circle = function(name, radius) {\n var xyz = [];\n var i;\n for(i=0; i<=63; i++) {\n xyz.push(Math.sin(i / 10.0) * radius);\n xyz.push(Math.cos(i / 10.0) * radius);\n xyz.push(0);\n }\n\n var s = 'model ' + name + ' xyz ' + xyz.join(' ');\n fs.cmd(s);\n fs.cmd('model ' + name + ' render line_loop');\n};\n\"", "linecount" : 15, "numinlets" : 2, "patching_rect" : [ 405.0, 825.0, 260.0, 211.0 ], "numoutlets" : 1, "id" : "obj-5", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "That's all.", "numinlets" : 1, "patching_rect" : [ 345.0, 1365.0, 86.0, 20.0 ], "numoutlets" : 0, "id" : "obj-30", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "accelerometer 0.", "numinlets" : 2, "patching_rect" : [ 405.0, 645.0, 100.0, 18.0 ], "numoutlets" : 1, "id" : "obj-29", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "accelerometer 0.1", "numinlets" : 2, "patching_rect" : [ 405.0, 615.0, 107.0, 18.0 ], "numoutlets" : 1, "id" : "obj-28", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "accel(x, y, z) is called on accelerometer update.", "numinlets" : 1, "patching_rect" : [ 405.0, 585.0, 272.0, 20.0 ], "numoutlets" : 0, "id" : "obj-26", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "touch(type, x, y, id) is called on touch input.", "numinlets" : 1, "patching_rect" : [ 300.0, 345.0, 245.0, 20.0 ], "numoutlets" : 0, "id" : "obj-21", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"\nfunction accel(x, y, z) {\n fs.cmd('model p position 0 ' + -y * 200.0 + ' 0');\n}\"", "linecount" : 4, "numinlets" : 2, "patching_rect" : [ 75.0, 585.0, 272.0, 60.0 ], "numoutlets" : 1, "id" : "obj-53", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"\nfunction touch(type, x, y, id) {\n var a = x+Math.random()*200-100;\n var b = y+Math.random()*200-100;\n var xy = [x, y, 0, a, b, 0];\n fs.cmd('model r xyz ' + xy.join(' '));\n}\"", "linecount" : 7, "numinlets" : 2, "patching_rect" : [ 75.0, 345.0, 211.0, 101.0 ], "numoutlets" : 1, "id" : "obj-51", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "Or use whatever. This is javascript, after all.", "numinlets" : 1, "patching_rect" : [ 300.0, 255.0, 245.0, 20.0 ], "numoutlets" : 0, "id" : "obj-20", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"var log = fs.send; log('Me too!');\"", "numinlets" : 2, "patching_rect" : [ 90.0, 255.0, 201.0, 18.0 ], "numoutlets" : 1, "id" : "obj-19", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "Use fs.send(); to send data to Max --------->", "numinlets" : 1, "patching_rect" : [ 300.0, 225.0, 245.0, 20.0 ], "numoutlets" : 0, "id" : "obj-18", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "newobj", "text" : "print raw", "numinlets" : 1, "patching_rect" : [ 555.0, 255.0, 57.0, 20.0 ], "numoutlets" : 0, "id" : "obj-17", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "newobj", "text" : "r rawFantaStick", "numinlets" : 0, "patching_rect" : [ 555.0, 225.0, 94.0, 20.0 ], "numoutlets" : 1, "id" : "obj-16", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"fs.send('Hey you found me!');\"", "numinlets" : 2, "patching_rect" : [ 105.0, 225.0, 186.0, 18.0 ], "numoutlets" : 1, "id" : "obj-15", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "Evaluate javascript on iDevice with the 'js' command. Use fs.cmd(); to run Fantastick commands.", "linecount" : 2, "numinlets" : 1, "patching_rect" : [ 300.0, 180.0, 303.0, 34.0 ], "numoutlets" : 0, "id" : "obj-14", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "newobj", "text" : "s toFantaStick", "numinlets" : 1, "hidden" : 1, "patching_rect" : [ 45.0, 810.0, 87.0, 20.0 ], "numoutlets" : 0, "id" : "obj-12", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : "js \"fs.cmd('model p xyz 0 240 0 320 240 0');\"", "numinlets" : 2, "patching_rect" : [ 45.0, 180.0, 246.0, 18.0 ], "numoutlets" : 1, "id" : "obj-11", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "js support only works with OpenGL.", "linecount" : 2, "numinlets" : 1, "patching_rect" : [ 300.0, 120.0, 150.0, 34.0 ], "numoutlets" : 0, "id" : "obj-9", "fontname" : "Arial", "fontsize" : 12.0 } } , { "box" : { "maxclass" : "message", "text" : ";\rtoFantaStick opengl 1", "linecount" : 2, "numinlets" : 2, "patching_rect" : [ 165.0, 120.0, 127.0, 32.0 ], "numoutlets" : 1, "id" : "obj-7", "fontname" : "Arial", "outlettype" : [ "" ], "fontsize" : 12.0 } } , { "box" : { "maxclass" : "comment", "text" : "FantastickJS", "numinlets" : 1, "patching_rect" : [ 45.0, 30.0, 239.0, 27.0 ], "numoutlets" : 0, "id" : "obj-4", "fontname" : "Arial", "fontsize" : 18.0 } } , { "box" : { "maxclass" : "comment", "text" : "Open the FS help patch for the iDevice connection. Requires FS version 1.9 or later.", "numinlets" : 1, "patching_rect" : [ 45.0, 60.0, 498.0, 20.0 ], "numoutlets" : 0, "id" : "obj-2", "fontname" : "Arial", "fontsize" : 12.0 } } ], "lines" : [ { "patchline" : { "source" : [ "obj-10", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-1", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-11", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-15", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-16", 0 ], "destination" : [ "obj-17", 0 ], "hidden" : 0, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-19", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-51", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-53", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-28", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-29", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-5", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-32", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-36", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-38", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-43", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-83", 0 ], "destination" : [ "obj-81", 0 ], "hidden" : 0, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-81", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-89", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-8", 0 ], "destination" : [ "obj-12", 0 ], "hidden" : 1, "midpoints" : [ ] } } , { "patchline" : { "source" : [ "obj-13", 0 ], "destination" : [ "obj-8", 0 ], "hidden" : 0, "midpoints" : [ ] } } ] } }