Wednesday, March 23, 2016

Setting up ProcessingJS

ProcessingJS is very easy to set up. I'll be using the Javascript mode, because that's the same one Khan Academy provides and I'm used to it.
Just drop this on your webpage and you're ready to roll:

<script src=""></script>
<canvas id="processingJS canvas"></canvas>
    var sketchProc = function(processingInstance) {
     with (processingInstance) {
        size(400, 400);
        // ProgramCodeGoesHere
        draw = function () {
            ellipse(mouseX, mouseY, 10, 10);

    // Get the canvas that ProcessingJs will use
    var canvas = document.getElementById("processingJS canvas");
    var processingInstance = new Processing(canvas, sketchProc);

Want to see it working? Sure, you're the boss :)

No comments:

Post a Comment