PixiJS Cubic Bezier
by ShukantPal
HTML
<canvas id="view"></canvas>
JavaScript
import * as PIXI from "https://cdnjs.cloudflare.com/ajax/libs/pixi.js/8.3.4/pixi.mjs";
async function main() {
const app = new PIXI.Application();
await app.init({
autoStart: false,
autoDensity: true,
backgroundColor: 'white',
canvas: document.getElementById("view"),
height: 120,
resolution: devicePixelRatio,
width: 160,
});
const graphics = new PIXI.Graphics();
graphics.moveTo(10, 80);
graphics.bezierCurveTo(
40, 40,
80, 120,
120, 80,
);
graphics.fill({ color: 0 });
graphics.stroke({ color: 0xff, width: 1 });
app.stage.addChild(graphics);
app.render();
}
main();