JSFiddle - React, Tailwind, and code Playground
by BenEllis
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.min.js"></script>
CSS
html, body {
margin: 0;
padding: 0;
background: #555;
}
JavaScript
"use strict";var Dw=function(c){const e={LIBRARY:"p5.EasyCam",VERSION:"1.0.9",AUTHOR:"Thomas Diewald",SOURCE:"https://github.com/diwi/p5.EasyCam",toString:function(){return this.LIBRARY+" v"+this.VERSION+" by "+this.AUTHOR+" ("+this.SOURCE+")"}};class f{constructor(n,o){if(!(n instanceof p5.RendererGL))return void console.log("renderer needs to be an instance of p5.RendererGL");o=o||{},void 0===o.distance&&(o.distance=500),void 0===o.center&&(o.center=[0,0,0]),void 0===o.rotation&&(o.rotation=k.identity()),void 0===o.viewport&&(o.viewport=[0,0,n.width,n.height]),this.INFO=e,this.setCanvas(n);var p=this;this.cam=p,this.LOOK=[0,0,1],this.UP=[0,1,0],this.AXIS=new function(){this.YAW=1,this.PITCH=2,this.ROLL=4,this.ALL=this.YAW|this.PITCH|this.ROLL},this.SHIFT_CONSTRAINT=0,this.FIXED_CONSTRAINT=0,this.DRAG_CONSTRAINT=0,this.scale_rotation=1e-3,this.scale_pan=2e-4,this.scale_zoom=1e-3,this.scale_zoomwheel=20,this.distance_min_limit=0.01,this.distance_min=1,this.distance_max=Number.MAX_VALUE,this.state={distance:o.distance,center:o.center.slice(),rotation:o.rotation.slice(),copy:function(q){return q=q||{},q.distance=this.distance,q.center=this.center.slice(),q.rotation=this.rotation.slice(),q}},this.state_reset=this.state.copy(),this.state_pushed=this.state.copy(),this.viewport=o.viewport.slice(),this.mouse={cam:p,curr:[0,0,0],prev:[0,0,0],dist:[0,0,0],mwheel:0,isPressed:!1,istouchdown:!1,ismousedown:!1,BUTTON:{LMB:1,MMB:2,RMB:4},button:0,mouseDragLeft:p.mouseDragRotate.bind(p),mouseDragCenter:p.mouseDragPan.bind(p),mouseDragRight:p.mouseDragZoom.bind(p),mouseWheelAction:p.mouseWheelZoom.bind(p),touchmoveSingle:p.mouseDragRotate.bind(p),touchmoveMulti:function(){p.mouseDragPan(),p.mouseDragZoom()},insideViewport:function(q,r){var u=p.viewport[0],v=u+p.viewport[2],A=p.viewport[1],B=A+p.viewport[3];return q>u&&q<v&&r>A&&r<B},solveConstraint:function(){var...