metafizzy / zdog

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG
https://zzz.dog
10.34k stars 393 forks source link

Use degrees instead of radians. #34

Open chrisgannon opened 5 years ago

chrisgannon commented 5 years ago

I think it's more familiar and user friendly to rotate elements using degrees.

Is it possible to set an optional global variable like Zdog.useDegrees = true;.

Then any value passed to a rotateproperty is converted to degrees (currently I have to use my own conversion function).

desandro commented 5 years ago

Thanks for this feature request. Add a 👍 reaction to this issue if you would like to see this feature added. Do not add +1 comments — They will be deleted.

IMO radians is what native JS uses, so its more straightforward to use them rather than introducing a different unit. That said, yeah, there are a lot of times where I'm already thinking in degrees

chrisgannon commented 5 years ago

So rather than have it automatically convert it, is it possible to have it a global variable setting? Of course I can use my own converter - just a nice-to-have! :)

Neon22 commented 5 years ago

remember a simple function will do the job: degrees = 180 radians / pi radians = pi degrees / 180

chrisgannon commented 5 years ago

@Neon22 Yes I use that already - it would just be nice to be able to set it globally so I don't have to keep manually passing values to it. I'm lazy!

webocs commented 5 years ago

what about a toRadians function as member of Zdog?

 illo.rotate.y = Zdog.toRadians(180);

Edit:

I submitted a PR for this feature request https://github.com/metafizzy/zdog/pull/47