processing-p5-convert

source code translator that converts Processing Java code to p5.js Javascript code

Home Minimal_example Command_line Notes About Project

(tests) hello bounce grid bounce_with_class cat hello_font hello_sound explode bounce_vectors hello_3d

(live conversion tests) phyllotaxis dandelin dogfooding

(student project tests) cow_game cross_the_road dinosaur_game greenhouse_game

hello_3d

Transformations:

Converted p5.js:

//
// hello_3d
//
function setup() {
    createCanvas(400, 400, WEBGL);
}
function draw() {
    translate(-width / 2, -height / 2);
    background(0);
    lights();
    fill(0, 255, 0);
    stroke(0);
    push();
    translate(100, 100, 0);
    rotateZ(frameCount * 0.01);
    rotateX(frameCount * 0.01);
    rotateY(frameCount * 0.01);
    box(70, 70, 70);
    pop();
    while (true) {
        push();
        translate(300, 300, 0);
        rotateZ(frameCount * 0.01);
        rotateX(frameCount * 0.01);
        rotateY(frameCount * 0.01);
        sphere(70);
        pop();
        break;
    }
}

Original Processing:

//
// hello_3d
//


void setup()
{
    size(400, 400, P3D); 
}


void draw()
{
    background(0);
    lights();

    fill(0, 255, 0);
    stroke(0);

    pushMatrix();
    translate(100, 100, 0);
    rotateZ(frameCount * 0.01);
    rotateX(frameCount * 0.01);
    rotateY(frameCount * 0.01);
    box(70, 70, 70);
    popMatrix();

    while (true) {
    pushMatrix();
    translate(300, 300, 0);
    rotateZ(frameCount * 0.01);
    rotateX(frameCount * 0.01);
    rotateY(frameCount * 0.01);
    sphere(70);
    popMatrix();
    break;
    }
}
home