save code
This commit is contained in:
parent
a57be83351
commit
721c967ac8
@ -7,6 +7,10 @@ canvas {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*main{
|
||||||
|
height: 300px;
|
||||||
|
}*/
|
||||||
.content {
|
.content {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
@ -2,14 +2,12 @@ import './App.css';
|
|||||||
import ImageCanvas from './imageCanvas'
|
import ImageCanvas from './imageCanvas'
|
||||||
|
|
||||||
const App = () => (
|
const App = () => (
|
||||||
<main>
|
|
||||||
<ImageCanvas
|
<ImageCanvas
|
||||||
scrollHeight={3500}
|
scrollHeight={3500}
|
||||||
width={1440}
|
width={1440}
|
||||||
height={1440}
|
height={1440}
|
||||||
numFrames={241}
|
numFrames={240}
|
||||||
/>
|
/>
|
||||||
</main>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
@ -52,9 +52,11 @@ const ImageCanvas = ({scrollHeight, numFrames, width, height}) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(frameIndex == 241) return
|
||||||
|
|
||||||
const context = canvasRef.current.getContext("2d");
|
const context = canvasRef.current.getContext("2d");
|
||||||
let requestId;
|
let requestId;
|
||||||
|
console.log(frameIndex)
|
||||||
const render = () => {
|
const render = () => {
|
||||||
context.drawImage(images[frameIndex], 0, 0);
|
context.drawImage(images[frameIndex], 0, 0);
|
||||||
requestId = requestAnimationFrame(render);
|
requestId = requestAnimationFrame(render);
|
||||||
|
Loading…
Reference in New Issue
Block a user