html5 - Processing.js : reading information from file -


i have processing sketch in read coordinates file:

float[][] points = new float[243][3];  void setup() {   size(500, 500, p3d);   background(255);   camera(100, 50, 150, 0, 0, 0, 0, -1, 0);   string lines[] = loadstrings("1xd3coordsknot");    (int = 0; < lines.length; i++) {     string[] list = split(lines[i], " ");     float x = float.parsefloat(list[0]);     float y = float.parsefloat(list[1]);     float z = float.parsefloat(list[2]);     points[i][0] = x;     points[i][1] = y;     points[i][2] = z;   }  }  void draw() {   background(50);   lights();    //the 3d lines here   (int = 0; < 242; i++) {     line(points[i][0],points[i][1],points[i][2],points[i+1][0],points[i+1][1],points[i+1][2]);     stroke(255);     strokeweight(2);   }  } 

it works fine when run within processing. trying embed web page. lines not drawn in case. javascript console gave me error saying files coordinates read not found in root directory of html file, copied there. not display sketch @ all, , gives me following error: referenceerror: can't find variable: float.

the html follows:

<!doctype html> <html> <head> <meta charset="utf-8"> <script src="js/processing.min.js"></script> </head> <body>     <canvas data-processing-sources="pde/1xd3.pde"></canvas> </body> </html> 

what wrong here?

try

parsefloat(list[0]); 

instead of

float.parsefloat(); 

it should job! :)


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -