new idler resize

This commit is contained in:
2023-01-01 16:04:57 -05:00
parent 56851bc93a
commit e0bae8ce1e

View File

@@ -1,10 +1,10 @@
import Sketch from "react-p5"; import Sketch from "react-p5";
import React from "react"; import React from "react";
const balls = []; const balls = [];
const density = 0.00005; const density = 0.00005;
const screenWidth = window.innerWidth + 100; let screenWidth = window.innerWidth + 10;
const screenHeight = window.innerHeight + 100; let screenHeight = window.innerHeight + 10;
export default class Idler extends React.Component { export default class Idler extends React.Component {
setup = (p5, parentRef) => { setup = (p5, parentRef) => {
@@ -54,7 +54,19 @@ export default class Idler extends React.Component {
} }
}; };
render() { render() {
return <Sketch setup={this.setup} draw={this.draw} style={{position: 'fixed', zIndex:-1}}/>; const windowResized = (p5) => {
p5.resizeCanvas(p5.windowWidth, p5.windowHeight);
screenWidth = window.innerWidth + 10;
screenHeight = window.innerHeight + 10;
};
return (
<Sketch
windowResized={windowResized}
setup={this.setup}
draw={this.draw}
style={{ position: "fixed", zIndex: -69 }}
/>
);
} }
} }