xxxxxxxxxx
38
function setup() {
createCanvas(650, 550);
overflow('hidden');
background(50);
writeTeX();
}
function writeTeX() {
let equation = createTeX(
"{\\displaystyle \\mathrm {H} (X)=-\\sum _{i=1}^{n}{\\mathrm {P} (x_{i})\\log \\mathrm {P} (x_{i})}}"
);
equation.position(20, 175);
equation.size(48);
equation.stroke(color('rgb(135, 206, 235)'));
equation.fill(color('rgb(135, 206, 235)'));
equation.play("createFill", 0, 2.5);
//hi.moveTo(width, height/4, 2, 3)
// let world = createText("world!", width/3, height/2.5);
// world.size(68);
// world.fill(color(119, 198, 110));
// world.play("createFill", 1, 2);
// world.play("spinOut", 2, 2.4);
// //world.moveTo(-width/2, height/2.5, 2, 3)
// let p5teach = createText("I'm p5.teach", width/4, height/3);
// p5teach.size(48);
// p5teach.fill(color("rgb(246, 164, 184)"));
// p5teach.play("write", 2.5, 3);
// p5teach.resizeTo(72, 3, 4)
// p5teach.moveTo(15, height/4, 3, 4)
}