Я пытаюсь выполнить несколько эскизов на той же странице.
init сценарий указывает что:
/*
* This code searches for all the <script type="application/processing" target="canvasid">
* in your page and loads each script in the target canvas with the proper id.
* It is useful to smooth the process of adding Processing code in your page and starting
* the Processing.js engine.
*/
Когда я указываю целевой холст каждого эскиза, он не работает:
<script type="application/processing" target="canvas1">..</script>
<script type="application/processing" target="canvas2">..</script>
<canvas id="canvas1".. />
<canvas id="canvas2".. />
но это не работает? это даже возможно? Любая справка очень ценилась бы. Я пытаюсь иметь документ со встроенными элементами холста, работающими эскизы в синхронизации друг с другом.
Получил работу, установив идентификаторы для тегов script и canvas:
<script type="application/processing" id="script1">..</script>
<script type="application/processing" id="script2">..</script>
<canvas id="canvas1" width="200px" height="200px"></canvas>
<canvas id="canvas2" width="200px" height="200px"></canvas>
<script>
canvas1 = document.getElementById("canvas1");
script1 = document.getElementById("script1").text;
canvas2 = document.getElementById("canvas2");
script2 = document.getElementById("script2").text;
Processing(canvas1, script1);
Processing(canvas2, script2);
</script>