load processing.js sketch with ajax on user click

本小妞迷上赌 提交于 2019-12-03 21:15:59

We only check the data-processing-sources attribute on DOMContentLoaded. If you want to load a Processing sketch after that, you could use Processing.loadSketchFromSources, which is what Processing.js uses internally to load a sketch:

$('#clicker').click(function(){
  var canvasRef = document.createElement('canvas');
  var p = Processing.loadSketchFromSources(canvasRef, ['/uploads/processing_js/anything_1.pde']);
  $('#loader').append(canvasRef);
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!