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.

            
              <div id="stage">
  <input class="bullseye-input" id="b1" type="checkbox">
  <label class="bullseye" for="b1"></label>

  <input class="bullseye-input" id="b2" type="checkbox">
  <label class="bullseye" for="b2"></label>

  <input class="bullseye-input" id="b3" type="checkbox">
  <label class="bullseye" for="b3"></label>

  <input class="bullseye-input" id="b4" type="checkbox">
  <label class="bullseye" for="b4"></label>

  <input class="bullseye-input" id="b5" type="checkbox">
  <label class="bullseye" for="b5"></label>

  <input class="bullseye-input" id="b6" type="checkbox">
  <label class="bullseye" for="b6"></label>

  <input class="bullseye-input" id="b7" type="checkbox">
  <label class="bullseye" for="b7"></label>

  <input class="bullseye-input special" id="b8" type="checkbox">
  <label class="bullseye special" for="b8"></label>

  <p id="score"> points</p>
</div>
            
          
!
            
              @import url("https://fonts.googleapis.com/css?family=Press+Start+2P");

:root {
  --bullseye-points: 1;
  --bullseye-points-str: "1";
  --bullseye-special-points: 3;
  --bullseye-special-points-str: "3";
  --bullseye-size: 7rem;
  --bullseye-shadow-size: 1rem;
  --bullseye-total-size: calc(
    var(--bullseye-size) + var(--bullseye-shadow-size) * 2
  );
  --bullseye-color: red;
  --bullseye-special-color: gold;
  --total-bullseye: 8;
  --bullseye-animation-duration: 2.4s;
  --score-delay: calc(
    var(--bullseye-animation-duration) * var(--total-bullseye)
  );
  --bg-color: blue;
  --text-color: white;
  --accent-color: lime;
  counter-reset: points;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 86 86" width="42" height="42"><path d="M42.998 0C19.252 0 0 19.252 0 43c0 23.749 19.252 43 42.998 43C66.748 86 86 66.749 86 43 86 19.252 66.748 0 42.998 0zM46.5 77.825V58.5h-7.002v19.325C22.965 76.184 9.818 63.035 8.176 46.5H27.5v-7.002H8.176C9.818 22.964 22.965 9.816 39.498 8.175V27.5H46.5V8.175c16.537 1.642 29.684 14.79 31.326 31.323H58.5V46.5h19.326C76.184 63.035 63.037 76.182 46.5 77.825z" fill="%2353FF45"/></svg>') 21 21, crosshair;
}

*,
*:before,
*:after {
  box-sizing: border-box;
  cursor: inherit;
}

body {
  padding: 15px;
  overflow: hidden;
  font-family: "Press Start 2P", sans-serif;
  color: var(--text-color);
  background-color: var(--bg-color);
  user-select: none;
}

.bullseye-input {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

.bullseye-input:checked {
  counter-increment: points var(--bullseye-points);
}

.bullseye-input.special:checked {
  counter-increment: points var(--bullseye-special-points);
}

.bullseye {
  --points: var(--bullseye-points);
  position: absolute;
  top: calc(-1 * var(--bullseye-total-size));
  animation-name: bullseye-movement;
  animation-timing-function: ease-out;
  animation-duration: var(--bullseye-animation-duration);
  animation-delay: calc(
    var(--bullseye-animation-duration) * (var(--index) - 1)
  );
}

.bullseye:nth-of-type(1) {
  --index: 1;
  left: 70%;
}

.bullseye:nth-of-type(2) {
  --index: 2;
  left: 10%;
}

.bullseye:nth-of-type(3) {
  --index: 3;
  left: 80%;
}

.bullseye:nth-of-type(4) {
  --index: 4;
  left: 55%;
}

.bullseye:nth-of-type(5) {
  --index: 5;
  left: 5%;
}

.bullseye:nth-of-type(6) {
  --index: 6;
  left: 35%;
}

.bullseye:nth-of-type(7) {
  --index: 7;
  left: 40%;
}

.bullseye:nth-of-type(8) {
  --index: 8;
  left: 85%;
}

.bullseye-input:checked + .bullseye {
  animation-play-state: paused;
  pointer-events: none;
}

.bullseye.special {
  --points: var(--bullseye-special-points);
}

.bullseye:before {
  --color: var(--bullseye-color);
  content: "";
  display: block;
  width: var(--bullseye-size);
  height: var(--bullseye-size);
  border-radius: 50%;
  background-image: radial-gradient(
    closest-side,
    var(--color) 20%,
    white 0,
    white 40%,
    var(--color) 0,
    var(--color) 60%,
    white 0,
    white 80%,
    var(--color) 0
  );
  box-shadow: 4px 4px var(--bullseye-shadow-size) rgba(0, 0, 0, 0.4);
}

.bullseye.special:before {
  --color: var(--bullseye-special-color);
}

.bullseye-input:checked + .bullseye:before {
  --color: grey;
  animation: bullseye-fadeout 0.8s ease-in-out forwards;
}

.bullseye:after {
  --points-str: var(--bullseye-points-str);
  content: "+" var(--points-str);
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 1.7rem;
  text-shadow: 2px 2px 0px var(--accent-color);
  opacity: 0;
  transform: translate(-50%, -50%);
}

.bullseye.special:after {
  --points-str: var(--bullseye-special-points-str);
}

.bullseye-input:checked + .bullseye:after {
  animation: points-up 1.5s forwards;
}

#score {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent-color);
  text-shadow: 2px 2px 0px red;
  pointer-events: none;
  animation: score-end 0.4s ease-in-out var(--score-delay) forwards;
}

#score:before {
  content: counter(points);
}

@keyframes bullseye-fadeout {
  12% {
    transform: scale(0.95);
  }
  100% {
    opacity: 0;
  }
}

@keyframes points-up {
  10% {
    transform: translate(-50%, calc(-50% - 3rem));
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes bullseye-movement {
  100% {
    transform: translateY(calc(102vh + var(--bullseye-total-size)));
  }
}

@keyframes score-end {
  100% {
    transform: translateY(calc(100% - 50vh)) scale(2.2);
  }
}

            
          
!
            
              // Nothing to see here
            
          
!
999px
🕑 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 ..................

Console