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:
Code:
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
  Request for script chlebna 1 171 Sep 13, 2017 09:35
Last Post: ythgilb
  Request for script - Guillotine + Watermark sunslick 1 229 Sep 4, 2017 08:51
Last Post: ythgilb
  Script-fu: How to create new, addressable layer using gimp-floating-sel-to-layer Bertholom√§us 2 230 Aug 31, 2017 14:32
Last Post: Bertholomäus
  How to modify this script-fu? Zakary81 1 195 Aug 23, 2017 12:48
Last Post: paynekj
  Need help in running a gui script-fu via command line eyalzek 2 353 Oct 4, 2014 14:05
Last Post: eyalzek

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS