<!-- 
 Glowing Slinky with CSS Animation
 URL: https://codepen.io/jkantner/pen/VweJYaq
 Author: @Jon Kantner
-->
<div class="container">
  <div class="slinky">
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
    <div class="slinky__ring"></div>
  </div>
</div>
@import url("https://fonts.googleapis.com/css?family=Gochi+Hand");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  background-color: #291642;
  font: 1em/1.5 sans-serif;
  letter-spacing: 0.1rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;

  background: linear-gradient(to right, #44ea76 0%, #39fad7 80%, #39fad7 100%)
      no-repeat,
    url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/slider-2.jpg")
      no-repeat fixed;
  background-size: cover;
  background-blend-mode: hue;
}

.container {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: rgba(0, 0, 0, 0.8);
}

.slinky {
  position: relative;
  width: 8em;
  height: 14em;
  transform-origin: 100% 50%;
}

.slinky__ring {
  border-radius: 50%;
  box-shadow: 0 0 0 0.25em #255ff4 inset, 0 0 4.5em rgba(37, 95, 244, 0.3) inset,
    0 0 4.25em rgba(37, 95, 244, 0.3);
  position: absolute;
  left: 0;
  width: inherit;
  height: 4em;
  transform: translateY(0) rotateZ(0) rotateX(0) translateX(-0.75em);
  transform-origin: 100% 50%;
}
.slinky__ring:nth-child(1) {
  bottom: 0em;
}
.slinky__ring:nth-child(2) {
  bottom: 0.25em;
}
.slinky__ring:nth-child(3) {
  bottom: 0.5em;
}
.slinky__ring:nth-child(4) {
  bottom: 0.75em;
}
.slinky__ring:nth-child(5) {
  bottom: 1em;
}
.slinky__ring:nth-child(6) {
  bottom: 1.25em;
}
.slinky__ring:nth-child(7) {
  bottom: 1.5em;
}
.slinky__ring:nth-child(8) {
  bottom: 1.75em;
}
.slinky__ring:nth-child(9) {
  bottom: 2em;
}
.slinky__ring:nth-child(10) {
  bottom: 2.25em;
}
.slinky__ring:nth-child(11) {
  bottom: 2.5em;
}
.slinky__ring:nth-child(12) {
  bottom: 2.75em;
}
.slinky__ring:nth-child(13) {
  bottom: 3em;
}
View Compiled
gsap.config({
  units: { x: "em", y: "em" }
});

const camera = gsap.timeline({
  repeat: -1
});

camera.to(".slinky", {
  x: -9.5,
  duration: 3,
  ease: "linear"
});

const rings = document.querySelectorAll(".slinky__ring");

let ringsTl = gsap.timeline({
  repeat: -1,
  defaults: {
    druation: 3,
    ease: "linear",
    rotationX: 180,
    rotationZ: 180,
    x: -0.75
  }
});

rings.forEach((ring, index) => {
  const delay = index * 0.065 + 0.5;
  const yVal = -3 + index * 0.5;
  ringsTl.to(ring, { y: yVal }, `-=${delay}`);
});

GSDevTools.create();
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/gsap/3.4.1/gsap.min.js
  2. https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/GSDevTools3.min.js