save code

This commit is contained in:
canzit 2023-01-16 10:59:02 +03:00
parent a57be83351
commit 721c967ac8
3 changed files with 8 additions and 4 deletions

View File

@ -7,6 +7,10 @@ canvas {
margin: auto;
display: block;
}
/*main{
height: 300px;
}*/
.content {
position: relative;
padding: 20px;

View File

@ -2,14 +2,12 @@ import './App.css';
import ImageCanvas from './imageCanvas'
const App = () => (
<main>
<ImageCanvas
scrollHeight={3500}
width={1440}
height={1440}
numFrames={241}
numFrames={240}
/>
</main>
);
export default App;

View File

@ -52,9 +52,11 @@ const ImageCanvas = ({scrollHeight, numFrames, width, height}) => {
return;
}
if(frameIndex == 241) return
const context = canvasRef.current.getContext("2d");
let requestId;
console.log(frameIndex)
const render = () => {
context.drawImage(images[frameIndex], 0, 0);
requestId = requestAnimationFrame(render);