Translate or interpolate a layer across multiple frames

I have a gif that takes up 50 frames. I’d like to move the layer with the gift to left by X pixels every frame. Currently I’ve figured out two ways to do this:

  1. select all in a frame, move it to the left X pixels, advance to the next frame, move it to the left X2 pixels, next frame, X3, etc

  2. select all frames(1-50) and then move the image to the left X pixels. Deselect, then select frames 2-50, move them to the left X pixels. Deselect, select frames 3-50, etc etc.

Is there a better/smarter way to do this?

It would be delightful to be able to set a start position in Frame 1, an end position in Frame 50, and then push some magic button to just interpolate everything :slight_smile: there might be a lua script out there that does just that but I haven’t found it yet.

Hi @madjackmcmad,

There are a few scripting options out there. I haven’t tried them myself.

There could be even more that my brief search didn’t turn up.

If you have some coding knowledge and/or want to make your own, links to key documentation in the scripting API are below.

Cel position
Frame duration
Sprite frames
Sprite new cel

There’s an extra wrinkle where the cel boundaries in a sprite opened from a gif are not trimmed of excess alpha on load. The simple way to fix this is to use app.command.CanvasSize with trim content active (default keyboard shortcut: C).

It’s a separate deal if you want to move the image contents, as you might if you were wrapping the image around its edges to make an infinite scroller. There’s currently a bug that prevents that from being done easily with built-in commands, but a workaround can be managed if you understand how the % operator works.

Cheers,
Jeremy

1 Like