JuliaAnimators/Javis.jl

Animate forces

Open

#423 aberto em 19 de set. de 2021

Ver no GitHub
 (0 comments) (1 reaction) (0 assignees)Julia (50 forks)batch import
enhancementgood first issue

Métricas do repositório

Stars
 (847 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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.

Guia do colaborador