Skip to content

Simulation of sand falling down in a cave built using nannou (Rust)

License

Notifications You must be signed in to change notification settings

lmammino/nannou-sand-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nannou-sand-simulation

Learning nannou, an open-source creative-coding toolkit for Rust, by implementing a visualization for a simulation of sand falling down in a cave (inspired by Advent of Code year 2022 day 14).

The sample visualization

Run the code

You will need a recent version of Rust installed.

  • Clone this repo
  • Run with cargo run --release
  • 🚀 Enjoy!

Generate an animation file

If you want to generate a video file (or a GIF) from the animation, go inside main.rs and uncomment the code related to generating images (inside fn view). Then run one of the following commands. You'll need ffmpeg installed in your system.

Generate an mp4 video

cd frames
ffmpeg -f image2 -framerate 60 -pattern_type sequence -i %06d.png -s:v 600x600 -c:v libx264 -pix_fmt yuv420p out.mp4

Generate a GIF

cd frames
ffmpeg -f image2 -framerate 60 -pattern_type sequence -i %06d.png -s:v 300x300 -loop 1 out.gif

References

If you want to see all my solutions for Advent of Code you can check out my solutions repository. I also stream these solutions on Twitch and the recordings are available on YouTube.

Contributing

Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub.

License

Licensed under MIT License. © Luciano Mammino.

About

Simulation of sand falling down in a cave built using nannou (Rust)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages