How to create a picture with animated aspects programmatically


I have been asked by a client to create a picture of the world which has animated arrows/rays that come from one part of the world to another.

The rays will be randomized, will represent a transaction, will fade out after they happen and will increase in frequency as time goes on. The rays will start in one country's boundary and end in another's. As each animated transaction happens a continuously updating sum of the amounts of all the transactions will be shown at the bottom of the image. The amounts of the individual transactions will be randomized. There will also be a year showing on the image that will increment every n seconds.

The randomization, summation and incrementing are not a problem for me, but I am at a loss as to how to approach the animation of the arrows/rays.

My question is what is the best way to do this? What frameworks/libraries are best suited for this job?

I am most fluent in python so python suggestions are most easy for me, but I am open to any elegant way to do this. The client will present this as a slide in a presentation in a windows machine.

Asked by: David271 | Posted: 28-01-2022

Answer 1

The client will present this as a slide in a presentation in a windows machine

I think this is the key to your answer. Before going to a 3d implementation and writing all the code in the world to create this feature, you need to look at the presentation software. Chances are, your options will boil down to two things:

  1. Animated Gif
  2. Custom Presentation Scripts

Obviously, an animated gif is not ideal due to the fact that it repeats when it is done rendering, and to make it last a long time would make a large gif.

Custom Presentation Scripts would probably be the other way to allow him to bring it up in a presentation without running any side-programs, or doing anything strange. I'm not sure which presentation application is the target, but this could be valuable information.

He sounds like he's more non-technical and requesting something he doesn't realize will be difficult. I think you should come up with some options, explain the difficulty in implementing them, and suggest another solution that falls into the 'bang for your buck' range.

Answered by: Freddie765 | Posted: 01-03-2022

Answer 2

If you are adventurous use OpenGL :)

You can draw bezier curves in 3d space on top of a textured plane (earth map), you can specify a thickness for them and you can draw a point (small cone) at the end. It's easy and it looks nice, problem is learning the basics of OpenGL if you haven't used it before but that would be fun and probably useful if your in to programing graphics.

You can use OpenGL from python either with pyopengl or pyglet.

If you make the animation this way you can capture it to an avi file (using camtasia or something similar) that can be put onto a presentation slide.

Answered by: Kirsten358 | Posted: 01-03-2022

Answer 3

It depends largely on the effort you want to expend on this, but the basic outline of an easy way. Would be to load an image of an arrow, and use a drawing library to color and rotate it in the direction you want to point(or draw it using shapes/curves).

Finally to actually animate it interpolate between the coordinates based on time.

If its just for a presentation though, I would use Macromedia Flash, or a similar animation program.(would do the same as above but you don't need to program anything)

Answered by: Maria891 | Posted: 01-03-2022

Similar questions

php - How do I programmatically check whether a GIF image is animated?

Here is a link to another question I asked concerning the same project I am working on. I think that bit of background will be helpful. For those that are too lazy to open a new tab to that question, I'll summarize what I'm trying to do here: I've downloaded about 250,000 images f...

python - How to programmatically enable/disable network interfaces? (Windows XP)

I need to enable/disable completely network interfaces from a script in Windows XP. I'm looking for a python solution, but any general way (eg WMI, some command-line à la netsh, some windows call) is welcome and will be adjusted. Thanks.

python - Programmatically launching standalone Adobe flashplayer on Linux/X11

The standalone flashplayer takes no arguments other than a .swf file when you launch it from the command line. I need the player to go full screen, no window borders and such. This can be accomplished by hitting ctrl+f once the program has started. I want to do this programmatically as I need it to launch into full screen without any human interaction. My guess is that I need to some how get a handle to the window ...

python - How do I use genshi.builder to programmatically build an HTML document?

I recently discovered the genshi.builder module. It reminds me of Divmod Nevow's Stan module. How would one use genshi.builder.tag to build an HTML document with a particular doctype? Or is this even a good thing to do? If not, what is the right way?

python - How do you programmatically reorder children of an ATFolder subclass?

I have Plone product that uses a custom folder type for containing a set of custom content objects. The folder type was created by subclassing BaseFolder and it has a schema with a couple of text fields. Currently, when custom objects are added to the custom folder, the objects are sorted alphabetically by their id. How can I override this behavior and allow my users to sort the custom folders manually, say through the ...

How to get the python.exe location programmatically?

This question already has answers here:

python - Programmatically taking screenshots in windows without the application noticing

This question already has answers here:

python - Discovering public IP programmatically

I'm behind a router, I need a simple command to discover my public ip (instead of googling what's my ip and clicking one the results) Are there any standard protocols for this? I've heard about STUN but I don't know how can I use it? P.S. I'm planning on writing a short python script to do it

python - Free word list for use programmatically?

python - Best way to programmatically create image

I'm looking for a way to create a graphics file (I don't really mind the file type, as they are easily converted). The input would be the desired resolution, and a list of pixels and colors (x, y, RGB color). Is there a convenient python library for that? What are the pros\cons\pitfalls?

python - Scrolling QGraphicsView programmatically

I've want to implement a scroll/pan-feature on a QGraphicsView in my (Py)Qt application. It's supposed to work like this: The user presses the middle mouse button, and the view scrolls as the user moves the mouse (this is quite a common feature). I tried using the scroll() method inherited from QWidget. However, this somehow moves the view instead - scrollbars and all. See picture. So, given that this is not the wa...

Still can't find your answer? Check out these communities...

PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python