User Rating 0.0
Total Usage 0 times
#2A7F2A
Is this tool helpful?

Your feedback helps us improve.

About

The Windows Solitaire victory cascade is one of computing's most recognizable animations. Cards launch from the tableau and bounce across the screen, leaving persistent color trails that gradually fill the viewport. Recreating this effect requires precise Euler integration of ballistic trajectories - each card follows a parabolic arc under gravitational acceleration g = 9.8 m/s2 (scaled to pixel space), with horizontal velocity vx held constant and vertical velocity vy incremented per frame. On boundary collision, vy is negated and multiplied by a restitution coefficient e 0.85 to model energy loss. The persistent trail - the signature visual - is achieved by stamping the card's rendered state onto a background buffer at each physics step without clearing the canvas.

Encoding this animation into a GIF file is non-trivial. The GIF89a format requires LZW compression of indexed-color image data, meaning each full-color canvas frame must first be quantized to a 256-color palette. This tool performs median-cut color quantization and full LZW encoding entirely in the browser via a Web Worker. No server round-trips. No external services. Limitations: GIF is capped at 256 colors per frame, so subtle gradients may exhibit banding. Output file sizes scale quadratically with canvas dimensions - a 400×300 canvas at 60 frames produces files of approximately 1 - 4 MB.

solitaire effect gif generator card cascade windows solitaire animation gif retro effect card bounce

Formulas

Each card's position is updated per frame using discrete Euler integration:

xn+1 = xn + vx
vyn+1 = vyn + g
yn+1 = yn + vyn+1

Bounce condition: when y + h H (canvas height), the vertical velocity reverses with energy loss:

vy vy × e

Where x, y are card position in pixels, vx is constant horizontal velocity (2 - 5 px/frame), vy is vertical velocity, g is gravitational acceleration in px/frame2, e is coefficient of restitution, h is card height, and H is canvas height.

GIF LZW compression operates on indexed pixel streams. The compressor builds a code table starting from 2minCodeSize + 2 entries (palette indices plus CLEAR and EOI codes). Variable-length codes grow from minCodeSize + 1 bits up to a maximum of 12 bits. When the table reaches 4096 entries, a CLEAR code resets the table.

Reference Data

ParameterDefaultRangeEffect
Canvas Width480 px200 - 800Horizontal resolution of output GIF
Canvas Height360 px150 - 600Vertical resolution of output GIF
Card Count81 - 20Number of cascading cards
Frame Count6020 - 120Total frames in GIF (duration control)
Frame Delay50 ms20 - 200Delay between frames (speed perception)
Gravity (g)0.5 px/f20.1 - 2.0Downward acceleration per frame
Restitution (e)0.850.5 - 0.99Energy retained on bounce (1 = perfect elastic)
Card Width40 px20 - 80Width of each card rectangle
Card Height56 px28 - 112Height of each card rectangle
Background Color#2A7F2AAny hex colorClassic green felt; customizable
Launch Interval4 frames1 - 15Frames between sequential card launches
GIF Color Depth256 colorsFixedGIF89a maximum palette size
LZW Min Code Size8 bitsFixedStarting code size for LZW compression
Max LZW Code Size12 bitsFixedGIF spec maximum code width

Frequently Asked Questions

GIF file size scales with canvas dimensions multiplied by frame count. A 480×360 canvas at 60 frames produces approximately 60 uncompressed frames of 172,800 pixels each. LZW compression helps, but GIF is inherently inefficient for photographic content. Reduce canvas size to 320×240 or decrease frame count to 40 for significantly smaller files. Simpler color schemes (fewer unique colors) also compress better because LZW finds longer repeated sequences.
GIF89a supports a maximum of 256 colors per frame via an indexed color table. This tool uses median-cut quantization to select the optimal 256 colors from the full-color canvas. If your cards use many distinct hues against a gradient background, some colors will be approximated to the nearest palette entry, causing visible banding. Using a solid background color and limiting card colors to 6-8 distinct hues produces the cleanest results.
Two parameters control perceived speed. Frame delay (in milliseconds) sets the pause between frames - lower values mean faster playback. The physics gravity value controls how quickly cards accelerate downward within each frame. A frame delay of 50 ms with gravity 0.5 produces the classic Solitaire feel. Note that some GIF viewers clamp minimum frame delay to 20 ms, and browsers may round delays below 20 ms up to 100 ms.
This tool uses a solid background to match the original Solitaire aesthetic, where the green felt is integral to the effect. GIF89a does support a single transparent color index, but the solitaire cascade effect depends on the card trail accumulating on an opaque surface. A transparent background would break the trail illusion since previously stamped cards would show through to whatever is behind the GIF.
By design, the classic Solitaire effect does not apply horizontal boundary collisions. Cards travel with constant horizontal velocity until they leave the visible area, which is faithful to the original Windows 3.0 implementation. If a card has high horizontal velocity and low frame count, it may exit before completing visible bounces. Increase frame count or reduce horizontal speed via the speed preset to keep cards visible longer.
LZW (Lempel-Ziv-Welch) builds a dictionary of pixel sequences. It starts with 256 single-pixel entries (one per palette color) plus CLEAR and EOI control codes. As it reads the pixel stream, it finds the longest sequence already in the dictionary, outputs that code, then adds the sequence plus the next pixel as a new entry. Codes start at 9 bits wide and grow to a maximum of 12 bits (4096 entries). When the table fills, a CLEAR code resets it. This produces compact output for images with repeated color patterns.