r/reactjs • u/Ray-Marcher • May 02 '21
Show /r/reactjs Trigonometric Function Visualizer, my first project in ReactJS!
40
u/ashkanahmadi May 02 '21
That's so dope. Good job.
I will definitely dig through your code to figure out how things were done.
Thank you for sharing.
8
u/ashkanahmadi May 02 '21
I just noticed something not working correctly (I guess).
I think it has to do with the labels and htmlFor tags. Under Unit Circle Details, when I click on Degrees, the Axes checkbox is toggles. The same thing with Pie and Function Signs.
4
u/patprint May 02 '21
I noticed this as well. /u/Ray-Marcher it looks like you have two checkbox inputs within a single label tag, which is the problem.
6
3
May 02 '21
I'm impressed by the simplicity. I do think adding multiple drawers was a bold move.
Bugs:
Closing one of the drawers closes both of the drawers. Seems unintentional as the transition for the drawer you didn't click is scuffed in this case.
When clicking on the canvas outside of the unit circle. The previous selected angle persists on the unit circle but the left drawer's state is cleared.
Do you have any comments on canvas performance?
2
u/Ray-Marcher May 02 '21
Yeah I'm aware of that bug and am still trying to figure out a fix for it. The library I used for those was react-burger-menu and it wasn't really designed to support more than one menu on the screen at any point. Even getting two to show at once required a bit of hacking.
Will look into that, thanks.
In terms of canvas performance it suited my needs perfectly, I didn't notice any performance issues. Worth noting though that what it's rendering isn't particularly complex. I've got another project I've started on to render 3D functions and canvas also works really well for it. I was originally considering WebGL but I think for that I'm also going to stick to just using the canvas for the sake of having simpler code.
2
u/wildework May 02 '21
Love this kind of stuff! What did you do before React?
7
u/Ray-Marcher May 02 '21
I've been programming for 10 years now so I've worked in a lot of languages and paradigms but React was my first time thinking with component oriented programming. It was really easy to get into and makes a lot of sense in terms of web development, will definitely be using it over plain JavaScript from now on.
2
2
u/MasterSheaf May 02 '21
It looks like the green hypotenuse length isn't being calculated correctly in the lower two quadrants. Seems ok on top though.
This is really great. Very nice work.
1
4
2
2
2
2
2
2
2
2
u/namtp185 May 02 '21
Good work, bro. I found a small bug that I can't delete last character in the input. You should handle the input in empty case, not only the degree between 0 and 360 degree
2
2
2
2
2
2
2
2
2
u/random__stranger__ May 02 '21
I just learned more about trig watching 30 seconds of your video then I did in all of high school and college math
2
1
22
u/Ray-Marcher May 02 '21
Here's the link if you want to try it out: https://conwayjw97.github.io/Trig-Assist/
And the source code: https://github.com/conwayjw97/Trig-Assist
Feedback welcome!