Creating animated GIF files out of D3.js animations - animation

I am creating D3.js animations, like this: Demo
Let's say I want to present my work here (or on a blog). About the best I can do is post a picture:
On the other hand, if I, let's say, use the Python library Matplotlib for data visualization, I could produce an animated GIF file, and post it here:
I would like to programatically obtain similar animated GIF files out of my D3.js animations. How can I do this?
NOTE: I started working on getting events from d3.transition(), but so far I didn't have any luck.

The solution uses a tool called LICEcap, a screen capture utility for Windows and Mac. Steps are following:
Download LICEcap and install it. Now, if you start this program, it will have a rather unusual shape, just a thin frame, and everything inside the frame will be transparent:
Go to the window with your D3.js animation and prepare everything so that you could start animation at some point. Let's say we want to record this example from d3js.org:
Now start LICEcap and position it over the area you want to have in your animated GIF file:
Make sure that you enter at least 20 FPS in the bottom left edit box, otherwise the recording will be low quality. Press record. A dialog will first appear, and you choose here whether you want your GIF file to be in an infinite loop, or just repeated once, or any number of times. Also an interesting option is to add some visual clues for mouse clicks. Choose also filename, and press Save.
Now you do whatever you have to do to trigger animations. I pressed buttons Grouped and Stacked several times. After I decided it's enough, I pressed Stop. The resulting file is:
That's it!

Related

Gimp Script-Fu: Delete a selection

I'm trying to write a script for Gimp that will crop an image, make a circular selection of what's left, invert the selection, and then delete the selection. I have the cropping, selection, and inversion part done, but the deleting is what's getting me.
(removed old code, see update)
That's the code I have. What's confusing me about the gimp-item-delete code is the item. I understand that I need to define my current selection as the item, but I'm not sure how to do this. If someone could explain how to do this, I would greatly appreciate it! Alternatively, if there's an easier way to do what I'm trying to do (but preferably still in a script), please let me know what you think. My knowledge of this coding is pretty limited, so simple explanations are appreciated.
UPDATE/EDIT:
Here's the (full) updated code:
; XML2 Conversation Portrait Preview Crop
(define (script-fu-xml2-convo-preview image layer)
(gimp-image-undo-group-start image)
(gimp-selection-none image)
(gimp-image-resize image 152 152 -280 -496)
(gimp-layer-resize-to-image-size layer)
(gimp-image-select-ellipse image 0 0 0 152 152)
(gimp-selection-invert image)
(gimp-displays-flush)
(gimp-drawable-edit-clear layer)
(gimp-selection-none image)
(gimp-image-undo-group-end image)
)
; populate script registration information
(script-fu-register
"script-fu-xml2-convo-preview"
"XML2 Conversation Portrait Preview Crop"
"Crops the preview window for XML2 conversation portraits."
"BaconWizard17"
"BaconWizard17"
"September 2021"
"*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer" 0
)
; register the script within gimp menu
(script-fu-menu-register "script-fu-xml2-convo-preview" "<Image>/Marvel Mods/Skin Previews/XML2 PC")
So when I'm running this script, it appears to just crop it and doesn't delete the inverted circular selection. However, if I interact with the image in any way (click on it, duplicated it, copy/paste it, undo/redo), it will correct itself and show the properly cropped image with the deleted circular corners. When I first run the script, it also shows the incorrect image up at the top where you can pick which image you're working on, but after interacting with the image it will show the correct image. Here's an example:
The starting image that I create from the clipboard with Ctrl+Shift+V (after screenshotting it from the game using PrtScr):
Then, I run the script, which results in this:
At the top of the screen, the image shows up like this (which is the top left 152x152 pixels of the starting image:
How the image looks once I interact with it in any way (clicking on it, copy/pasting it, duplicating it, undoing/redoing the operation):
The thumbnail at the top of the screen after I interact with the image:
Maybe it's getting hung up on something during the operation? I'm not sure. I understand if this issue is unavoidable, but I would prefer to be able to just run the script and move on rather than having to interact with the image to get it to show up correctly. The image does have an alpha layer when it's pasted in.
gimp-item-delete is a memory/object management thing and is rarely used. What you are looking for is gimp-drawable-edit-clear.
Note that it should be done (together with your final gimp-selection-none) before gimp-image-undo-group-end if you want your whole script to be undone by a single Ctrl-Z.
Edit: It appears that your code works, it's just that the display isn't updated to show the result, which is exactly what gimp-display-flush is meant to do, so why is your code calling it before gimp-drawable-edit-clear? gimp-display-flush ought to be about the last thing done by your script.

How to add a gif/animation onto Beamer (post Adobe retiring Flash)

I'm having trouble adding a gif onto my Beamer. I've searched for answers but I haven't found one that was written after Adobe retired it's Flash Player.
I've tried using the animate package, and it does compile the file, but it doesn't let me play it (the controls appear, but if I click them nothing happens). I've tried the media9 and movie15 packages, but apparently they are obsolete. So, I am very confused on how to add an animation at this point in time. And honestly, I don't even know if the lack of Adobe Flash Player is the problem. I know there has to be a simple answer.
I don't think it's necessary to add my code, since I feel it's such a trivial matter.
Thanks in advance!
You can split your .gif file into individual images. There are many different converters to be found online or you could use image magick from the command line:
convert -coalesce test.gif test.png
This will result in a series of images called test-0.png etc.
You can then include these in your beamer presentation using the xmpmulti package.
To animate this sequence of slides, you can use \transduration<0-16>{0}. Replace 16 with how many images you have and {0} with the duration in seconds each image should be shown. With 0 seconds from my example, the time will be determined by how long your computer takes to render the slide.
If you now open the presentation with adober reader in presentation mode, the slides will change automatically and thus create an animation.
\documentclass{beamer}
\usepackage{xmpmulti}
\begin{document}
\begin{frame}
\transduration<0-16>{0}
\multiinclude[<+->][format=png, graphics={width=\textwidth}]{test}
\end{frame}
\end{document}
Or if abandoning the pdf format is an option, you could have a look at the media4svg package.

How to copy shape format

I'm using Visual Paradigm to draw my use-cases diagrams.
For nicer presentation, I want my all my use-cases to have the same shape. Instead of resizing them manually, I want to use the format copier to achieve this.
I followed the steps as explained here : https://www.visual-paradigm.com/support/documents/vpuserguide/1283/33/26921_formatcopier.html
Unfortunately, this doesn't seem to work.
Tested method:
Left-Click on the shape I want to copy format.
Left-Click on the "Format Copier" button in the menubar.
Left-Click on the use-case I want to apply copied format.
(Here's a short clip showing the manipulation : https://i.gyazo.com/41462b8cc0b4114be8c6ebe490fadab3.mp4)
It doesn't change anything and simply select the new shape I clicked without reformatting anything.
Is there another way to do this ? Or am I doing something wrong ?
The format copier is specific for copy the "styles and formatting" information, which are the fonts, foreground and background styles. For the size you can select multiple shapes on diagram then mouse over your selection to bring up the resource icons for setting the size of multiple elements at once.

Looping Images without GIF's

Gifs display bad on my dark game background. So I saved all the 21 frames individually. Put them in my data folder. Now I need them to independently loop and at the mouse pressed command to stop looping. How are the code lines to import all of the 21 images and then have them loop and stopped when mouse is being pressed?
Start smaller.
Can you write a little example sketch that loads a single image and displays it? Take a look at the loadImage() reference here: https://www.processing.org/reference/loadImage_.html
Can you then expand that little example sketch to show two images that alternate when you press the mouse? Can you add a delay between the switching so you can see each image?
Then can you expand that little example sketch to show all 21 images? The ArrayList reference might be useful to you: https://www.processing.org/reference/ArrayList.html
When you get stuck on one of those little example sketches, post it as an MCVE and ask a specific question, and we'll go from there.

Text Block Text Animation Like Live Tile Text

Hi every One See the Below Image
in this Screen that 3 Blocks are images and i am trying to Bind some text to that Text Block and display with some time intervals with Live tile Look and feels. Can any One Sugest How can i do this
If you want to mimic Live Tiles, I suggest that you take a look at The Windows Phone Toolkit. It contains the HubTile control which is live and is probably the thing you are looking for.
If not, you have the source code and you can check how they did it. This way you can replicate the behavior and then customize it.

Resources