Skip to content

some questions #3

Answered by rafael-fuente
mizuse-emiya asked this question in Q&A
Discussion options

You must be logged in to vote

For setting a new particle just create the particle with Particle() constructor and add to the current list of particles par with append() method.

Particle() constructor takes two arguments, the first is the initial position of the particle and the second is the initial velocity.

#create the particles
par.append(Particle(Vec2(2,5),Vec2(0.5,0.5)))
par.append(Particle(Vec2(5,2),Vec2(0.5,0.2)))
par.append(Particle(Vec2(3,3),Vec2(0.1,0.5)))
par.append(Particle(Vec2(0.6,2.5),Vec2(0.5,0.5)))

For my youtube video I plot the simulation frame by frame and the I merged all frames in to a video using ffmpeg

An alternative for doing directly in matplotlib is using matplotlib.animation.ArtistAnimation,…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rafael-fuente
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2 on June 06, 2021 17:37.