JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://raw.githubusercontent.com/GoodBoyDigital/pixi.js/master/bin/pixi.min.js"></script>
JavaScript
var stage = new PIXI.Container();
var renderer = PIXI.autoDetectRenderer(800, 600);
document.body.appendChild(renderer.view);
var polyVert4 = new PIXI.Polygon([0, 0, 100, 0, 100, 100, 0, 100]);
var polyVert5 = new PIXI.Polygon([0, 0, 100, 0, 100, 100, 50, 150, 0, 100]);
stage.addChild(Polygon(polyVert4, 200, 200));
stage.addChild(Polygon(polyVert5, 400, 200));
requestAnimationFrame( animate );
function animate() {
requestAnimationFrame( animate );
// Render the stage.
renderer.render(stage);
}
function Polygon (polygon, x, y, props) {
var graphics = new PIXI.Graphics();
graphics.clear();
graphics.beginFill('0xEE82EE', .5);
graphics.lineStyle(2, '0x008000', 0.67);
graphics.drawPolygon(polygon.points);
graphics.endFill();
graphics.position.x = x;
graphics.position.y = y;
return graphics;
};