Repository metrics
- Stars
- (847 stars)
- PR merge metrics
- (30d に merged PR はありません)
説明
Is your feature request related to a problem? Please explain. I would like to visualize some basic physical concepts like gravity #360 or drawing parabola for cannon ball trajectories or others.
Describe the solution you'd like
I think one way would be to simply have a anim_force function similar to anim_translate which takes in a force.
We would probably want to define a force which holds information about the direction (maybe reuse Point) and the acceleration.
The acceleration could be part of the Point but we need to specify the seconds or some other unit here as well.
We could use the fps of the render function maybe to then have something like "9.81px per square second" for Earth like gravity.
Possible user interface:
act!(ball, Action(1:30, anim_force(Force(0, 9.81))))
We might also want to have a keyword in anim_force to stop when a certain condition is fulfilled like:
act!(ball, Action(1:30, anim_force(Force(0, 9.81); stop_if=b->b.center+b.radius <= video.height/2)))
here stop_if is a function which gets called with the object ball.