processing.js loading external files

后端 未结 4 1088
旧巷少年郎
旧巷少年郎 2021-01-15 13:06

I want to split my processing.js code into several files but I\'m not sure how. I tried doing



        
相关标签:
4条回答
  • 2021-01-15 13:42

    I know this has already been answered, but I thought I'd add some more explanation:

    The problem with your initial approach is that the browser does not know what to do with a file of type "application/processing", so it is never even pulled from the server. The init() package that TML posted looks for these and pulls them by means of XHR.

    0 讨论(0)
  • 2021-01-15 13:42

    You can initialize Processing with a canvas and a string of source in JS.

    Processing(canvas, sourceString)

    That string could come from anywhere outside the current file.

    0 讨论(0)
  • 2021-01-15 13:45

    Processing.js can run code from an external file like so...

    <script src="processing.js"></script>
    <canvas datasrc="yourSketch.pjs" width="200" height="200"></canvas>
    
    0 讨论(0)
  • 2021-01-15 13:46

    Try http://www.hyper-metrix.com/misc/Processing.AJAX.init.zip

    0 讨论(0)
提交回复
热议问题