stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

1h 16m 55s logged

Slider!! Today I added a slider that controls the adding and removing of pillars. I had some minor problems. (No, they were huge, but I feel better saying that they were minor :xxd: ). First of all, I needed to figure out how to set default values. Normally its just value=””, but this doesnt work for a input type range. After some research I found out that its simply defaultValue, I feel dumb. Then I tried to add/remove pillars with useEffect and monitor the changes of the slider. This worked, but also didnt. I needed to manually update the pillars. It didnt do it automatically. Then my brain suggested something genius. Using onChange. But now I need to do an extra function for it. I thought, maybe I use a while loop once. While the number array is smaller run add function and while its bigger, the remove function. This was uhh, not that good, because it somehow resulted into an infinite while loop, because js is asynchronous. I also tried with a for loop. This threw the error, that I set the 2 useState too often. After some experimenting I ended up with my current solution. I also added 2 useState variables for the sorting delay and shuffling delay. I am still searching for a great mathematical, anti-proportional, linear function to adjust it corresponding to the pillars count. Ahh and I also updated the camera adjusting logic a bit.

0
10

Comments 0

No comments yet. Be the first!