Pivot Points, Trimming, and Why Sprites Jitter
The animation is smooth in the sheet, but in the engine the character bounces up and down. Every cell is the same size. The frames are in order. So why does it jitter?
Almost always: the content moved inside the cell, because each frame was trimmed independently, or the pivot changed between frames. The sheet looks fine; the origin does not.
You can place the pivot visually and get the Godot offset from the Pivot & Animation Previewer.
What a pivot is
A pivot is the point a sprite uses as its origin for:
- positioning,
- rotation,
- flipping,
- scaling,
- and aligning to the ground.
It is often normalized:
(0.5, 1.0)— bottom-center, good for side-view characters.(0.5, 0.5)— center, good for top-down or UI.(0, 0)— top-left, good for tiles.
The pivot is not the same as the trim rectangle. The trim decides what is drawn; the pivot decides where the origin is.
Why independent trimming causes jitter
Imagine a walk cycle. In frame 1 the character is upright; in frame 4 the legs are spread. If you trim each frame to its own bounding box:
- frame 1 is tall and narrow,
- frame 4 is shorter and wider,
- each crop has a different top edge and center.
Place both crops in the same cell and align their tops, and the feet move up and down. The animation jitters even though the cells are identical.
The fix is uniform bounds: one rectangle for the whole animation, used by every frame.
Uniform bounds vs tight trim
| Approach | What it does | Result |
|---|---|---|
| Tight trim per frame | Crops each frame to its own content | Smallest cells; jitter |
| Uniform bounds | Crops every frame to the union of content | Slightly larger cells; stable |
| No trim | Keeps the full source frame | Largest cells; stable if the source is stable |
For a character, uniform bounds is the default. For a UI icon sheet with unrelated sprites, tight trim is fine because they are not an animation.
The three-layer model
Think of each frame as three rectangles:
- Source frame — the original image or video frame.
- Content rect — the visible pixels inside it.
- Cell — the uniform box placed in the sheet.
The pivot belongs to the cell, not the content rect. If you move the content rect inside the cell without moving the pivot, the sprite shifts.
How to fix it in practice
- Pick the animation’s content union (min x/y, max x+w/y+h across all frames).
- Crop every frame to that union.
- Place the crop in a cell of the same size.
- Set one pivot for the cell (bottom-center for characters).
- Do not nudge individual frames.
The AI sheet fixer does this when it rebuilds uniform cells. The sheet maker does it for same-size source frames with “uniform bounds” enabled.
Godot specifics
Godot does not store a per-frame pivot in SpriteFrames or AtlasTexture. It uses:
AnimatedSprite2D.centeredandoffset,Sprite2D.centeredandoffset,- the node’s position.
So one offset has to work for all frames. If the frames were trimmed individually, no single offset will fix every frame; rebuild the sheet.
Symptoms and causes
| Symptom | Cause | Fix |
|---|---|---|
| Character bounces vertically | Per-frame trim changed the top edge | Uniform bounds |
| Feet slide horizontally | Content center changed between frames | Union bounds, one pivot |
| Flip moves the character | Pivot is not centered horizontally | Pivot x = 0.5 |
| Rotation orbits the sprite | Pivot is at a corner | Move pivot to the rotation point |
| One frame is offset | That frame was cropped differently | Rebuild the sheet |
| Sprite is cut at the edge | Cell smaller than the content | Expand the cell or padding |
Trimming and padding are different
- Trim removes transparent border around the content.
- Padding adds space between cells.
Trimming affects alignment; padding affects bleeding. Do not use padding to compensate for a bad trim.
A checklist
- One content union for the animation.
- One cell size for every frame.
- Pivot at the intended origin (usually bottom-center).
- No per-frame offset tweaks.
- JSON pivot matches the engine’s convention.
- Flip test: the character does not move sideways.
- Rotation test: the sprite rotates around the intended point.
FAQ
Should I trim at all? Yes, for textures that contain a lot of empty space. But trim the animation as a unit, not each frame independently.
Does trimming change the pivot? It changes where the content sits relative to the cell. If you keep the pivot on the cell, the sprite shifts. Uniform bounds avoids that.
Do other engines store a per-frame pivot? Some do (Unity and Phaser can read pivot metadata). Godot uses the node offset. The sheet should still be built with uniform bounds so one offset works.
Why does my character sink into the ground? The pivot is above the feet, or the cell has extra space below the content. Set the pivot at the feet and crop consistently.
Can I fix jitter in the engine? Sometimes with per-frame offsets, but that is a workaround. Fix the sheet; the engine should not have to compensate for inconsistent frames.
If the sheet is also uneven, see Fixing uneven AI sprite sheets. If the issue is a line at the edge, see texture bleeding.