Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate forces #423

Open
Wikunia opened this issue Sep 19, 2021 · 0 comments
Open

Animate forces #423

Wikunia opened this issue Sep 19, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Wikunia
Copy link
Member

Wikunia commented Sep 19, 2021

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.

@Wikunia Wikunia added enhancement New feature or request good first issue Good for newcomers labels Sep 19, 2021
@Wikunia Wikunia changed the title anim force not just translation Animate forces Sep 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant