+ 2

How to clear canvas (THREE.js)

I'm making a THREE.js code, but when rotating the cube, they constantly overlap. I don't have a context so I can't do clearRect(window.innerWidth, window.innerHeight). How can I stop it from happening? Calviղ Do know Three.js? Sorry for asking, it's been unanswered for ages now. https://code.sololearn.com/W657UCYw3Fm8/?ref=app

29th Jun 2020, 3:21 PM
Clueless Coder
Clueless Coder - avatar
6 odpowiedzi
+ 1
I tried to understand your game code. Based on my canvas experience, I think you should not run create method on every animated frame, it should run once. And I created another method, draw for animate the x y rotation. My method maybe not correct, I never write any three.js code before. https://code.sololearn.com/WVyrnZyqhSEb/?ref=app
30th Jun 2020, 10:02 AM
Calviղ
Calviղ - avatar
+ 2
Clueless Coder Thanks for the recommendation, I learned the OOP way to setup threes.js from your code now, I think theee.js is a great library, make me want to build some 3d games now.
30th Jun 2020, 1:06 PM
Calviղ
Calviղ - avatar
+ 2
Calviղ It's very active as well. It has a ton of books, videos, examples and a great documentation to learn from.
30th Jun 2020, 1:12 PM
Clueless Coder
Clueless Coder - avatar
+ 1
Calviղ Thanks for the help. I definitely would recommend it, it a step up from p5WEBGL and a step down from regular WEBGL
30th Jun 2020, 10:11 AM
Clueless Coder
Clueless Coder - avatar
- 3
hih
30th Jun 2020, 12:25 PM
Naiir Naiir
Naiir Naiir - avatar