![]() In computer graphics, y values start at 0 at the top of the page, and positive values increase downwards, so you’ll have to flip the sign of y coordinates if you don’t want balls bouncing on the ceiling.) Here’s a simple example: using Luxorĭemomovie = Movie(400, 400, "bouncing ball")įunction frame(scene::Scene, framenumber) You can now extract the values for a moment in time and draw the result. Now ball_sol is the solution to the ODE problem, and it contains all the information you want (it can provide samples, interpolate between steps, and so on). Say you’ve set up your problem in the usual way: using DifferentialEquationsĬb = ContinuousCallback(condition, affect!)īall_sol = solve(prob, Tsit5(), callback=cb) ![]() This approach is great for things like drawing the solutions generated by Differential Equations solvers. Then, for frame 79, say, you just draw the graphics for the 79th image. If you have a lot of calculation and set-up to do for every frame, it’s definitely worth trying to do it all at once, and storing (cacheing/memoizing) it for easy and repeated access. Pathname="./images/slackmojif/simple.gif")Įach frame produced by frame() will be a complete stand-alone PNG file, so you’ll have to do your drawing set-up (eg backgrounds, font selections, scaling, color choices, and so on) for each frame. Simpleanimation = Movie(400, 400, "animation") Text(string(framenumber), halign=:center) Here, the three Julia circles (a function for which is built in to Luxor.jl) are drawn with a radius specified by the incoming frame number. Your system’s ffmpeg binary converts the PNGs to an animated GIF lasting in this case about 8 seconds, at the default frame rate of 30 per second. You write a function that specifies the graphics for frame number n, with n going from, say, 1 to 250, and saves them in a PNG file. FramedĪnimations in Luxor.jl are usually built around the idea of a steadily increasing frame number. These free-range versions can enjoy a brief moment in the foreground before scuttling back into the shadows and wasting CPU cycles in the background. For the purposes of this post, I’m going to liberate a few slackmojifs from their current 128³ prison, and let them roam free over this page at a slighly higher resolution. They have to be less than 128KB, and fit into a 128 by 128 pixel square. These Slack/emoji/animated GIFs (I’ll call them Slackmojifs, which temporarily solves the GIF pronounciation problem) can be tricky to make. I like the puzzle-solving aspect of making them. I’m using Julia (and Luxor.jl), rather than something much easier (AdobeSlackEmojiMakerProfessionalCreativeCloud or whatever). They might possibly be useful to others, which is great, but it’s also fun to make them, particularly the animated ones. And over the last couple of years I’ve started adding a few custom reactions to the Julia Slack workspace. ![]() It’s a nice way of allowing people to contribute to a conversation without actually interrupting it. One aspect of Slack that I like is the system of reactions (adding small static or animated graphics in response to someone’s message). Is it: a waste of time, a vital tool, a distraction, an addiction, a flexible way to chat, an overcomplicated IRC alternative, a poorly-implemented CPU hog, “not worth the $17 billion ($28/share) it has reportedly been valued at over the past few months.”, worth way more than that?, or is it just another application? (Or all the above?) ![]() If you use the chat app Slack (“where work happens”), you probably already have opinions about it. Don’t load it if you are concerned with bandwidth, or if you don’t want your device to overheat.! Slackmojif Warning: this frivolous post contains many animated GIFs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |