7 ms·
Manim – Python library for creating mathematical animations
- xiaodai 5y agoJavis.jl
- WalterGR 5y agohttps://github.com/JuliaAnimators/Javis.jl https://github.com/JuliaAnimators/Javis.jl “Julia Animations and Visualizations”
- yakubin 5y agoI don't know any Julia and I've looked at one example: <https://juliaanimators.github.io/Javis.jl/stable/tutorials/tutorial_7/ https://juliaanimators.github.io/Javis.jl/stable/tutorials/t...> In the first code snippet, I don't understand how Background(1:200, ground) is picked up. It looks to me like a statement disconnected from the others. I also don't understand how calling background("black") and sethue("white") in function ground affects anything. Are those some dynamic scope shenanigans? Or do those just modify some global variables? Generally, a lot of parts of the code don't seem connected in any way, I don't see how the data flows through code. Could someone familiar with Julia ELI5?
- adgjlsfhk1 5y agoyeah, that code is doing some seriously weird stuff. from looking into the package a little, what is happening is that these functions modify an implicit global state. it's probably not the api I would have designed, but it does look convenient for rapid development.
- yakubin 5y agoThanks.
- thecedarprince 5y agoHey Yakubin, Co-creator of Javis.jl here! As adgjlsfhk1 said, there is an implicit global scope here! This comes from a historic artifact from Cairo (which is what Javis is using deep within its tooling stack) which utilizes this sort of approach. Here is an ELI5 that may help about the flow of a Javis animation: imagine Javis as a magical artist sitting at a table. The artist is a bit peculiar as they can draw anything you want but will not draw anything until you finish telling them everything you want to see. When you create a `Video` object, the artist grabs an empty notebook and opens it up. If you create a `Background` object, basically you are telling the artist that you want the background of each page in the notebook to be, in this case, black for pages 1 - 200. As you keep telling the artist what you want, the artist listens to how you want it ordered, how objects should appear and animate, etc. Finally, when you tell the artist to `render` this animation, Javis springs to work and flips through all the different pages, drawing backgrounds, objects, etc. to match what you asked. Then, when Javis is all done, the artist gives you the notebook that when you open it up, it will magically flip through all the pages (i.e. at a given frame rate) showing you your requested animation. I know this ELI5 doesn't really get into the internals, but at a high level, that is what is happening with the start of the `Video` object. Happy to give more details if desired. We are trying to move to a v1.0.0 release very soon and in v2.0.0 we want to experiment with different syntax - perhaps a more implicit syntax similar to manim and Processing. Out of curiosity, for you, do you find it necessary to know more about Javis's approach to use Javis or was this more of a question that you had? Reason why I ask is perhaps we could add a "How Javis Works" section to the documentation if that could help more folks. Thanks!
- yakubin 5y agoThank you very much for your detailed explanation. The reason I asked is because when I saw Background(1:200, ground), I did not know what made Javis use this background. To me it looked like creating an object and immediately discarding it. Global state explains it, but by default I'd assume that I can e.g. create two animations simultaneously (not necessarily meaning parallelism or concurrency, just multiple animation objects coexisting in memory at the same time, with code applying modifications to one in line N and to the other in line M e.g.) In that case I don't know how Javis would distinguish which background should be applied to which animation, as the code doesn't explicitly show any connection between the video variable and the Background(1:200, ground). From your explanation I assume you can only create one animation at a time. It makes sense. It makes it similar to creating plots in gnuplot. Keep in mind that I don't program in Julia (I'm considering learning it though), so I may still be totally off the mark in my understanding. When I learn a library, tracing how data flows through example programs is the guide I use. When I don't see the explicit connection facilitating this flow of data, the library feels a bit less predictable to me and I need to rely more on copy-pasting ready-made examples to get something working through trial-and-error instead of relying on an accurate mental model of what happens. I know that such explicitness can feel verbose sometimes, but there are methods of escaping the verbosity without losing explicitness. Two examples: iterator pipelines in Rust/streams in Java, builder pattern in any language with method call syntax. In the first example, usually the pipeline starts with the name of the source of data and is followed by transformations connected by dots, e.g.: let names = vec!["Jane", "Jill", "Jack", "John"]; let total_bytes = names .iter() .map(|name: &&str| name.len()) .fold(0, |acc, len| acc + len ); The important thing here is that the dots signal that all those operations are applied to the result of the previous operations in pipeline (yet you don't need to name all the intermediate results). It's both terse and explicit. Builder pattern is similar: you have an object with methods which modify this object and return self/this, so that you don't need to repeat the name of the object being created in every line setting something in this object. E.g. I have this code in one of my Rust project using the clap library to parse CLI arguments: let app = App::new(pkg_name) .bin_name(bin_name) .version(version.as_str()) .about("Compares directories file by file") .arg(Arg::with_name("brief") .short("q") .long("brief") .help("Report only when directories differ") .display_order(1)) .arg(Arg::with_name("null") .short("0") .long("null") .help("Print raw NUL-separated paths") .display_order(2)) .arg(Arg::with_name("color") .long("color") .value_name("when") .help("Print output in color") .takes_value(true) .possible_values(&["never", "always", "auto"]) .default_value("auto") .display_order(3)) .arg(Arg::with_name("progress") .long("progress") .value_name("when") .help("Print progress reports") .takes_value(true) .possible_values(&["never", "always", "auto"]) .default_value("auto") .display_order(4)) .arg(Arg::with_name("block-size") .short("b") .long("block-size") .value_name("block-size") .help("Read files in blocks of <block-size> bytes") .takes_value(true) .validator(is_valid_block_size) .display_order(5)) .help_message("Print help information and exit") .version_message("Print version information and exit") .arg(Arg::with_name("old") .value_name("old") .required_unless_one(&["help", "version"]) .hidden(true) .index(1)) .arg(Arg::with_name("new") .value_name("new") .required_unless_one(&["help", "version"]) .hidden(true) .index(2)); I think the builder pattern could be a good fit for Javis. But that's just a complete outsider's opinion who doesn't even program in Julia, so don't take that too seriously. I think the API being a bit more like gnuplot is just fine for Javis' apparent purpose. To answer your question more directly, yes, I do think that knowing a bit about internals helps me understand how I should be using it. Cheers
- bradrn 5y agoSee also reanimate, a very similar Haskell library: https://reanimate.github.io/ https://reanimate.github.io/
- gcthomas 5y agoFor anyone who uses LaTeX and Python already, this looks like a really nice way to make dynamic maths or science presentations. The syntax looks a lot easier than LaTeX for static images, but the animations also look really quick to generate with minimal boilerplate.
- ngmc 5y agoShameless plug for my mentee: p5.teach aims to be a beginner-friendly version of manim that runs in the browser. https://github.com/two-ticks/p5.teach.js https://github.com/two-ticks/p5.teach.js https://medium.com/processing-foundation/p5-teach-teaching-math-through-animations-and-simulations-64b6159fef85 https://medium.com/processing-foundation/p5-teach-teaching-m...
- adenozine 5y agoDoesn’t use Python at all, it seems? Making this comment less like a plug, and more like spam…
- EEBio 5y agoIt doesn't use Python, but it solves the same problem. I for one am happy this got posted here. I used manim in the past, but its setup is really cumbersome (at least it was back then when I tried). A JavaScript alternative is therefore much welcome. I will definitely have a look P5 Teach.
- amrrs 5y agoThis looks like a nice alternative for Manim, especially with minimal dependencies (easier setup). I'm definitely give it a try!
- ZYinMD 5y agoI wonder what 3 Blue 1 Brown uses. I heard he uses "a library he built himself, which now has a small community". Edit: sorry for being a joke but I saw "Python library math animation" and I immediately thought of 3B1B but I really had no idea this was it!
- adenozine 5y agoIt’s this.
- sundarurfriend 5y agoAssuming you're not joking, this is the library Grant built (and released open source).
- detaro 5y agospecifically it's a community variant of it. Grant still has his own version (https://github.com/3b1b/manim https://github.com/3b1b/manim) where he works independently, and the community fork builds off that and e.g. adds and maintains things Grant might not care about.
- smoe 5y agoTo nitpick a bit, manim.community is a fork of the library he built. This is the original: https://github.com/3b1b/manim https://github.com/3b1b/manim From the the READE: "Note, there are two versions of manim. This repository began as a personal project by the author of 3Blue1Brown for the purpose of animating those videos, with video-specific code available here. In 2020 a group of developers forked it into what is now the community edition, with a goal of being more stable, better tested, quicker to respond to community contributions, and all around friendlier to get started with. See this page for more details."
- awesomelvin 5y agoHe is literally the creator of Manim and used it for all his videos. He also publishes the source code of each video on his GitHub account.
- fareesh 5y agoLooks great - does anyone know of similar projects and/or more examples with code?
- amelius 5y agoDoes it have a constraint solver? I think that might be the kind of functionality you need most: move this while that stays fixed, or keeping this at a fixed distance from that, etc.
- adhesive_wombat 5y agoWow that's cool. I've always wondered how to do something those swish YouTube videos like 3Blue1Brown[1]. [1] https://youtu.be/HZGCoVF3YvM https://youtu.be/HZGCoVF3YvM
- mcintyre1994 5y agoIn case you haven't spotted it yet, this is actually a community maintained fork of the library he uses for 3blue1brown and open sourced :) https://docs.manim.community/en/stable/installation/versions.html#a-brief-history-of-manim https://docs.manim.community/en/stable/installation/versions...
- lnyan 5y agoPrevious discussion: https://news.ycombinator.com/item?id=28245277 https://news.ycombinator.com/item?id=28245277 (community version) https://news.ycombinator.com/item?id=19716019 https://news.ycombinator.com/item?id=19716019 (3Blue1Brown's version)