xxxxxxxxxx
28
var sketch3d = function( sketch ) {
sketch.setup = function() {
let canvas3d = sketch.createCanvas(100, 100, sketch.WEBGL);
canvas3d.parent('#sketch1');
}
sketch.draw = function() {
with(sketch) {
background(100);
noStroke()
rotateX(sketch.frameCount * 0.01);
rotateZ(sketch.frameCount * 0.01);
cone(30, 50);
}
}
};
new p5(sketch3d);
function setup(){
canvas= createCanvas(100, 100);
canvas.position(0,0);
}
function draw() {
clear();
rect(width/2-5,height/2-5,10,10);
}