Post Reply 

Seamless animation loop - script needed

Aug 26, 2014, 23:40
Post: #1
Seamless animation loop - script needed
I use looping animations made of rippling clouds, smoke or water, but they are not always seamlessly looped. But i've found a way to blend the set of frames at the end with those at the beginning. The work is somewhat tedious but can quickly be done by script if someone can create it. Here is the process:

The idea is to fade in the first several frames of the animation, fade out the last several frames then interweave them. The user will choose the number of frames to blend. Here's the process:

1. First switch the animation to RGB if it isn't.
2. Allow the user to input the number of frames (layers) to blend (x). There should be a check to make sure the total number of frames in the animation is equal to or more than the number of chosen frames.
3. Apply the Filter Layers macro and, for each blend frame at the end, apply the Levels tool. Max the Output Level value to i/x, where i is the iteration count. This will effectively reduce the brightness of the layers over x number of frames, but we don't want to use the Brightness tool because we may be eventually using a colormap with first-pixel transparency.

For example if the user is blending the first and last 8 frames of a 25-layer animation, layer 25 will have an adjusted Output Level of 1/8 of 256, or 32. Layer 24's Output value will be 64, and so on, till layer 18 has an Output value of 255.

4. Go ahead and set the Mode of these frames to Additive.
5. Do the same Level Adjustment for x layers in the first layers of the animation, except in the opposite order.
6. Loop thru x and move the top layer to the spot above the first layer, then again the new top layer to the spot above the second from the bottom layer, etc. This will "weave" the ending frames with the beginning, with every other layer being an Addition layer.

Here is a table of what we should end up with BEFORE the next step (merging the Additive layers down with their corresponding Normals) using the example 25 layer animation:
Layer Name    Mode        Output Max
Layer 17    Normal    255
Layer 16    Normal    255
... etc until ...
Layer 25    Addition    32
Layer 8    Normal    255
Layer 24    Addition    64
Layer 7    Normal    224
Layer 23    Addition    96
Layer 6    Normal    192
Layer 22    Addition    128
Layer 5    Normal    160
... etc until ...
Layer 18    Addition    255
Layer 1    Normal    32

7. Make sure all layers are visible, go thru ONLY the Addition layers and merge down to the Normal layer below it. This will merge fade-in layers with those fading out.

Hopefully there's someone out there good with script-fu who can assemble this. It's greatly appreciated and will help me to assemble my colormapped animation loops.
Find all posts by this user
Quote this message in a reply
Sep 7, 2014, 18:41
Post: #2
RE: Seamless animation loop - script needed
When I interleave transparencies between the first x frames and the last x frames, I've never been able to make it come out right.

Plus the final image should not have any alpha channel in any layer (maybe unless requested in a dialog).
Find all posts by this user
Quote this message in a reply
Sep 7, 2014, 18:41 (This post was last modified: Sep 7, 2014 18:42 by Harbinger.)
Post: #3
RE: Seamless animation loop - script needed
(accidental double post)
Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Script Fu top menu Dutchy 1 631 Feb 7, 2019 12:23
Last Post: paynekj
  Run script on action rchav 2 1,581 Aug 13, 2018 14:57
Last Post: rchav
  Script Fu Errors Gimp 2.10.4 lightsaber jd3481 1 1,199 Aug 2, 2018 05:13
Last Post: paynekj
  Script-fu script to conversion pdf to image 4ever 12 15,793 Jul 17, 2018 16:01
Last Post: paynekj
  Problems with a bat script :( ThaUnknown_ 1 838 Mar 26, 2018 21:14
Last Post: paynekj

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS