@@ -88,44 +88,23 @@ function display()
8888 {
8989 $ html = "\n<div class= \"example \"> " ; // BEGIN example div
9090
91- // This code is the from the Processing.js export from Processing 200
92- /**
93- <div>
94- <canvas id="Distance1D" data-processing-sources="Distance1D.pde" width="640" height="360">
95-
96- <p>Your browser does not support the canvas tag.</p>
97- <!-- Note: you can put any alternative content here. -->
98- </canvas>
99- <noscript>
100- <p>JavaScript is required to view the contents of this page.</p>
101- </noscript>
102- </div>
103- */
104-
105- // This code is my attempt to generalize the code from Processing 200
106- /**
107- $html .= '<div>';
108- $html .= ' <canvas id="' . $this->name . '" data-processing-sources="' . $this->name . '.pde"';
109- $html .= 'width="640" height="360">';
110- $html .= ' <p>Your browser does not support the canvas tag.</p>';
111- $html .= ' </canvas>';
112- $html .= ' <noscript>';
113- $html .= ' <p>JavaScript is required to view the contents of this page.</p>';
114- $html .= ' </noscript>';
115- $html .= '</div>';
116- */
117-
118- // This code is based on the example style on ProcessingJS.org
119- $ html .= '<script type="application/processing"> ' ;
91+ // Insert the p5 version of the example into the page
92+
93+ //Container for example
94+ $ html = "\n<div class= \"p5container \"></div> " ;
95+
96+ //Script tag for example
97+ $ html .= '<script type="text/javascript"> ' ;
12098 $ html .= $ this ->fullcode ;
121- $ html .= '</script><canvas width="640" height="360"></canvas> ' ;
99+ $ html .= '</script> ' ;
122100
123-
101+ //Description
124102 $ html .= "\n<p class= \"doc \"> " ;
125103 $ html .= nl2br ($ this ->doc );
126104 #$html .= $this->doc;
127105 $ html .= "</p> \n" ;
128106
107+ //Raw code from Processing (not p5) version
129108 $ html .= "\n<pre class= \"code \"> \n" ;
130109 $ html .= $ this ->code ;
131110 $ html .= "</pre> \n\n" ;
0 commit comments