gsohler / openscad

OpenSCAD - The Programmers Solid 3D CAD Modeller
https://www.openscad.org
Other
14 stars 6 forks source link

animation timings #26

Open petaflot opened 2 months ago

petaflot commented 2 months ago

disclaimer: I have been following this project for a while, but for various reasons have not been able to give it a try yet. forgive me if this "issue" has been fixed already.

animations are great to animate and test complex mechanical systems such as geared reductors and many other things. in such cases, one really wants the animation to loop over cleanly. in this aspect, having the timing variable $t going from zero to one is very unpractical, because it should be obvious by now that we have a not much else than a rotating vector: the timing variable should loop over the [0:2pi] range (or [-pi:pi]).

because of backwards-compatibility issues this is not something I would request in the "legacy" openscad, however, since there are probably not too many python-openscad models out there, I believe this should be done ASAP.

gsohler commented 2 months ago

I get your point. In the current implementation i can't see anything wrong with "t" variable counting from 0 to 1. There is nothing which appears more "unit" than number one. One option would be to write: angle=23.1415 t in the beginning of the script Other option could be that pythonscad would automatically define variable "phi" for the python script which would go from 0 to 2pi. More sophisticated solutions could be that the script gives a hint on the total expected animation time and scales t (or phi) accordingly

petaflot commented 2 months ago

Other option could be that pythonscad would automatically define variable "phi" for the python script which would go from 0 to 2pi.

this would be good, much better than having to specify it manually: the main reason is that I see some UI improvements related to this, and having to make the widgets react to a non-standard variable seems like it will be more work and more likely to cause confusion.

+1 for automatic definition of phi

gsohler commented 2 months ago

image

it allows for really nice code

petaflot commented 2 months ago

I couldn't agree more :-)