Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <svg class="like" viewBox="0 0 100 100">
  <g class="outer">
    <path d="M49.4762 24.8435L50.0337 53.8589L30.0804 12.5438L49.4762 24.8435Z" fill="#DF235E"/>
    <path d="M11.0734 26.9749L50.0337 53.8578L30.0804 12.5427L11.0734 26.9749Z" fill="#FFAC1F"/>
    <path d="M11 50.7572L50.0348 53.8578L11.0734 26.976L11 50.7572Z" fill="#23B062"/>
    <path d="M23.2504 63.0306L50.0348 53.8578L11 50.7572L23.2504 63.0306Z" fill="#DF235E"/>
    <path d="M23.2493 63.0306L50.0348 53.8578L34.9948 74.821L23.2493 63.0306Z" fill="#13161A"/>
    <path d="M34.9959 74.8199L49.4751 89.3013L50.0337 53.8589L34.9959 74.8199Z" fill="#DF235E"/>
    <path d="M49.4751 89.3013L64.3399 74.5318L50.0348 53.8589L49.4751 89.3013Z" fill="#23B062"/>
    <path d="M50.0348 53.8589L75.9178 63.0306L64.3399 74.5329L50.0348 53.8589Z" fill="#FFAC1F"/>
    <path d="M50.0348 53.8578L75.9178 63.0317L89.0718 49.9609L50.0348 53.8578Z" fill="#1CB762"/>
    <path d="M50.0348 53.8589L89.0718 49.962L87.8342 26.9749L50.0348 53.8589Z" fill="#DF235E"/>
    <path d="M68.8195 12.5438L50.0348 53.8589L87.8342 26.976L68.8195 12.5438Z" fill="#FFAC1F"/>
    <path d="M49.4751 24.8435L68.8195 12.5438L50.0337 53.8589L49.4751 24.8435Z" fill="#13161A"/>
  </g>
  <g class="inner">  
    <path d="M35.4146 23.8803L49.6167 33.0642L50.0231 54.1243L35.4146 23.8803Z" fill="#FFAC1F"/>
    <path d="M21.8692 34.6996L35.4158 23.8828L50.0231 54.1243L21.8692 34.6996Z" fill="#DF235E"/>
    <path d="M21.8692 34.6984L50.0231 54.1243L21.6047 51.8671L21.8692 34.6984Z" fill="#13161A"/>
    <path d="M21.6047 51.8671L50.0219 54.1243L31.0699 60.6144L21.6047 51.8671Z" fill="#FFAC1F"/>
    <path d="M31.0699 60.6144L50.0231 54.1243L39.6043 68.6461L31.0699 60.6144Z" fill="#23B062"/>
    <path d="M50.0219 54.1243L49.6455 78.0043L39.6055 68.6449L50.0219 54.1243Z" fill="#FFAC1F"/>
    <path d="M50.0231 54.1243L49.6467 78.0043L59.9393 68.4549L50.0231 54.1243Z" fill="#13161A"/>
    <path d="M50.0231 54.1243L68.3751 60.6264L59.9393 68.4537L50.0231 54.1243Z" fill="#DF235E"/>
    <path d="M78.4416 51.2875L68.3751 60.6264L50.0231 54.1231L78.4416 51.2875Z" fill="#13161A"/>
    <path d="M78.4416 33.9132V51.2887L50.0231 54.1255L78.4416 33.9132Z" fill="#FFAC1F"/>
    <path d="M63.6972 24.1088L78.4416 33.9131L50.0231 54.1243L63.6972 24.1088Z" fill="#DF235E"/>
    <path d="M49.6155 33.0642L63.6972 24.1088L50.0219 54.1243L49.6155 33.0642Z" fill="#22B061"/>
  </g>
  <g class="sparkles">  
    <path d="M84 13V8" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M84 13H89" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M84 13H79" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M84 13V18" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M85 68V63" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M85 68H90" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M85 68H80" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M85 68V73" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M75 80V75" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M75 80H80" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M75 80H70" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M75 80V85" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M11 70V65" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M11 70H16" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M11 70H6" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M11 70V75" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M9 14V9" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M9 14H14" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M9 14H4" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
    <path d="M9 14V19" stroke="#FFDCA1" stroke-width="1.875" stroke-linecap="round"/>
  </g>
  <path class="filled" d="M50.0025 75.0544H49.9677C43.5416 74.935 25 58.1821 25 42.3149C25 34.6922 31.2817 28 38.4416 28C44.1387 28 47.9699 31.9307 50 34.7917C52.0251 31.9357 55.8563 28 61.5559 28C68.7208 28 75 34.6922 75 42.3173C75 58.1796 56.4559 74.9325 50.0299 75.0495H50.0025V75.0544Z" fill="#E0245E"/>
  <path class="stroke" d="M50.0025 75.0544H49.9677C43.5416 74.935 25 58.1821 25 42.3149C25 34.6922 31.2817 28 38.4416 28C44.1387 28 47.9699 31.9307 50 34.7917C52.0251 31.9357 55.8563 28 61.5559 28C68.7208 28 75 34.6922 75 42.3173C75 58.1796 56.4559 74.9325 50.0299 75.0495H50.0025V75.0544ZM38.4441 31.7342C33.2695 31.7342 28.7342 36.68 28.7342 42.3198C28.7342 56.5999 46.2335 71.1685 50.005 71.3227C53.7815 71.1685 71.2758 56.6023 71.2758 42.3198C71.2758 36.68 66.7405 31.7342 61.5658 31.7342C55.2766 31.7342 51.7639 39.0384 51.734 39.1106C51.1618 40.5087 48.8581 40.5087 48.2834 39.1106C48.2486 39.0359 44.7383 31.7342 38.4466 31.7342H38.4441Z" fill="#8899A6"/>
  </svg>

<!-- hashflag-gallery - dribbble - twitter -->
<a class="hashflag" href="https://hashflaggallery.com" target="_blank" rel="noopener">
  <img src="https://hashflaggallery.com/favicon-96x96.png"/>
</a>
<a class="dribbble" href="https://dribbble.com/TaminoMartinius" target="_blank">
  <img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""/>
</a>
<a class="twitter" target="_top" href="https://twitter.com/TaminoMartinius">
  <svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72">
    <path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"/>
  </svg>    
</a>
              
            
!

CSS

              
                :root {
  --size: 100px;  
}

html {
  background-color: #15202B;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.like {
  width: var(--size);
  height: var(--size);
  cursor: pointer;
  border-radius: 999px;
  overflow: visible;
  > * {
    opacity: 0;
  }
  .stroke {
    opacity: 1;
  }
}

.sparkles {
  opacity: 1;
  path {
    stroke-dasharray: 5 5;
    stroke-dashoffset: -5;
  }
}

@media (hover: hover) {
  svg:hover {
    background-color: #E1255E15;
    path:last-child {
      fill: #E1255E;
    }
  }
}

// hashflag-gallery - dribbble - twitter
.hashflag {
  position: fixed;
  display: block;
  right: 114px;
  bottom: 20px;
  img {
    display: block;
    height: 28px;
  }
}
.dribbble {
  position: fixed;
  display: block;
  right: 20px;
  bottom: 20px;
  img {
    display: block;
    height: 28px;
  }
}
.twitter {
  position: fixed;
  display: block;
  right: 64px;
  bottom: 14px;
  svg {
    width: 32px;
    height: 32px;
    fill: #1da1f2;
  }
}

              
            
!

JS

              
                const svg = document.querySelector('.like');
const inner = document.querySelector('.inner');
const outer = document.querySelector('.outer');
const sparkles = [...document.querySelector('.sparkles').children];
const filled = document.querySelector('.filled');
const stroke = document.querySelector('.stroke');


const playspeed = 1;

const keyframes = [
/*  0 */ 0.00,//s
/*  1 */ 0.10,//s
/*  2 */ 0.20,//s
/*  3 */ 0.25,//s
/*  4 */ 0.30,//s
/*  5 */ 0.35,//s
/*  6 */ 0.40,//s
/*  7 */ 0.60,//s
/*  8 */ 0.65,//s
/*  9 */ 0.70,//s
/*  10 */ 0.75,//s
/*  11 */ 0.76,//s
/*  12 */ 1.00,//s
];

const timespan = (start, end) => ({
  delay: keyframes[start] * (1 / playspeed),
  duration: (keyframes[end] - keyframes[start]) * (1 / playspeed),
});

let liked = false;

const toggle = () => {
  if (liked) {
    gsap.fromTo(stroke,
      { opacity: 0 },
      { opacity: 1, ...timespan(0, 2) },
    );    
    gsap.to(filled,
      { opacity: 0, ...timespan(0, 2) },
    );    
  } else {
    gsap.set([stroke, filled],
      { opacity: 0 },
    );
    gsap.fromTo(outer,
      { opacity: 1, scale: 0.3, svgOrigin: '50 50' },
      { opacity: 1, scale: 1, ...timespan(0, 1) },
    );
    outer.querySelectorAll('*').forEach((path) => {
      gsap.fromTo(path,
        { fill: '#000' },
        { fill: path.getAttribute('fill'), ...timespan(0, 4) },
      );    
    });
    inner.querySelectorAll('*').forEach((path) => {
      gsap.fromTo(path,
        { fill: '#000' },
        { fill: path.getAttribute('fill'), ...timespan(0, 1) },
      );    
    });
    gsap.fromTo(inner,
      { scale: 0.3, opacity: 1, svgOrigin: '50 50' },
      { scale: 1, ...timespan(0, 5) },
    );
    gsap.to([inner, outer],
      { scale: 0, opacity: 0, ...timespan(6, 9) },
    );
    gsap.fromTo(filled,
      { scale: 0, svgOrigin: '50 50', opacity: 1, },
      { scale: 1, ease: 'back.out(2)', ...timespan(6, 12) },
    );
    gsap.fromTo(sparkles.slice(0,4),
      { strokeDashoffset: -5 },
      { strokeDashoffset: -15, ...timespan(6, 10) },
    );
    gsap.fromTo(sparkles.slice(4,8),
      { strokeDashoffset: -5 },
      { strokeDashoffset: -15, ...timespan(5, 9) },
    );
    gsap.fromTo(sparkles.slice(8,12),
      { strokeDashoffset: -5 },
      { strokeDashoffset: -15, ...timespan(4, 8) },
    );
    gsap.fromTo(sparkles.slice(12,16),
      { strokeDashoffset: -5 },
      { strokeDashoffset: -15, ...timespan(3, 7) },
    );
    gsap.fromTo(sparkles.slice(16,20),
      { strokeDashoffset: -5 },
      { strokeDashoffset: -15, ...timespan(2, 6) },
    );
  }
  svg.style.pointerEvents = 'none';
  setTimeout(() => { svg.style.pointerEvents = ''; }, liked ? 200 : 700);
  liked = !liked;
};

svg.addEventListener('click', toggle);

toggle();

              
            
!
999px

Console