css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <!DOCTYPE html>
    <meta charset="utf-8">
    <title>Learn | Animate | SVG | Cifico Challenge</title>
    <link rel="stylesheet" href="style.css">
    <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">

    <h1>Animation SVG</h1>
    <div class="main">

      <div class="spans">

        <span class="" id="red-grow">
          <!-- display here the red circle's value when growing and shrinking -->
        <span class="" id="green-grow">
          <!-- display here the green circle's value when growing and shrinking -->
      <svg width="500" height="300" xmlns="http://www.w3.org/2000/svg">
        <path fill="none" d="M-1-1h502v302H-1z"/>
          <path class="timeline" stroke-linecap="null" stroke-linejoin="null" stroke-opacity="null" stroke-width="4.5" stroke="#000" fill="none" d="M39.5 31.5v239M463.5 269.5l-422-1"/>
          <ellipse class="red" stroke="#e5a3a3" ry="65.5" rx="67" cy="165" cx="158.5" stroke-width="4.5" fill="none"/>
          <ellipse class="green" stroke="#98FB98" ry="65.5" rx="67" cy="165" cx="361.5" stroke-width="4.5" fill="none"/>

      <p class="below">
        <a href="https://codepen.io/tiffanylo/pen/vJgLOX">Codepen Demo</a>

  <script type="text/javascript" src="script.js"></script>

              body {
  background-color: #584E56;

h1 {
  color: #fff;
  margin: 10px 0;
  font-family: 'Roboto', sans-serif;
  font-weight: bold;
  font-size: 2.4rem;
  text-transform: uppercase;
  letter-spacing: .3rems;

svg {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  margin: auto;

span {
  padding-right: 65px;

.spans {
  position: absolute;
  left: 100px;

/* keyframes prototype or example of how it should work using JS*/

.red, .green {
  transform-origin: 60% 60%;
  -webkit-animation: zoom 1s ease-in-out infinite alternate;
  animation: zoom 1s ease-in-out infinite alternate;

@keyframes zoom {
  from {
    transform: scale(1, 1);
  to {
    transform: scale(0.7, 0.7);

.timeline {}

.below {
  position: absolute;
  bottom: 0;

              // I have a SVG with two circles that are animated using @keyframes. I want to display the value of the circle's growth. Using javascript I want to display the value as a they shrink and grow. getTotalLength() is probably not what I should be using but am not sure of the name of what I am looking for that does size/value check.
// check for the correct JS method to solve this.
window.onload = function() {
  console.log("DOM Ready!");
  // get elements class names
  var redCircle = document.getElementsByClassName('red')[0];
  var greenCircle = document.getElementsByClassName('green')[0];

  // get elements id for value, so the label spans I created
  var redLabel = document.getElementById('red-grow');
  var greenLabel = document.getElementById('green-grow');

  function updateLabels() {
    var transformValue = getComputedStyle(redCircle).getPropertyValue('transform');

    // transformValue a string | forming "matrix(1, 0, 0, 1, 0 ,0)"
    var currentScale = transformValue.match(/matrix\(([\d.]+)\,/)[1];

    redLabel.textContent = Math.round(currentScale * 133) + ': Red Circle Radius';
    greenLabel.textContent = Math.round(currentScale * 133) + ': Green Circle Radius';

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................