imspinner

June 6, 2026 · View on GitHub

Set of nice spinners for imgui

spinners

headers

The library is header-only and split into add-on files; each one includes the one below it, so just include the highest level you need:

headerwhat you getincludes
imspinner.hthe spinners themselves
imspinner_compat.hSpinner<> typed dispatcherimspinner.h + imspinner_bars.h
imspinner_bars.hbar-chart spinners (e.g. SpinnerFadeBars)imspinner.h
imspinner_dots.hdot-based spinners (e.g. SpinnerBounceDots)imspinner.h
imspinner_text.htext loaders (e.g. SpinnerTextFade)imspinner.h
imspinner_shapes.hshape spinners (e.g. SpinnerMorphShape)imspinner.h
imspinner_demo.hthe interactive demo gallery (demoSpinners())above + imspinner_compat.h
#include "../imspinner/imspinner.h"          // graphical spinners only
// or
#include "../imspinner/imspinner_text.h"     // + text loaders
// or
#include "../imspinner/imspinner_demo.h"     // + interactive demo

// use a single spinner anywhere inside an ImGui window:
ImSpinner::SpinnerRainbow("rainbow", 16.f, 2.f, ImColor(255, 255, 255), 8.f);

how to test

  1. include the demo header (no #define needed — including it is the opt-in) and call demoSpinners() once per frame:
#include "../imspinner/imspinner_demo.h"

int main(int, char**) {
  ...
  while (!done) {
     ...
     ImSpinner::demoSpinners();
  }
}
  1. enable edit mode with checkbox 'show number' or play with options image

bar spinners

bars

Bar-chart and fading-bar spinners live in imspinner_bars.h. SpinnerBarChartSine is also wired into the core Spinner<e_st_barchartsine> dispatcher.

#include "../imspinner/imspinner_bars.h"   // pulls in imspinner.h
...
ImSpinner::SpinnerFadeBars("bars", 6.f, ImColor(255, 255, 255), 2.8f, 3);
ImSpinner::SpinnerBarChartRainbow("rainbow", 16.f, 4.f, ImColor(255, 255, 255), 4.f);
functioneffect
SpinnerFadeBarsvertical bars fade in sequence (scale stretches height)
SpinnerBarsRotateFaderadial bars rotate with fading opacity
SpinnerBarsScaleMiddlebars scale from the centre outward
SpinnerBarChartSinesine-wave bar chart (also Spinner<e_st_barchartsine>)
SpinnerBarChartAdvSinedense sine bars with horizontal wobble
SpinnerBarChartAdvSineFadedense sine bars with fade
SpinnerBarChartRainbowrainbow bars with independent wave heights
SpinnerFluidfluid equalizer-style columns
SpinnerFluidPointsfluid columns drawn as stacked dots
SpinnerBarsSeqPulsethree bars shrink height in sequence
SpinnerBarsCascadeGrowbottom bars grow in a cascade
SpinnerBarsRisethree bars slide upward with stagger
SpinnerBarsCornerHopbars hop diagonally toward the top
SpinnerBarsDiagonalGrowbars step through corner positions
SpinnerBarsBounceCentercentre-anchored bars bounce between slots
SpinnerBarsScaleAltbars pulse height with alternate timing
SpinnerBarsCornerWavebottom bars step in a corner wave
SpinnerBarsJumpbars swap between top and bottom
SpinnerBarsDoubleRowtwo rows of bar segments slide horizontally
SpinnerBarsSixPulsesix corner bars pulse height 50↔30%
SpinnerBarsSixStaggersix bars shrink in staggered wave order
SpinnerBarsMorphPlusfive bars morph tall→square→wide
SpinnerBarsFlipSixsix bars shrink while positions flip every 2 s
SpinnerBarsSwapTriBottomthree bars swap bottom anchors while shrinking
SpinnerBarsSwapTriZigzagthree bars zigzag between corner pairs
SpinnerBarsMorphDiagonalthree diagonal bars morph tall→square→wide
SpinnerBarsSlideDiagonalthree diagonal bars shrink while outers swap
SpinnerBarsConicAlternatetwo conic-corner tiles slide diagonally
`SpinnerBarsConicWalk$\text{two} \text{conic} \text{corners} \text{step} \text{a} 2 \times 2 \text{path}
$SpinnerBarsMarchIn`four stripe rows march in from the left
SpinnerBarsMarchDownfour stripe rows drop in from the top
SpinnerBarsWaveSkewfour rows skew diagonally then reset
SpinnerBarsRowDropfour rows drop one-by-one
SpinnerBarsZigzagRowsfour rows alternate stripe alignment
SpinnerBarsFillCascaderows fill left→right in stagger
SpinnerBarsPingPongRowsrows ping-pong stripe alignment
SpinnerBarsWaveRowsWidefour rows wave centre↔edges
`SpinnerBarsGridFade$3 \times 3 \text{dot} \text{grid} \text{fade} \text{wave}
SpinnerBarsGridSpreadSpinnerBarsGridSpread3 \times 3 \text{dot} \text{grid} \text{spread} \text{pulse}
$SpinnerBarsStretch`three pill bars stretch vertically from a centre dot
SpinnerBarsStretchSeqthree pill bars grow to full height one-by-one
SpinnerBarsBounceBallball rolls across three bars while bouncing
SpinnerBarsKnockDotsbouncing bar knocks a row of dots downward
SpinnerBarsStaircaseball bounces down a descending staircase of bars
SpinnerBarsKnockAwaybar knocks two dots down then shoves the last away
SpinnerBarsGatescolumn gates retract to let a ball roll through
SpinnerBarsCaptureball rolls to the centre and the gate traps it
SpinnerBarsEscapetrapped ball slips aside and shoots out of the top
SpinnerBarsDevourball swallows two dots, grows, then dashes away
SpinnerBarsLiftthree tall rounded bars rise in a staggered wave
SpinnerBarsGapSlidea round gap travels along three static bars
SpinnerBarsConvergebar and dot meet in the centre of each column
SpinnerBarsSwapEndsbar and dot swap top/bottom ends in a wave
SpinnerBarsRelaybars drop, rise with dots, then dots drop in a wave
SpinnerBarsPushdescending dots push the bars down column by column
SpinnerBarsPushWavea single dot-push travels across the columns
SpinnerBarsGatherfour arms assemble a rotating plus around a dot
SpinnerBarsSplittwo bars spread from the centre while the figure rotates
SpinnerBarsSlota dot passes through two opening bars while rotating
modeeffect
0default timing and direction
1alternate animation per spinner (sync pulse, reverse stagger, top anchor, single walking tile, synchronized rows, reverse grid wave, etc.)
2reversed timeline (t → 1−t)
functioneffect
SpinnerDotsBarsGrowSyncthree bars grow in sync; end dots ride top/bottom
SpinnerDotsBarsGrowCascadecolumns grow one after another
SpinnerDotsBarsDotRunthree bottom bars; dot runs along the top
SpinnerDotsBarsBarRunthree top dots bounce; bar runs below
SpinnerDotsBarsDotArctiered bars; dot arcs diagonally
SpinnerDotsBarsBarJumpbar jumps along the bottom; dots swap above
SpinnerDotsBarsHalfPulsesix half-bars pulse; dot walks left→right
SpinnerDotsBarsHalfPulseMidlike HalfPulse; dot stops at centre
SpinnerDotsBarsHalfPulseExitlike HalfPulseMid; dot exits upward
SpinnerDotsBarsVersuswide arena — scaling dot vs shuttling bar
SpinnerDotsBarsMaskGrowthree bars grow upward with cap dots
SpinnerDotsBarsMaskCascadecap dots slide along full-height bars
SpinnerDotsBarsColSplitbars split around dots per column
SpinnerDotsBarsColSwapbars and dots swap top/bottom
SpinnerDotsBarsColDropbars shrink from bottom in sequence
SpinnerDotsBarsSwapAltbars and dots bounce in alternating order
SpinnerDotsBarsSwapLoopcontinuous SwapAlt loop
SpinnerDotsBarsCrossSpinfour bars slide in; frame rotates 90°
SpinnerDotsBarsRailSpinbar–dot–bar slides off-screen while rotating
SpinnerDotsBarsRailOrbitlike RailSpin; dot also orbits vertically

These also accept optional mode (0 = default, 2 = reversed timeline).

dot spinners

dots

A large family of dot-based spinners lives in the imspinner_dots.h add-on. They mostly share the shape SpinnerXxxDots(const char *label, float radius, float thickness, ImColor color = white, float speed = 2.8f, …), where the trailing count argument is usually dots/lt (number of dots). SpinnerDots additionally takes a float* phase pointer; some take bg/mode/delta. (SpinnerDots and SpinnerVDots stay in the core imspinner.h because the Spinner<> dispatcher references them.)

#include "../imspinner/imspinner_dots.h"   // pulls in imspinner.h
...
ImSpinner::SpinnerBounceDots("dots", 16.f, 6.f, ImColor(255, 255, 255), 6.f, 3);
functioneffect
SpinnerDotsdots fade in turn around a circle (also exposed via Spinner<e_st_dots>)
SpinnerVDotsring of dots with a second rotating set (also Spinner<e_st_vdots>)
SpinnerBounceDotsa few dots bounce up in sequence
SpinnerZipDotsdots zip together and apart
SpinnerDotsToPointsdots contract from a ring toward points
SpinnerDotsToBardots line up into a bar and back
SpinnerWaveDotsa row of dots ripples in a sine wave
SpinnerFadeDotsdots fade in/out in sequence
SpinnerThreeDotsthree pulsing dots
SpinnerFiveDotsfive pulsing dots
SpinnerMultiFadeDotsmultiple rows of fading dots
SpinnerScaleDotsdots scale up/down in turn
SpinnerMovingDotsdots travel across and wrap around
SpinnerRotateDotsgroups of dots rotate around the centre
SpinnerOrionDotsdots spread along rotating arcs
SpinnerGalaxyDotsdots swirl along galaxy-like arms
SpinnerIncDotsdots light up incrementally around a circle
SpinnerIncFullDotsincremental dots filling the full ring
SpinnerIncScaleDotsdots scale up incrementally around a circle
SpinnerSomeScaleDotsa subset of dots scales in turn
SpinnerDotsLoadingdots with a separate background ring
SpinnerSquareRandomDotsdots blink at random inside a square grid
SpinnerHboDotsHBO-style fading dots
SpinnerMoonDotstwo dots chasing like a moon orbit
SpinnerTwinHboDotstwo interleaved HBO dot rings
SpinnerThreeDotsStarthree dots arranged/rotating in a star
SpinnerSwingDotsdots swinging like a pendulum
SpinnerDnaDotsdots winding along a DNA double helix
Spinner3SmuggleDotsthree dots weaving/smuggling past each other
SpinnerDotsTypinga row of dots appears one by one, then resets (typing)
SpinnerDotsStepa single dot hops across slots left→right, then loops
SpinnerDotsGathera row of dots spreads apart and squeezes together
SpinnerDotsShiftthree dots; the side dots shuffle in/out around a fixed centre
SpinnerDotsOrbitthree dots dance — one orbits a half-circle over the others
SpinnerDotsCircletwo dots slide while a third orbits a full circle
SpinnerDotsSquarethree dots chase around the corners of a square
SpinnerDotsShufflefour dots fan out into loops and shuffle back into a row
SpinnerDotsSplitthree dot pairs open to the edges and close, in a left→right wave
SpinnerDotsLeadera leader dot sweeps left→right while trailing pairs shift columns
SpinnerDotsRollinga row of dots mirror-flips while a rotating overlay carousels them
SpinnerDotsTrianglethree dots on a triangle rotate one corner clockwise each half-cycle
`SpinnerDotsCascade$\text{three} \text{dots} \text{drop} \text{one}-\text{by}-\text{one} \text{into} \text{a} 3 \times 3 \text{grid}, \text{pause}, \text{then} \text{fall} \text{to} \text{the} \text{bottom} \text{row}
$SpinnerDotsSwap`a fixed centre dot; two satellites cycle horizontal → diagonal → vertical → swapped
SpinnerDotsSpreadfour dots stack left, fan into a row, pause, then collapse to the right
SpinnerDotsTwintwo mirrored dot-halves slide −25%, spin one turn, then slide back
SpinnerDotsHoptwo dots drop in turn while a third rolls across the top with a hop
SpinnerDotsJiggleside dots wobble at 40%/90%; the centre dot shakes elastically
SpinnerDotsVibratestatic side dots; the centre dot vibrates horizontally (1s) and vertically (0.5s)
SpinnerDotsWiperstatic side dots; two semicircles swing ±90° from left/right pivots
SpinnerDotsCollapsefour dots collapse inward in turn while a spread ring grows, then snap back
SpinnerDotsFliptwo columns of dots flip ±180° about the bottom pivot with a vertical bounce
SpinnerDotsTurntwo columns rotate −270° — left pivots at bottom, right at top (last 30% of cycle)
SpinnerDotsCarouseltwo dot-pairs swap via rotate-translate-rotate while the row slides 37.5%
SpinnerDotsHalfTurntwo dot-pairs at edges and thirds; both rotate ±180° in the last 20% of the cycle
SpinnerDotsSlideFliptwo halves slide toward centre while flipping ±180° about their inner dot
SpinnerDotsStaggerTurntwo offset dot-pairs rotate 180° in alternation (0.5 s stagger)
SpinnerDotsStretchtwo bars stretch (aspect 2.3→3.7) while bouncing ±8px in opposite directions
SpinnerDotsMirrorStretchlike Stretch plus translateX(±19px); loader mirror-flips vertically every 2 s
SpinnerDotsPinchcentre dot + 4 satellites pinch inward (box-shadow) while the group rotates 180°
SpinnerDotsCornersfour corner dots chase clockwise around a square (0.5 s per edge)
SpinnerDotsNudgeRotatetwo halves nudge ±400%/14 (30–70%) while the loader rotates 180° (30–50%)
SpinnerDotsUnfoldfour dots stack left then spread to 0/⅓/⅔/100%; mirror-flips every 1.5 s
SpinnerDotsShuttletwo fixed middle dots; end dots run a mirrored □ path (down → across → up)
SpinnerDotsSpreadShuttlelike Shuttle but shorter hop (400%/3); middle dots spread to edges (60–100%)
SpinnerDotsTriadtwo 3-dot clusters spread vertically then swap columns (0↔⅓, ⅔↔1)
SpinnerDotsSatellitestatic end dots; two centre dots orbit them (±1 turn, 0.5 s stagger)
SpinnerDotsTrackstatic end dots; two middle dots follow translate(±37.5%)+rotate (2 s loop)

text loaders

texts

imspinner_text.h adds a family of animated text loaders "Loading…" effects. They share a common signature SpinnerTextXxx(const char *label, float radius, ImColor color = white, float speed = …, …, const char *text = "Loading...") and the text is auto-scaled to fit a 2*radius-wide cell. A few take extra params (thickness, mode, etc.) see the notes column.

#include "../imspinner/imspinner_text.h"
...
ImSpinner::SpinnerTextTyping("typing", 30.f, ImColor(255, 255, 255), 1.f, 3, "Loading...");
functioneffectnotes
SpinnerTextFadewhole text pulses opacity in/out
SpinnerTextFadingper-character fading shimmer runs over the texttakes text, radius, fsize
SpinnerTextUnderlineunderline bar grows left→rightthickness
SpinnerTextUnderlineDotsdashed underline lights up dash by dashthickness, dashes
SpinnerTextTypingtrailing chars reveal one by onetail (≤0 = whole word)
SpinnerTextScrollseamless horizontal marquee
SpinnerTextColorFilltwo-tone fill / single moving highlightbg, mode (0 fill, 1 highlight)
SpinnerTextScrollColorsmulti-color scrolling marquee
SpinnerTextColorCycletext wipes through a 4-color palette
SpinnerTextBouncealternating letters bob up/down
SpinnerTextSplittop/bottom halves slide apart and wrapmode (0 sync, 1 delayed)
SpinnerTextUnderlineScrollunderline fills, then the text scrolls awaythickness
SpinnerTextRollalternating letters roll vertically
SpinnerTextColorfulper-letter color blink (rainbow palette)
SpinnerTextCascadeletters drop in from above / fall out one by one
SpinnerTextConveyorletters slide in from the right / out the left
SpinnerTextRevealletters fade in, then out, sequentially
SpinnerTextWavea hop wave travels across the letters
SpinnerTextSweepa bar sweeps across, inverting the text inside itbg
SpinnerTextShinea glint band passes over the textbg
SpinnerTextScrollSweepscroll + full-width inverting sweepbg
SpinnerTextSpotlighta round spotlight scans back and forth
SpinnerTextShakethe whole word jitters between offsetsmode (0 snap, 1 smooth)
SpinnerTextFlipflat "card flip" (rotateX → rotateY → scale)
SpinnerTextSpinthe two halves spin a full turn alternately
SpinnerTextTumblespin + flipsmode (0 flat, 1 3D perspective)
SpinnerTextSwirlalternating letters counter-rotate about the centre
SpinnerTextRollWavevertical roll wave across the letters
SpinnerTextVibratenervous per-letter vibration
SpinnerTextGlitchRGB-split chromatic-aberration buzzfixed R/G/B (no color)
SpinnerTextBlurrandom letters flicker out of focusfaked halo (no real blur)
SpinnerTextDropoutcharacters blink out (missing letters)
SpinnerTextScanlineVHS scanline displacement glitchmode (0 horizontal, 1 vertical)
SpinnerTextSquasha scanning band squashes the text vertically
SpinnerTextScrambleslot-machine scramble of the lettersfixed "Loading..." (no text)
SpinnerTextDecodeletters decode/encode into symbols
SpinnerTextVanishletters fly up & fade out, then drop back in

shape spinners

shapes

imspinner_shapes.h adds a family of shape-morphing spinners — squares, triangles, discs and arrows that fold, tumble, skew and spin. They are kept out of imspinner.h and surface under the Shapes tab of the demo gallery. Each one shares the standard signature SpinnerXxx(const char *label, float radius, float thickness, const ImColor &color = white, float speed = 1.f, int mode = 0). Most use the loader's own fixed colour (the color argument is ignored), and mode = 2 runs the timeline in reverse.

#include "../imspinner/imspinner_shapes.h"   // pulls in imspinner.h
...
ImSpinner::SpinnerMorphShape("morph", 16.f, 1.f);
ImSpinner::SpinnerPinwheel("pinwheel", 16.f, 1.f, ImColor(255, 255, 255), 1.f, 0);
functioneffect
SpinnerMorphShapea blob morphs circle → square → triangle, recolouring at each step
SpinnerFlipTrianglea 3-corner triangle "rolls" around the box, one vertex sliding per quarter
SpinnerFoldSquaretwo triangles fold the square over onto the other diagonal
SpinnerPinwheelfour wedges pull apart into a pinwheel while spinning (box pulses 40→60)
SpinnerCornerSquaresfour corner squares spread, step one corner clockwise, then shrink back
SpinnerSplitSquaretwo halves slide apart into interlocking triangles and back
SpinnerCornerBurststatic diamond + four corner triangles burst out, rotate 90°, snap back
SpinnerSkewSquarehalves fly to opposite corners, return, then skewX reforms the square on the other diagonal
SpinnerTumbleSquarestacked squares swing ±180° about bottom corners while the block climbs and flips
SpinnerTriDiamondtwo halves morph triangle ↔ diamond while the container flips and turns 180°
SpinnerTwinBladestwo triangular blades spin in stepped half-turns, offset 90°
SpinnerCrossBladesstatic bow-tie + two blades rotate −270° about opposite corners; container mirrors
SpinnerDriftSquaretwo halves drift together along a diagonal, rotate 180°, return
SpinnerPieBouncea 270° pie steps 90° per second while a rounded quarter bounces into the gap
SpinnerLeapFrogtwo half-panels hinged at bottom-centre fold ±90° while the assembly climbs and flips
SpinnerPlusSquaresstatic plus; four corner squares expand, rotate 90°, contract
SpinnerSevenMarchtwo point-reflected "7" tiles march up/right and rotate −90°
SpinnerCornerArcscentre dot + annulus splits into four quarter-arcs that pull apart and rotate 90°
SpinnerWalkBlockstwo half-squares walk apart/down while the bar climbs and flips
SpinnerTumbleHalfDisca disc of two semicircles tumbles, folding about the bottom point, while climbing
SpinnerFoldHalfDisctwo semicircles swap places, each rotating about a box corner
SpinnerWiperArrowconic-wedge arrow; two corner triangles wipe like windshield wipers; container flips/rotates
SpinnerSkewSquaresa diagonal band skews while two corner triangles rotate 180° with a growing outline
SpinnerStretchSquarestwo overlapping squares slide apart diagonally, then squeeze to half width / double height
SpinnerTriPiethree 120° pie wedges bloom apart from a disc, spin 180°, then close back together
SpinnerShuffleBarsa square splits into two interlocking combs that slide apart, shuffle a cell, and reassemble
SpinnerHingeTumblea square with two triangular flaps hinged at one corner swings them ±90° and tumbles around it
SpinnerDiagonalFlipa diagonally-split square swings one half out on a hinge, then flips to split along the other diagonal
`SpinnerPulseGrid$\text{a} 3 \times 3 \text{grid} \text{of} \text{squares} \text{pulses} \text{between} \text{a} \text{packed} \text{solid} \text{block} \text{and} \text{a} \text{spread}-\text{apart} \text{dotted} \text{grid}
SpinnerMarchGridSpinnerMarchGrid\text{a} 3 \times 3 \text{grid} \text{whose} \text{eight} \text{outer} \text{squares} \text{march} \text{one} \text{cell} \text{clockwise} \text{around} \text{the} \text{ring} \text{while} \text{it} \text{pulses}
$SpinnerSpinBars`three vertical bars spread apart, quarter-turn together, then pack back into a square
SpinnerMorphDotssquares morph between a quincunx and a plus, passing through three solid bars
SpinnerCombDiscstwo complementary striped discs slide apart, spin 180°, and re-interlock into a solid circle
SpinnerOrbitDisca striped disc orbits a half-circle around its static twin, spinning 180°, then re-merges

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT