< drag to rotate >

loading
Go to angle

ease360° is a physics-based 360° image sequencer built for the web. Drag, release, coast — the spin feels earned, not programmed. Built on HTML5 canvas with zero dependencies, it gives you precise control over every frame, every breakpoint, and every pixel. Serve your assets from any CDN via URL parameters, or drop in the ease360° Cloudinary helper to generate responsive frame sets on the fly — no static image folders, no manual resizing, no overhead. Trusted in production at Hyundai USA.

Designed, built and maintained by Derek Dintzner. Open source under the MIT license — contributions welcome on GitHub.

Features

  • Physics-based spin — damping engine with configurable friction
  • Zero dependencies — pure vanilla JS, no jQuery, no build tools
  • Responsive breakpoints — per-breakpoint frame sets, dimensions, and crop control
  • CDN-native — serve frames from Cloudinary, Imgix, or any image CDN via URL transforms
  • ease360.cdn.js — built-in Cloudinary helper generates responsive frame sets from a single master upload
  • Smart preloading — loads 50% of frames first, remainder on first interaction
  • Transparent PNG and WebP sequence support
  • UMD — works with AMD, CommonJS, ESM, or a plain script tag

Download

Get it on GitHub

Settings

Option Type Required Default Description
frames array ✅ null Ordered array of image paths.
sourceWidth int — null Pixel width of the delivered image. Optional — when omitted, ease360° probes frames[0] automatically. Provide it to skip the probe: synchronous init, no CORS dependency. Must match the delivered size, not the master. See Ex 1 — sourceWidth & sourceHeight.
sourceHeight int — null Pixel height of the delivered image. Optional — same probe behaviour as sourceWidth. Both must be provided together to skip the probe; providing only one still triggers it.
frameDirection int — 1 Set -1 to reverse sequence direction.
startAngle int — 0 Initial angle on load (0–359).
backgroundSize enum — 'stretch' 'stretch' sizes images to fill the element. 'cover' fills while preserving aspect ratio. 'cover-center' and 'cover-top' control vertical crop alignment.
backgroundOffsetX float — 0 X offset in px when backgroundSize is a cover mode.
backgroundOffsetY float — 0 Y offset in px when backgroundSize is a cover mode.
preloadSmart boolean — false Loads every other frame first (50%), remaining frames load on first interaction. Requires an even-length frames array.
flex object — { w: false } Set { w: true } for percentage-width containers.
dragDirection enum — 'left-right' Which drag direction drives the spin. 'left-right' = horizontal. 'up-down' = vertical. 'all' = both. Previously dragAxis, touchdirection.
dragThreshold int — 4 Pixels the pointer must move before the drag axis is locked.
damping float — 0.95 Physics friction. Range 0.85 (firm) → 0.98 (fluid). A value of 1.0 creates a continuous spin.
transparencySupport boolean — true Clears the canvas before each frame draw. Set false for opaque/legacy behavior.
responsive array — — Array of breakpoint objects — see table below. When used, sourceWidth and sourceHeight are not required at the top level.

✅ * Required unless using responsive.

Breakpoint object

Each entry in the responsive array defines a complete frame set for a viewport width range. ease360° activates the first entry whose breakpoint value is ≥ the current viewport width. All per-breakpoint options override their top-level equivalents for that range only.

Key Type Required Description
breakpoint int ✅ Max viewport width in px at which this set activates.
frames array ✅ Ordered array of image paths for this breakpoint.
sourceWidth int — Pixel width of the delivered image at this breakpoint. Optional — omit to let ease360° probe. Providing it skips the probe for this slot: faster init, no CORS dependency. Previously width (v0.x).
sourceHeight int — Pixel height of the delivered image at this breakpoint. Optional — same probe behaviour as sourceWidth.
flex object — { w: true } to fill a percentage-width container. Height recalculates to maintain ratio.
backgroundOffsetY float — Vertical crop offset in px. Fine-tune the subject position within the canvas independently per breakpoint.
backgroundOffsetX float — Horizontal crop offset in px.
backgroundSize enum — Override backgroundSize for this breakpoint only.
preloadSmart boolean — Override smart preloading for this breakpoint only.
startAngle int — Override starting angle for this breakpoint only — useful when a different hero angle looks better on mobile.

Properties

Property Type Description
.progress float 0–1 loading progress of the current frame set. getter

Methods

Method Parameters Description
angle() — Returns the current angle (0–359). getter
angle(value) int Sets the angle instantly. setter
angleTo(angle, duration?) int, float Animates to the specified angle by the shortest way round (350° to 10° turns forward 20°). Duration in seconds, defaults to 0.5.
angleTo(angle, options) int, object options: speed (degrees per second, so the time scales with the distance), duration (seconds), minDuration (default 0.35), shortest (default true; false for a multi-turn spin) and loadFrames (default true).
angleStep(angle) int Jumps angle by an offset relative to the current position — positive or negative. Cancels a running angleTo().
spinOver(speed?) float Continuous spin. Speed can be positive or negative, defaults to 1.0. Intended for hover/rollover effects.
spinOut() — Cancels spinOver().
changeFrames(frames, options?) array, object Swaps the frame set of a viewer set up with frames. Waits for the engine to stop, then loads the new frames behind the current picture. options: see Changing frames.
changeFramesResponsive(sets, sizes?, options?) array of arrays, array, object Swaps the frame sets of a viewer set up with responsive, one set per breakpoint, in the same order. Waits for the engine to stop, then loads the new frames behind the current picture. sizes and options: see Changing frames.
isLoading() — Returns true from the start of a frame swap until the first set of the new frames is loaded. getter
isLocked() — Returns true while a frame swap is loading and the viewer is locked (see the lock option). getter
destroy() — Removes the canvas, unbinds all events, and cancels any active animation.

Changing frames

changeFrames() and changeFramesResponsive() take the same options object as their last argument, and behave the same way. Without options the frames swap straight away. With options, ease360° holds the current picture as a snapshot over the viewer, loads the new set behind it, and fades the snapshot out only once the new frames are loaded and drawn. See Ex 4 for a working color picker.

Option Type Default Description
fade boolean | number false true fades the old picture out over 500ms; a number sets the milliseconds. Skipped for visitors who ask for reduced motion.
minLoadTime number (ms) 0 Keeps the old picture and the loading state up for at least this long, so a fast connection doesn't flash a spinner.
loadStart function — Called with the instance when the swap begins.
loaded function — Called with the instance when the first set of the new frames is loaded and drawn, as the fade starts.
timeout number (ms) 15000 A set that has not loaded by then counts as failed.
error function — Called with (info, instance) when the swap fails. info.reason is "load" (a frame failed; info.file says which) or "timeout". info.reverting is true when the previous frames are being put back.
revert boolean true On failure, put the previous frames back behind the old picture. false leaves it to error, for instance to retry.
reverted function — Called with the instance once the previous frames are back.
lock boolean true Ignore drag, angleTo(), angleStep() and spinOver() while the new set loads. false leaves the viewer live.

changeFramesResponsive() also takes sizes, an optional array of { sourceWidth, sourceHeight }, one per breakpoint, for sets delivered at a different size than the original. The status callback reports "loading", then "loaded" (or "error").

Callbacks

Callback Argument Description
progressUpdate float (0–1) Fired on every frame load tick.
angleUpdate int (0–359) Fired on every angle change during render.
responsiveUpdate breakpoint object Fired when the active responsive breakpoint changes.
stateUpdate string Fired on engine status change. Values: 'init', 'start', 'active', 'stop'.

Example

Below is the initialization code used for the Genesis GV70 demo above: one 72-frame master set, resized per breakpoint. ease360° works with any image CDN that supports on-the-fly URL transforms — resize, format, and quality parameters passed directly in the URL. No static image folders, no manual resizing. Cloudinary is used here as the example, but the same pattern works with Imgix, Bunny, Fastly, and others.

// Cloudinary config — one master set, resized per breakpoint via URL
// w_{n}   = resize to width n px, height scales proportionally
// q_auto  = Cloudinary selects optimal compression automatically
// f_webp  = force WebP delivery (~25–35% smaller than JPEG at same quality)
//           use f_auto instead for JPEG fallback on older browsers
const cdn = {
    cloud:  'YOURCLOUDID',
    prefix: '2027_EGV70_ADV_AWD_CeresBlue_72f'   // public ID, before the frame number
};

const FRAME_COUNT = 72;

// Build a frame array for a given width.
// Frames are numbered from zero with 3-digit padding: _000 → _071
// ar_4:3,c_fill crops the 16:9 master to a centered 4:3 frame before resizing; the
// mobile breakpoints use it to get 4:3 frames.
const makeFrames = (width, crop43 = false) =>
    Array.from({ length: FRAME_COUNT }, (_, i) => {
        const frame = String(i).padStart(3, '0');
        const crop  = crop43 ? 'ar_4:3,c_fill,' : '';
        return `https://res.cloudinary.com/${cdn.cloud}/image/upload/${crop}w_${width},q_auto,f_webp/${cdn.prefix}_${frame}.webp`;
    });

const myEase360 = ease360('#myEase360', {
    backgroundSize: 'cover-center', // fill the canvas; any crop is split evenly top and bottom
    preloadSmart:   true,           // load 50% of frames first, rest on first interaction
                                    // (needs an even frame count; 72 qualifies)
    damping:        0.94,           // physics friction — 0.85 (firm) → 0.98 (fluid)

    // ── Responsive breakpoints ────────────────────────────────────────────────
    // Each entry defines a frame set for a max-viewport-width range.
    // ease360° monitors the viewport and automatically swaps to the correct
    // set on resize, triggering responsiveUpdate() during the transition.
    //
    // sourceWidth / sourceHeight are the pixel size of the frames delivered
    // for that set. Every set here is 16:9, so height = width × 9 / 16.
    // Providing both skips the probe of frames[0].
    //
    // Per-breakpoint options worth tuning:
    //   backgroundOffsetY — vertical crop adjustment in px
    //   backgroundOffsetX — horizontal crop adjustment in px
    //   backgroundSize    — override crop mode per breakpoint
    //   preloadSmart      — toggle smart preload per breakpoint
    //   startAngle        — set a different starting angle per breakpoint
    responsive: [

        // Wide desktop (≤ 1920px) — also serves every wider viewport. There is no
        // oversized catch-all breakpoint (9999 and the like): the first entry is the fallback,
        // so 1920px and above always gets the 1920px set. Full screen on a
        // larger display swaps in the 2560px set (see Full screen below).
        { breakpoint: 1920, frames: makeFrames(1920), sourceWidth: 1920, sourceHeight: 1080, flex: { w: true } },

        // Desktop (≤ 1440px)
        { breakpoint: 1440, frames: makeFrames(1440), sourceWidth: 1440, sourceHeight: 810,  flex: { w: true } },

        // Laptop (≤ 1024px)
        { breakpoint: 1024, frames: makeFrames(1024), sourceWidth: 1024, sourceHeight: 576,  flex: { w: true } },

        // Tablet (≤ 768px)
        { breakpoint: 768,  frames: makeFrames(768),  sourceWidth: 768,  sourceHeight: 432,  flex: { w: true } },

        // Mobile (≤ 640px) — 4:3 frames
        { breakpoint: 640,  frames: makeFrames(640, true), sourceWidth: 640, sourceHeight: 480, flex: { w: true } },

        // Mobile small (≤ 375px) — lightest set, optimized for bandwidth
        { breakpoint: 375,  frames: makeFrames(375, true), sourceWidth: 375, sourceHeight: 281, flex: { w: true } }

    ],

    angleUpdate:      () => myAngleUpdate(),     // fires on every rendered frame
    progressUpdate:   () => myProgress(),        // fires on every image load tick (0 → 1)
    responsiveUpdate: () => myResponsiveUpdate() // fires when breakpoint changes on resize
});

// Start the minimum loader display timer once ease360() has been called
timerStatus = 'timerWorking';
timer = setTimeout(() => { timerStatus = 'timerComplete'; }, MIN_MS);

// ── Full screen ───────────────────────────────────────────────────────────────
// Shows the whole 16:9 frame. Needs an expand button inside #ease360Layout
// (see Full screen below) and the myResponsiveUpdate() callback declared above.
const layout = document.getElementById('ease360Layout');
const btn    = document.getElementById('expandBtn');

const HI_RES_MIN = 1920;   // full-screen viewer wider than this → use the 2560px set
let   hiRes      = false;

const canNative = !!(layout.requestFullscreen || layout.webkitRequestFullscreen);
const nativeOn  = () => !!(document.fullscreenElement || document.webkitFullscreenElement);
const isOn      = () => nativeOn() || layout.classList.contains('is-fs');

// Width the viewer will have in full screen: the largest 16:9 box on the screen
// (the window itself where the browser has no Fullscreen API).
const fullscreenWidth = () => canNative
    ? Math.min(screen.width, screen.height * 16 / 9)
    : Math.min(innerWidth,   innerHeight   * 16 / 9);

// Swap the first responsive entry (it serves wide viewports) between 1920 and 2560.
const useHiRes = (want) => {
    if (want === hiRes) return;
    hiRes = want;
    const sets = myEase360.responsive.map((r) => r.frames);
    sets[0] = makeFrames(want ? 2560 : 1920);
    // The new frames are a different pixel size: tell ease360 so it crops from the
    // right source rectangle (otherwise a 2560px frame is drawn as if it were 1920px).
    const w = want ? 2560 : 1920, h = want ? 1440 : 1080, first = myEase360.responsive[0];
    first.sourceWidth = first.width = w;
    first.sourceHeight = first.height = h;
    if (myEase360.responsiveActive === 0) { myEase360.width = w; myEase360.height = h; }
    myResponsiveUpdate();                        // spinner while the new set loads
    myEase360.changeFramesResponsive(sets);
};

const sync = () => {
    const on = isOn();
    layout.classList.toggle('is-fs', on);
    useHiRes(on && fullscreenWidth() > HI_RES_MIN);
    btn.setAttribute('aria-label', on ? 'Exit full screen' : 'Expand to full screen');
    document.documentElement.style.overflow = on ? 'hidden' : '';
    // ease360° re-measures its container on the window resize event
    requestAnimationFrame(() => window.dispatchEvent(new Event('resize')));
};

const enter = () => {
    layout.classList.add('is-fs');          // CSS fallback layer where the API is missing
    if (canNative) {
        const request = layout.requestFullscreen || layout.webkitRequestFullscreen;
        try { const r = request.call(layout); if (r && r.catch) r.catch(() => {}); } catch (_) {}
    }
    sync();
};

const leave = () => {
    if (nativeOn()) (document.exitFullscreen || document.webkitExitFullscreen).call(document);
    layout.classList.remove('is-fs');
    sync();
    btn.focus();
};

btn.addEventListener('click', () => (isOn() ? leave() : enter()));
document.addEventListener('fullscreenchange', () => { if (!nativeOn()) layout.classList.remove('is-fs'); sync(); });
document.addEventListener('keydown', (e) => {
    if (e.key === 'Escape' && layout.classList.contains('is-fs') && !nativeOn()) leave();
});

Callbacks & Controls

The three callbacks below power everything you see in the GV70 demo above — the spinner that holds until the first half of the frames is in, the canvas fade-in, the "drag to rotate" prompt, and the seamless breakpoint swap on resize. Declare them before the ease360() call. The goto() function shows how the angle buttons are wired to angleTo(), the same method you can attach to any hotspot, color swatch, or UI trigger in your own build.

// Declare these before the ease360() call — progressUpdate can fire during init.

// ── Minimum loader display time ───────────────────────────────────────────────
// Keep the spinner up for at least MIN_MS so a fast cache hit doesn't flash it.
const MIN_MS    = 1000;
let timerStatus = 'timerComplete';
let timer;

// ── Reveal the canvas ─────────────────────────────────────────────────────────
const hideLoader = () => {
    document.querySelector('#myEase360 canvas').classList.add('opacity1');
    const loading = document.querySelector('.loading');
    loading.classList.add('opacity0');
    setTimeout(() => {
        loading.style.zIndex = '0';
        document.querySelector('#ease360Layout h3.instructions').classList.add('opacity1');
    }, 600);
};

// ── progressUpdate ────────────────────────────────────────────────────────────
// ease360.progress returns a 0–1 float.
// When preloadSmart is true, only 50% of frames load first — multiply by 2
// so the first phase reaches 100% and the viewer can be revealed.
const myProgress = () => {
    const inSmartPhase = myEase360.preloadSmart &&
                         myEase360.totalLoaded <= myEase360.frames.length / 2;
    const pct = Math.floor(myEase360.progress * 100) * (inSmartPhase ? 2 : 1);
    if (pct !== 100) return;
    if (timerStatus !== 'timerComplete') {
        const recheckTimer = () => {
            if (timerStatus !== 'timerComplete') { setTimeout(recheckTimer, 50); return; }
            hideLoader();
        };
        recheckTimer();
    } else {
        hideLoader();
    }
};

// ── responsiveUpdate ──────────────────────────────────────────────────────────
// Fired when the viewport crosses a breakpoint and ease360° swaps frame sets.
// Re-show the loader while the new set downloads.
const myResponsiveUpdate = () => {
    const loading = document.querySelector('.loading');
    loading.classList.remove('opacity0');
    loading.style.zIndex = '1000';
    document.querySelector('#myEase360 canvas').classList.remove('opacity1');
    timerStatus = 'timerWorking';
    clearTimeout(timer);
    timer = setTimeout(() => { timerStatus = 'timerComplete'; }, MIN_MS);
};

// ── angleUpdate ───────────────────────────────────────────────────────────────
// Fired on every rendered frame while the viewer is moving.
// Fade out the "drag to rotate" instruction on first interaction.
const instructions = document.querySelector('.instructions');
const myAngleUpdate = () => instructions.classList.remove('opacity1');

// ── angleTo — button controls ─────────────────────────────────────────────────
// Wire angleTo() to any button, hotspot, or UI event. ease360 1.0.7 takes the shortest
// way round, and `speed` (degrees per second) keeps every spin at the same pace, so a
// short trip is quicker than a long one. The first call also loads the rest of a
// preloadSmart set, and a drag takes over from a running spin. Cubic ease-out curve.
//
// HTML: <button onclick="goto(90)">90°</button>
const DEG_PER_SEC = 72;   // steady spin speed: the longest trip (180°) takes 2.5s, 72° takes 1s
const CHEVRON_DEG = 30;   // how far one click on a chevron button turns the viewer

// Go to an angle. A new press replaces a spin that is still running (angleTo() ignores
// calls while a spin is in progress, so stop the old one first).
const goto = (angle) => {
    if (myEase360.timeline.activeTween) myEase360.stopInterval();
    myEase360.angleTo(angle, { speed: DEG_PER_SEC });
};
const spinBy = (delta) => goto(myEase360.timeline.angle + delta);

// ── Chevron buttons and arrow keys ────────────────────────────────────────────
// Right = same direction as dragging right. The viewer is focusable (tabindex="0"), and
// the arrow keys step it one frame at a time; holding a key keeps it turning.
document.getElementById('chevLeft').addEventListener('click',  () => spinBy(-CHEVRON_DEG));
document.getElementById('chevRight').addEventListener('click', () => spinBy(CHEVRON_DEG));

document.getElementById('ease360Layout').addEventListener('keydown', (e) => {
    if (e.target.id !== 'myEase360' || (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight')) return;
    e.preventDefault();
    const step = myEase360.loadedSet ? myEase360.loadedSet.engine : 10;   // degrees per loaded frame
    myEase360.angleStep(e.key === 'ArrowRight' ? step : -step);
});

Full screen

The expand button in the corner of the viewer shows the whole 16:9 frame instead of the cropped strip. It uses the browser Fullscreen API on the viewer's container and falls back to a fixed, full-window layer where that API is missing, such as iPhone Safari. Esc exits either way. ease360° re-measures its container on the window resize event, so the script dispatches one after every toggle.

Normal viewing never loads more than the 1920px set. Only when full screen will show the viewer wider than 1920px, such as on a 2560px monitor, does the script swap in the 2560px set with changeFramesResponsive(); leaving full screen swaps the 1920px set back.

The JavaScript for this is part of the Example above, directly after the ease360() call. It needs the markup below inside the viewer's container.

<button type="button" class="expand-btn" id="expandBtn" aria-label="Expand to full screen">…</button>

And the CSS that sizes the viewer while it is full screen:

/* The viewer becomes the largest 16:9 box that fits the screen, so the whole frame shows */
#ease360Layout.is-fs,
#ease360Layout:fullscreen {
    position: fixed; inset: 0; z-index: 1000;
    width: 100vw; height: 100vh;
    display: flex; align-items: center; justify-content: center;
}
#ease360Layout.is-fs #myEase360,
#ease360Layout:fullscreen #myEase360 {
    flex: none;
    width:  min(100vw, calc(100vh * 16 / 9));
    height: min(100vh, calc(100vw * 9 / 16));
}