Skip to content
Putting technology to work.
Insights to guide decisions and action.

Search articles

Creating movement without JS using CSS offset-path: delivering lightweight rich expressions in client work

Table of contents · 6 items

"We'd like a bit more motion on the top page"—this request from clients is among the most frequent in client web development. Aiming to accommodate it, developers often add an animation library and write scripts to update element coordinates over time. In demos, it looks seamless. A few months later, however, perceived page load feels sluggish, stuttering occurs on smartphones, and the animation flies offscreen the moment another developer adjusts the DOM during a site refresh. Every time "motion" is added, maintenance overhead and performance debt quietly mount. The root cause is relying excessively on JavaScript for motion implementation.

If all you need is to move an element along a predetermined trajectory (path), it can now be written almost entirely without JavaScript using CSS offset-path. As outlined in CSS-Tricks' June 2026 reference offset-path (CSS-Tricks Almanac), this feature is widely implemented across browsers and ready for production use. In this article, we explain concretely from a development standpoint how to use offset-path as a tool for creating lightweight, resilient motion in client projects, as well as where it should not be used.

Why Coordinate Animation in JavaScript Becomes a Liability

Moving elements along curves using JavaScript typically involves calculating and mutating the element's transform or top/left on every frame. While functional, three major drawbacks emerge later in client projects:

First is main thread overhead. When JS continuously calculates coordinates in response to scrolls or taps, the browser makes other processing (such as input responsiveness) wait. As elements multiply, frame drops and stuttering become pronounced on lower-end smartphones.

Second is tight coupling with layout. Implementations mutating top/left frequently trigger browser layout recalculations, compounding sluggishness. Furthermore, hardcoding coordinates as "starting from this position on this element" causes the entire origin of motion to drift when surrounding markup changes during subsequent renewals.

Third is siloed maintenance. Defining paths using library-specific syntax prevents successors unfamiliar with that library from modifying it, turning it into unmaintainable legacy code left untouched out of fear of breaking it. In client web development, this unmaintainable motion directly inflates maintenance estimates.

offset-path alleviates all three issues. Defining paths in CSS allows the motion itself to run on the browser's compositor layer alongside properties like transform, avoiding main thread monopolization. Declarative, JS-free UI styling continues the philosophy of shifting behavior into CSS declarations explored in our article on JS-free anchor positioning.

Basics of offset-path: Thinking in "Tracks" and "Vehicles"

The mental model of offset-path is simple: lay a "track" for an element and run it along that track like a "vehicle." The track corresponds to offset-path, the vehicle's position along the track is indicated by offset-distance, and whether the vehicle rotates to face the direction of travel is governed by offset-rotate.

For example, moving an element to the right along a gentle curve is written as follows:

.float-icon {
  /* 線路:3次ベジェ曲線で緩いS字を描く */
  offset-path: path("M 0 50 C 80 0, 160 100, 240 50");
  /* 車両の初期位置:線路の始点 */
  offset-distance: 0%;
  /* 進行方向に要素を向けない(アイコンを水平に保つ) */
  offset-rotate: 0deg;
  animation: move-along 6s ease-in-out infinite alternate;
}

@keyframes move-along {
  to {
    offset-distance: 100%; /* 線路の終点まで走らせる */
  }
}

The key takeaway is that the only animated property is offset-distance (0% → 100%). Instead of calculating individual coordinates, you only animate a one-dimensional value indicating travel from 0% to 100% along the track. Because the path itself is fixed in offset-path, travel dynamics (speed, easing, alternating loops) and the shape of the path can be managed independently.

Track geometry is not limited to Bézier curves in path(); basic shapes like circle() and ellipse() can also be used. For instance, rotating an element around a circular perimeter is configured like this:

.orbit {
  offset-path: circle(120px at center);
  offset-rotate: auto; /* 進行方向に要素を向ける(公転する月のように) */
  animation: orbit 20s linear infinite;
}
@keyframes orbit {
  to { offset-distance: 100%; }
}

Setting offset-rotate: auto makes the element face its direction of travel. This is effective when animating arrows or paper airplane icons along a trajectory, whereas fixing it with 0deg when logos or text should not rotate is an important distinction in practice.

Where It Can Actually Be Used in Client Work

While dazzling demos are easy to build, the appropriate use cases in client web development are selective. The two areas where we actively adopt it are continuous ambient decorative animations and lightweight scroll-linked flourishes.

The former includes looping decorative icons or floating particles gently drifting through hero sections. The latter ties element progression along a path to scroll depth, binding offset-distance to scroll progress rather than elapsed time. For scroll integration, pairing it with animation-timeline: scroll() as discussed in our article on scroll-driven animations allows driving the offset-path trajectory via scroll without JavaScript. Dividing responsibilities—defining the track with offset-path and controlling velocity via the scroll timeline—makes them exceptionally compatible.

Conversely, it is unsuitable for trajectories that change dynamically based on user interaction (such as freeform dragging or runtime path recalculations from data). Those belong firmly in the realm of JavaScript. Treating offset-path strictly as a dedicated tool for running elements smoothly along predefined paths is the key to preventing maintenance headaches.

Applicationoffset-pathJavaScript
Continuous ambient loops and scroll-linked flourishesSuitable (lightweight, resilient)Overkill
Path movement facing the direction of travelSuitable (offset-rotate: auto)Redundant
Path geometry changes dynamically via user interactionUnsuitableSuitable

Pitfalls When Integrating Agents in Custom Development

In a corporate website project for a cosmetic clinic that GleamHub took over (company name withheld), the engagement began with addressing slow top-page decorative animations. Inspecting the previous agency's implementation revealed that JavaScript was recalculating coordinates every frame for over a dozen decorative elements, causing the entire hero section to stutter during mobile scrolling.

We replaced these decorations by defining paths per element using offset-path and animating offset-distance back and forth via CSS animations. We eliminated JavaScript entirely and exposed path geometry and speed as CSS variables for easy subsequent fine-tuning. The visual presentation remained virtually unchanged. All we did was shift motion calculated by JS every frame into declarative motion where the browser excels. As a result, stuttering on low-spec devices disappeared, and we completely removed an entire animation library from the JavaScript bundle.

The most valuable lesson learned from this project was to ensure motion can be stopped "whenever and wherever" needed. Decorative animations pose an accessibility issue if they continue running when users have enabled "reduce motion" settings. Even when using offset-path, always include a branch that stops it using prefers-reduced-motion as shown below.

@media (prefers-reduced-motion: reduce) {
  .float-icon, .orbit {
    animation: none; /* 動きを止め、初期位置に固定 */
  }
}

Another pitfall is the coordinate system of the path. Because coordinates in path() are interpreted as offsets from an element's reference position, changes in element size in responsive designs also alter how the trajectory appears. Using a fixed-pixel path as-is across both large and small screens can cause decorations to overflow off-screen on smartphones. You need to make deliberate choices, such as switching paths per breakpoint or opting for shapes like circle() that are easy to define relatively. Furthermore, when drawing the line on how far to adopt such practical, new CSS features in production, you can directly apply the mindset discussed in the article on modern native CSS features—checking Baseline to decide whether adoption is viable.

Where to begin

Sites become lighter once you stop reflexively adding libraries whenever someone asks for "more movement." For decorations or scroll effects with predefined trajectories, first consider whether they can be written with offset-path. If they can, you eliminate one piece of JavaScript, and the motion definition remains in CSS where the next maintainer can easily trace it.

As a first step, we recommend picking one decorative animation currently running with a fixed trajectory and attempting to replace it with offset-path + offset-distance. From there, once you verify the branch for prefers-reduced-motion and ensure the trajectory does not overflow on responsive screens, it will reach production-ready quality.

If you are facing issues such as sluggish site performance, animations breaking with every redesign, or a desire to reduce library dependencies, please reach out through the GleamHub contact form. We can review your current site's animation implementation, isolate parts that can be shifted to native CSS from those that cannot, and rebuild them into a lightweight, easily maintainable structure.

Sources

Share this articleXFacebook
Kakeru Suzuki

Fascinated by the possibilities of technology, has had a deep interest in programming and digital art since student days

Turn this article's theme into your company's next step

Starting from what you want to achieve with your website.

We organize user goals, required features, and ongoing maintenance structures to determine the first steps in development and improvement.

  • Website objectives
  • Features and usability
  • Post-launch operations
Consult on web development and improvements

You can consult with us from the initial conceptual stage. Details from this article will be carried over to the inquiry form.

Receive the latest articles via email · Read the web production guide
Free download

Complete Guide to Web Production: Costs, Vendor Selection & Traffic Acquisition [2026 Edition]

We have compiled cost benchmarks, vendor selection criteria, and traffic acquisition strategies into a PDF.

The PDF and newsletter emails are currently in Japanese.

You will also be subscribed to our newsletter. You can unsubscribe at any time.