Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Designing With AI, Not Around It: Practical Advanced Techniques For Product Design Use Cases

      August 11, 2025

      Why Companies Are Investing in AI-Powered React.js Development Services in 2025

      August 11, 2025

      The coming AI smartphone: Redefining personal tech

      August 11, 2025

      Modern React animation libraries: Real examples for engaging UIs

      August 11, 2025

      How Debian 13’s little improvements add up to the distro’s surprisingly big leap forward

      August 11, 2025

      Why xAI is giving you ‘limited’ free access to Grok 4

      August 11, 2025

      How Apple may revamp Siri to a voice assistant I’d actually use (and ditch Gemini for)

      August 11, 2025

      I jump-started a bus from the 1930s with this power bank – here’s the verdict

      August 11, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Laravel’s UsePolicy Attribute: Explicit Authorization Control

      August 11, 2025
      Recent

      Laravel’s UsePolicy Attribute: Explicit Authorization Control

      August 11, 2025

      The Laravel Way to Build AI Agents That Actually Work

      August 11, 2025

      The Laravel Way to Build AI Agents That Actually Work

      August 11, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft sued over killing support for Windows 10

      August 11, 2025
      Recent

      Microsoft sued over killing support for Windows 10

      August 11, 2025

      Grok 4 rolled out for free-tier users worldwide, with some limits

      August 11, 2025

      Firefox AI slammed for hogging CPU and draining battery

      August 11, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Tech & Work»Smashing Animations Part 1: How Classic Cartoons Inspire Modern CSS

    Smashing Animations Part 1: How Classic Cartoons Inspire Modern CSS

    May 8, 2025

    Browser makers didn’t take long to add the movement capabilities to CSS. The simple :hover pseudo-class came first, and a bit later, the transitions between two states. Then came the ability to change states across a set of @keyframes and, most recently, scroll-driven animations that link keyframes to the scroll position.

    Even with these added capabilities, CSS animations have remained relatively rudimentary. They remind me of the Hanna-Barbera animated series I grew up watching on TV.

    These animated shorts lacked the budgets given to live-action or animated movies. They were also far lower than those available when William Hanna and Joseph Barbera made Tom and Jerry shorts while working for MGM Cartoons. This meant the animators needed to develop techniques to work around their cost restrictions and the technical limitations of the time.

    They used fewer frames per second and far fewer cells. Instead of using a different image for each frame, they repeated each one several times. They reused cells as frequently as possible by zooming and overlaying additional elements to construct a new scene. They kept bodies mainly static and overlayed eyes, mouths, and legs to create the illusion of talking and walking. Instead of reducing the quality of these cartoons, these constraints created a charm often lacking in more recent, bigger-budget, and technically advanced productions.

    The simple and efficient techniques developed by Hanna-Barbera’s animators can be implemented using CSS. Modern layout tools allow web developers to layer elements. Scaleable Vector Graphics (SVG) can contain several frames, and developers needn’t resort to JavaScript; they can use CSS to change an element’s opacity, position, and visibility. But what are some reasons for doing this?

    Animations bring static experiences to life. They can improve usability by guiding people’s actions and delighting or surprising them when interacting with a design. When carefully considered, animations can reinforce branding and help tell stories about a brand.

    Introducing Mike Worth

    I’ve recently been working on a new website for Emmy-award-winning game composer Mike Worth. He hired me to create a bold, retro-style design that showcases his work. I used CSS animations throughout to delight and surprise his audience as they move through his website.

    Mike loves ’80s and ’90s animation — especially Disney’s Duck Tales). Unsurprisingly, my taste in cartoons stretches back a little further to the 1960s Hanna-Barbera shows like Dastardly and Muttley in Their Flying Machines, Scooby-Doo, The Perils of Penelope Pitstop, Wacky Races, and, of course, Yogi Bear.

    So, to explain how this era of animation relates to CSS, I’ve chosen an episode of The Yogi Bear Show, “Home Sweet Jellystone,” first broadcast in 1961. In this story, Ranger Smith inherits a mansion and (spoiler alert) leaves Jellystone.

    Dissecting Movement

    In this episode, Hanna-Barbera’s techniques become apparent as soon as a postman arrives with a telegram for Ranger Smith. The camera pans sideways across a landscape painting by background artist Robert Gentle to create the illusion that the postman is moving.

    The background loops when a scene lasts longer than a single pan of Robert Gentle’s landscape painting, with bushes and trees appearing repeatedly.

    This can be recreated using a single element and an animation that changes the position of its background image:

    @keyframes background-scroll {
      0% { background-position: 2750px 0; }
      100% { background-position: 0 0; }
    }
    
    div {
      overflow: hidden;
      width: 100vw;
      height: 540px;
      background-image: url("…");
      background-size: 2750px 540px;
      background-repeat: repeat-x;
      animation: background-scroll 5s linear infinite;
    }
    

    The economy of movement was essential for producing these animated shorts cheaply and efficiently. The postman’s motorcycle bounces, and only his head position and facial expressions change, which adds a subtle hint of realism.

    Likewise, only Ranger Smith’s facial expression and leg positions change throughout his walk cycle as he dashes through his mansion. The rest of his body stays static.

    In a discarded scene from my design for his website, the orangutan adventurer mascot I created for Mike Worth can be seen driving across the landscape.

    I drew directly from Hanna-Barbera’s bouncing and scrolling technique for this scene by using two keyframe animations: background-scroll and bumpy-ride. The infinitely scrolling background works just like before:

    @keyframes background-scroll {
      0% { background-position: 960px 0; }
      100% { background-position: 0 0; }
    }
    

    I created the appearance of his bumpy ride by animating changes to the keyframes’ translate values:

    @keyframes bumpy-ride {
      0% { translate: 0 0; }
      10% { translate: 0 -5px; }
      20% { translate: 0 3px; }
      30% { translate: 0 -3px; }
      40% { translate: 0 5px; }
      50% { translate: 0 -10px; }
      60% { translate: 0 4px; }
      70% { translate: 0 -2px; }
      80% { translate: 0 7px; }
      90% { translate: 0 -4px; }
      100% { translate: 0 0; }
    }
    
    figure {
      /* ... */
      animation: background-scroll 5s linear infinite;
    }
    
    img {
      /* ... */
      animation: bumpy-ride 1.5s infinite ease-in-out;
    }
    

    Watch the episode and you’ll see these trees appear over and over again throughout “Home Sweet Jellystone.” Behind Yogi and Boo-Boo on the track, in the bushes, and scaled up in this close-up of Boo-Boo:

    The animators also frequently layered foreground elements onto these background paintings to create a variety of new scenes:

    In my deleted scene from Mike Worth’s website, I introduced these rocks into the foreground to add depth to the animation:

    If I were using bitmap images, this would require just one additional image:

    <figure>
      <img id="bumpy-ride" src="..." alt="" />
      <img id="apes-rock" src="..." alt="" />
    </figure>
    
    figure {
      position: relative; 
    
      #bumpy-ride { ... }
    
      #apes-rock {
        position: absolute;
        width: 960px;
        left: calc(50% - 480px);
        bottom: 0;
      }
    }
    

    Likewise, when the ranger reads his telegram, only his eyes and mouth move:

    If you’ve wondered why both Ranger Smith and Yogi Bear wear collars and neckties, it’s so the line between their animated heads and faces and static bodies is obscured:

    SVG delivers incredible performance and also offers fantastic flexibility when animating elements. The ability to embed one SVG inside another and to manipulate groups and other elements using CSS makes it ideal for animations.

    I replicated how Hanna-Barbera made Ranger Smith and other characters’ mouths move by first including a group that contains the ranger’s body and head, which remain static throughout. Then, I added six more groups, each containing one frame of his mouth moving:

    <svg>
      <!-- static elements -->
      <g>...</g>
    
      <!-- animation frames -->
      <g class="frame-1">...</g>
      <g class="frame-2">...</g>
      <g class="frame-3">...</g>
      <g class="frame-4">...</g>
      <g class="frame-5">...</g>
      <g class="frame-6">...</g>
    </svg>
    

    I used CSS custom properties to define the speed at which characters’ mouths move and how many frames are in the animation:

    :root {
      --animation-duration: 1s;
      --frame-count: 6;
    }
    

    Then, I applied a keyframe animation to show and hide each frame:

    @keyframes ranger-talking {
      0% { visibility: visible; }
      16.67% { visibility: hidden; }
      100% { visibility: hidden; }
    }
    
    [class*="frame"] {
      visibility: hidden;
      animation: ranger-talking var(--animation-duration) infinite;
    }
    

    Before finally setting a delay, which makes each frame visible at the correct time:

    .frame-1 {
      animation-delay: calc(var(--animation-duration) * 0 / var(--frame-count));
    }
    
    /* ... */
    
    .frame-6 {
      animation-delay: calc(var(--animation-duration) * 5 / var(--frame-count));
    }
    

    In my design for Mike Worth’s website, animation isn’t just for decoration; it tells a compelling story about him and his work. Every movement reflects his brand identity and makes his website an extension of his creative world.

    Think beyond movement the next time you reach for a CSS animation. Consider emotions, identity, and mood, too. After all, a well-considered animation can do more than catch someone’s eye. It can capture their imagination.

    Mike Worth’s website will launch in June 2025, but you can see examples from this article on CodePen now.

    Source: Read More 

    news
    Facebook Twitter Reddit Email Copy Link
    Previous ArticlePulumi IDP provides developers with faster access to self-service cloud infrastructure provisioning
    Next Article Name Queued Closures in Laravel 12.13

    Related Posts

    Tech & Work

    Designing With AI, Not Around It: Practical Advanced Techniques For Product Design Use Cases

    August 11, 2025
    Tech & Work

    Why Companies Are Investing in AI-Powered React.js Development Services in 2025

    August 11, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Nintendo Switch 2 vs Steam Deck: Which handheld should you buy for PC gaming or console exclusives?

    News & Updates

    CVE-2025-4278 – GitLab CE/EE HTML Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    The Rise of AI-Generated Video: Transforming the Future of Marketing Strategy🎬

    Web Development

    State-Sponsored Hackers Weaponize ClickFix Tactic in Targeted Malware Campaigns

    Development

    Highlights

    Distribution Release: Nobara Project 42

    May 13, 2025

    The DistroWatch news feed is brought to you by TUXEDO COMPUTERS. Thomas Crider has announced the release of Nobara Project 42, a major update of the distribution’s custom variant of Fedora Linux with user-friendly fixes added to it. The new release replaces Firefox with Brave as the default browser and switches to a rolling-release development model: “Nobara 42 officially….

    CVE-2025-5953 – WordPress WP Human Resource Management Privilege Escalation

    July 3, 2025

    CVE-2025-6121 – D-Link DIR-632 HTTP POST Request Handler Stack-Based Buffer Overflow

    June 16, 2025

    CVE-2025-24779 – NooTheme Yogi Deserialization of Untrusted Data Object Injection Vulnerability

    July 16, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.