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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <html>
  <head>     
<link href="https://fonts.googleapis.com/css?family=Oswald:300,500,600,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Ropa+Sans" rel="stylesheet">
   <script src=" https://cdn.jsdelivr.net/npm/vue"></script>
    
  </head>
<body>
<div id = "app">
<!--   <div class = "controls"> -->
      <button id = "hideShow" v-on:click="hideShow">Hide/Show Controls</button>
  
    <div id = "controlPanel"> 
      
  <div class = "instructions">
 Select The Number Of Elements To Phase 
  </div>
  <input id = "howMany" type="range" @change="updateCircles" min="2" max="15" step="1" v-model="value"> 
<input type="number" @change="updateCircles" v-model="value"/>
        <div class = "instructions">
 Set the speed of animation B
  </div>
  <input id = "howFast" type="range" @change="updateSpeed" min="500" max="8000" step="250" v-model="speed"> 
<input type="number" @change="updateSpeed" v-model="speed"/>
      <div class = "instructions">
    Animation Options
    </div>
<!-- <span v-text="value"></span> -->
 <button v-on:click="makeVertical">Spread Vertical</button>
 <button v-on:click="makeHorizontal">Spread Horizontal</button>
<!--     each button should be associated with the value of one of the app.spins and it should activate the updateCircles function passing it the animation sequence associated with each button. the animation parameter will be passed as a string associated with an animation in the file animation.js .  -->
 <button v-on:click="animationOne">Animation A</button>
 <button  v-on:click="animationTwo">Animation B</button>
 <button  v-on:click="animationThree">Animation C</button>
<!--  <button v-model="value" v-on:click="animationFour">Animation C</button> -->
<!--  <button v-model="value" v-on:click="animationFive">Animation 5</button> -->
 <button v-on:click="animationRandom">Random Animation</button>
    

 

</div>
<div id = "shapes">

</div>
<!-- end shapes -->
</div> 
<!-- end app -->
   <script src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"> </script>
    <script src = "https://cdnjs.cloudflare.com/ajax/libs/velocity/1.5.0/velocity.min.js"> </script>
    <script src = "https://cdnjs.cloudflare.com/ajax/libs/velocity/1.4.3/velocity.ui.min.js"> </script>
    
    <script src = "https://s3-us-west-2.amazonaws.com/s.cdpn.io/255459/chroma.js"> </script>

  
</body>
</html>

              
            
!

CSS

              
                /*SETUP*/

html {
  box-sizing: border-box;
}
*,
*:before,
*:after {
  box-sizing: inherit;
}
body {
/*   background-color: rgba(236, 229, 223, 0.8); */
  background-color: rgba(0, 1, 13, .9);
/*   background-color: #012039; */
/*   background-color: #063E6D; */
  font-family: "Oswald";
  color: rgba(13, 82, 91, 1);
  font-size: 16px;
  width: 100vw;
  margin: auto;
  height: 100vh;
}

/*CONTAINER FOR EVERYTHING*/
#app {
  position: relative;
  width: 95vw;
  height: 95vh;
  margin: auto;
}

@media (min-width: 900px) {
  #app {
    /*   width: 80%; */
  }
}

@media (min-width: 1600px) {
  #app {
    /*   width: 70%; */
  }
}

#shapes {
  position: absolute;
  width: 80%;
  top: 15vh;
  left: 33%;
  margin: auto;
}

.shape {
  text-transform: uppercase;
  /* border: solid .5em #B4331A; */
  text-shadow: 0em 0em #b4331a;
  box-shadow: 0em 0em 0em 0em rgba(233, 101, 104, 0.1);
  width: 8vw;
  height: 8vw;
  border-radius: 50%;
  opacity: .9;
/*   border: 1px solid #fffff8; */
  margin: -1.7em;
}

/* .triangle {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 100px solid red;
} */
#controlPanel {
  position: absolute;
  top: 13vh;
  left: 80vw;
  z-index: 1;
  width: 18%;
}
#controlPanel button {
  border: none;
  outline: none;
  /*   display: block; */
  height: 5vh;
  margin: 1vh;
  width: 11vw;
  background:#C5DAFF;
  color: rgba(0, 1, 13, 1);
  font-family: Oswald;
  font-size: .7em;
}

#controlPanel button:focus {
  background-color: rgba(13, 82, 91, 0.3);
  color: rgba(195, 217, 237, .9);
  
}

.instructions {
  line-height: 1em;
  font-weight: 300;
  font-size: 80%;
  margin-bottom: .4em;
  margin-top: 1.7em;
color: #C5DAFF;
}

#hideShow{
  font-family: Oswald;
    background-color: rgba(13, 82, 91, 0.3);
  opacity: .7;
  color: rgba(195, 217, 237, .9);
  border: none;
  outline: none;
  position: absolute;
  left: 80vw;
  top: 5vh;
  width: 15vw;
  height: 5vh;
}

input{ 
background: #C5DAFF;
  color: rgba(0, 1, 13, 1);
  outline: none;
  border: none;
  font-size: .9em;
  width: 75%;
  margin: auto;
}
button:focus {
  outline: 0;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  margin: 0.7px 0;
}
input[type="range"]:focus {
  outline: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 25.6px;
  cursor: pointer;
  box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
  background: #484d4d;
  border-radius: 0px;
  border: 0px solid #010101;
}
input[type="range"]::-webkit-slider-thumb {
  box-shadow: 0px 0px 1px #670000, 0px 0px 0px #810000;
  border: 0px solid #ff1e00;
  height: 27px;
  width: 18px;
  border-radius: 0px;
  background: rgba(255, 67, 95, 0.93);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -0.7px;
}
input[type="range"]:focus::-webkit-slider-runnable-track {
  background: #545a5a;
}
input[type="range"]::-moz-range-track {
  width: 100%;
  height: 25.6px;
  cursor: pointer;
  box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
  background: #484d4d;
  border-radius: 0px;
  border: 0px solid #010101;
}
input[type="range"]::-moz-range-thumb {
  box-shadow: 0px 0px 1px #670000, 0px 0px 0px #810000;
  border: 0px solid #ff1e00;
  height: 27px;
  width: 18px;
  border-radius: 0px;
  background: rgba(255, 67, 95, 0.93);
  cursor: pointer;
}
input[type="range"]::-ms-track {
  width: 100%;
  height: 25.6px;
  cursor: pointer;
  background: transparent;
  border-color: transparent;
  color: transparent;
}
input[type="range"]::-ms-fill-lower {
  background: #3c4040;
  border: 0px solid #010101;
  border-radius: 0px;
  box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}
input[type="range"]::-ms-fill-upper {
  background: #484d4d;
  border: 0px solid #010101;
  border-radius: 0px;
  box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}
input[type="range"]::-ms-thumb {
  box-shadow: 0px 0px 1px #670000, 0px 0px 0px #810000;
  border: 0px solid #ff1e00;
  height: 27px;
  width: 18px;
  border-radius: 0px;
  background: rgba(255, 67, 95, 0.93);
  cursor: pointer;
  height: 25.6px;
}
input[type="range"]:focus::-ms-fill-lower {
  background: #484d4d;
}
input[type="range"]:focus::-ms-fill-upper {
  background: #545a5a;
}

              
            
!

JS

              
                /*PROGRAMMING LANGUAGE*/

var flag = false;

var app = new Vue({
  el: "#app",
  data: {
    spins: ["reset", "spinOne", "spinTwo", "spinThree", "spinFour", "spinFive"],
    value: 5,
    speed: 2000
  },
  methods: {
    hideShow() {
      var selector = $("#controlPanel");
      if (flag) {
        selector.hide();
        flag = !flag;
      } else {
        selector.show();
        flag = !flag;
      }
    },

    updateCircles: function(event) {
      //clear dom
      // console.log(event)
      $("#shapes").empty();
      let numberOfCircles = this.value;
      for (var i = 0; i < numberOfCircles; i++) {
        var newCircle = $("<div></div>").appendTo("#shapes");
        newCircle.addClass("shape");
        // theElements.push(newCircle)
      }
      var theElements = $(".shape").toArray();

      var $elements = $(".shape");

      var colors = chroma
        .scale(["#D60D20", '#D62AB5'])
        // .scale(["#F60000", "#F68600"])
        .mode("lch")
        .colors(theElements.length);

      theElements.forEach(function(element, index) {
        $(element).css({
          "background-color": colors[index],
          "box-shadow": "0em 0em" + colors[index],
          "border": ".1em inset" + colors[index]
        });
      });
    },
    animationOne: function() {
      // reset all elements
      let theShapes = $(".shape").toArray()
        theShapes.forEach(function(element, index) {
//           $(element).velocity("stop");
//           $(element).velocity("reset");
          
          let item = app.spins[0];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
      // set new animation to all elements
        theShapes.forEach(function(element, index) {
          let item = app.spins[1];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
    },
    animationTwo: function() {
      let animationSpeed = app.speed;
      console.log(animationSpeed);
      $.Velocity.RegisterUI("spinTwo", {
        defaultDuration: function() {
          return animationSpeed;
          console.log(animationSpeed);
        },
        calls: [
          [
            {
              scaleX: 1.98,
              scaleY: 1.85,
              translateZ: "+=60%",
              transformOriginX: "-=40%",
              transformOriginY: "+=60%",
              rotateZ: [0, 180],
              margin: "-=2em",
              opacity: 0.6,
              borderTopWidth: "+=1em",
              borderRightWidth: "+=1em",
              borderBottomWidth: "+=1em",
              borderLeftWidth: "+=1em",
              boxShadowY: "+=3.5em"

              // backgroundColor: "#fcfcfc"
            },
            1,
            {
              loop: true,
              // delay: 1500,
              easing: easings[2]
            }
          ]
        ]
      });
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          $(element).velocity("stop");

          let item = app.spins[0];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          let item = app.spins[2];
          $(element).velocity({
            p: item,
            o: { duration: app.speed }
          });
        });
    },

    updateSpeed: function(event) {
      let animationSpeed = app.speed;
      console.log(animationSpeed);

      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          $(element).velocity("stop");

          let item = app.spins[0];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          let item = app.spins[2];
          $(element).velocity({
            p: item,
            o: { duration: app.speed }
          });
        });
    },
    animationThree: function() {
      console.log(this);
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          $(element).velocity("stop");
          let item = app.spins[0];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
      // set new animation to all elements
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          let item = app.spins[3];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
    },
    animationFour: function() {
      // console.log(this)
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          $(element).velocity("stop");
          let item = app.spins[0];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
      // set new animation to all elements
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          let item = app.spins[4];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
    },
    animationFive: function() {
      console.log(this);
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          $(element).velocity("stop");
          let item = app.spins[0];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
      // set new animation to all elements
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          let item = app.spins[5];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
    },
    animationRandom: function() {
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          $(element).velocity("stop");
          let item = app.spins[0];
          $(element).velocity({
            p: item,
            o: {}
          });
        });
      // set new animation to all elements
      $(".shape")
        .toArray()
        .forEach(function(element, index) {
          // let item = app.spins[4]
          let item = app.spins[Math.floor(Math.random() * app.spins.length)];

          $(element).velocity({
            p: item,
            o: {}
          });
        });
    },

    makeVertical: function() {
      $(".shape").css("float", "none");
      $("#shapes").css("left", "33%");
    },

    makeHorizontal: function() {
      $(".shape").css("float", "left");
      $("#shapes").css("left", "0");
    }
  },

  created: function() {
    let self = this;
    self.updateCircles();
    var selector = $("#controlPanel");
    // selector.hide()
  }
});

/* animations */
/*Language Animation to Register!*/
var easings = [
  "easeInSine",
  "easeInElastic",
  "easeInOutQuad",
  "easeInCirc",
  "easeOutCirc",
  "easeInBack",
  "easeInQuad",
  "easeOutQuead",
  "easeOutSine",
  "easeInOutSine",
  "easeInOutQuad",
  
];
$.Velocity.RegisterUI("reset", {
  defaultDuration: 10,
  calls: [
    [
      {
        translateX: 0,
        translateY: 0,
        scale: 1,
        transformOriginX: 0,
        transformOriginY: 0,
        rotateZ: 0,
        // margin: 0,
        opacity: 1,
        borderWidth: 0,
        boxShadowX: 0,
        boxShadowY: 0,
        backgroundColor: 0,
        padding: 0,
        borderRadius: "50%",
        scaleY: 1,
        scaleX: 1,
        translateZ: 0,
        rotateY: 0,
        rotateZ:0
      },
      1,
      {
        loop: false,
        delay: 0
        // sequenceQueue: false,
        // easing: easings[1]
      }
    ]
  ]
});
$.Velocity.RegisterUI("spinOne", {
  defaultDuration: 5000,
  calls: [
    [
      {
    
        scale: 3.68,
        // transformOriginX: "+=190%",
        transformOriginY: "+=130%",
        rotateZ:  -180,
        rotateY: -180,
        margin: "-=4.5em",
        // paddingBottom: "-=50%",
        opacity: 0.3,
        borderLeftWidth: "+=.4em",
        borderTopWidth: "+=.4em",
        boxShadowX: "+=3.5em",
        boxShadowY: "+=1.5em",
        borderRadius: "/=1.5"
      },
      1,
      {
        loop: true,
        sequenceQueue: false,
        easing: easings[5]
      }
    ]
  ]
});

$.Velocity.RegisterUI("spinThree", {
  defaultDuration: 7000,
  calls: [
    [
      {
        translateX: "+=20%",
        translateY: "+=20%",
        // width: '-=5%',
        scale: 0.18,
        transformOriginX: "40%",
        transformOriginY: "80%",
        rotateZ: [0, 360],
        margin: "-=2em",
        opacity: 0.9,
        borderWidth: "+=.2em",
        boxShadowX: "+=8.5em",
        boxShadowY: "+=1.5em"
      },
      1,
      {
        loop: true,
        sequenceQueue: false,
        easing: easings[2]
      }
    ]
  ]
});

$.Velocity.RegisterUI("spinFour", {
  defaultDuration: 8000,
  calls: [
    [
      {
        translateX: "+=40%",
        translateY: "+=50%",
        scale: 1.48,
        skewY: "-45deg",
        transformOriginX: "30%",
        transformOriginY: "10%",
        // rotateZ: [0,360],
        margin: "-=3em",
        opacity: 0.3,
        // borderWidth: '+=.1em',
        boxShadowY: "+=.5em",
        boxShadowBlur: "+=.5em"
      },
      1,
      {
        loop: true,
        sequenceQueue: false,
        easing: easings[1]
      }
    ]
  ]
});

$.Velocity.RegisterUI("spinFive", {
  defaultDuration: 8000,
  calls: [
    [
      {
        translateX: "-=5%",
        translateY: "+=60%",
        scale: 0.78,
        // width: '-=1%',

        transformOriginX: "160%",
        transformOriginY: "-40%",
        rotateZ: [0, 360],
        margin: "-=3em",
        opacity: 0.9,
        borderWidth: "+=.1em",
        boxShadowX: "+=8.5em"
        // boxShadowY: "+=1.5em"
      },
      1,
      {
        loop: true,
        sequenceQueue: false,
        easing: easings[3]
      }
    ]
  ]
});

              
            
!
999px

Console