cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              div {
  width: 100vmin;
  height: 100vmin;
  
  --primary: hsl(346, 70%, 50%);
  --secondary: hsl(196, 70%, 95%);
  --light: hsla(196, 90%, 98%, .4);
  
  --angle-start: 20vmin;
  --angle-degrees: 35deg;
  --background-angle-gradient: linear-gradient(var(--angle-degrees), transparent calc(var(--angle-start) - var(--angle-offset, 2vmin)), var(--secondary) var(--angle-start), transparent calc(var(--angle-start) + var(--angle-offset, 2vmin)));
  
  /* You can have multiple gradients in one variable... that can then be in a fuller multiple value `background` */
  --background-box:
      linear-gradient(90deg, var(--primary) 40%, var(--primary) 60%),
      linear-gradient(to bottom, var(--primary) 4%, transparent 4%, transparent 96%, var(--primary) 96%),
      linear-gradient(to right, var(--primary) 4%, var(--secondary) 4%, var(--secondary) 96%, var(--primary) 96%);
  --background-box-width: 40vmin;
  --background-box-height: 20%;
  
  --background-circle: radial-gradient(circle at 66.7% 66.7%, var(--secondary) 0, var(--secondary) 5vmin, transparent var(--radial-offset, 10vmin));
  
  --background-back:  linear-gradient(to bottom, var(--light), var(--light));
  
  background-image: 
    var(--background-angle-gradient),
    var(--background-box), 
    var(--background-circle);
  background-repeat: no-repeat;
  background-position: 
    center center,
    calc(var(--box-x, 20vmin) + 10vmin) 23%,
    var(--box-x, 20vmin) 20%,
    var(--box-x, 20vmin) 20%,
    center center;
  background-size: 
    auto,
    calc(var(--background-box-width) / 2) calc(var(--background-box-height) / 2),
    var(--background-box-width) var(--background-box-height),
    var(--background-box-width) var(--background-box-height),
    auto;
  
  color: rgba(0,0,0,0);
  text-shadow: -46vmin -40vmin .25vmin var(--sparkle-color-1),
    -48vmin -13vmin .5vmin var(--sparkle-color-2),
    -44vmin 13vmin .85vmin var(--sparkle-color-3),
    -46vmin 40vmin .15vmin var(--sparkle-color-4),
    
    46vmin -40vmin .65vmin var(--sparkle-color-1),
    44vmin -13vmin .5vmin var(--sparkle-color-2),
    48vmin 13vmin .75vmin var(--sparkle-color-3),
    46vmin 40vmin .35vmin var(--sparkle-color-4),
    
    -40vmin -46vmin .95vmin var(--sparkle-color-1),
    -14vmin -48vmin .25vmin var(--sparkle-color-2),
    14vmin -44vmin .55vmin var(--sparkle-color-3),
    40vmin -46vmin .5vmin var(--sparkle-color-4),
    
    -40vmin 46vmin .65vmin var(--sparkle-color-1),
    -15vmin 44vmin .15vmin var(--sparkle-color-2),
    15vmin 48vmin .95vmin var(--sparkle-color-3),
    41vmin 46vmin .65vmin var(--sparkle-color-4);
  
  transition: text-shadow 700ms ease-in-out;
  font-size: 5vmin;
  
  display: flex;
  justify-content: center;
  align-items: center;
}




body {
  overflow: hidden;
  background: hsl(196, 70%, 12%);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 100vh;
}
            
          
!
            
              var div = document.querySelector('div');
var style = div.style;

//The following variable names match the appropriate CSS Variables
var anglePosition = parseFloat(getComputedStyle(div).getPropertyValue('--angle-start')); //You can get the default value from the default CSS...
var angleOffset = 2; //... or use your own starting value
var angleDegrees = parseFloat(getComputedStyle(div).getPropertyValue('--angle-degrees'));
var boxX = 20;
var radialOffset = 10;

//Additional variables used in the requestAnimationFrame
var goUp = false;
var STEP_AMOUNT = .1;
var MAX_VMIN_VALUE = 32;
var MIN_VMIN_VALUE = 14;

requestAnimationFrame(move);

//This examples keeps things simple with linear easing.  You could certainly make these ease in, out, etc, and you could also make them respond to user interaction
function move() {
  //Setup new angled gradient value, adjusting both the background position and the gradient's color stop offset
  anglePosition = anglePosition + (goUp ? STEP_AMOUNT : -STEP_AMOUNT);
  angleOffset = angleOffset + ((goUp ? STEP_AMOUNT : -STEP_AMOUNT) / 4);
  angleDegrees = angleDegrees + ((goUp ? STEP_AMOUNT : -STEP_AMOUNT) * 1.25);
  style.setProperty('--angle-start', anglePosition + 'vmin');
  style.setProperty('--angle-offset', angleOffset + 'vmin');
  style.setProperty('--angle-degrees', angleDegrees + 'deg');
  
  //New x position value for the 2 gradients that make the box. This could alternately be done inside the gradients instead of the `background-position` var
  boxX = boxX + ((goUp ? -STEP_AMOUNT : STEP_AMOUNT) / .8);
  style.setProperty('--box-x', boxX + 'vmin');
  
  //New color stop distance for the radial gradient
  radialOffset = radialOffset + ((goUp ? -STEP_AMOUNT : STEP_AMOUNT));
  style.setProperty('--radial-offset', radialOffset + 'vmin');
  
  //change directions periodically
  if (anglePosition > MAX_VMIN_VALUE || anglePosition < MIN_VMIN_VALUE) {
    goUp = !goUp;
  }
  requestAnimationFrame(move);
}


//Make the sparkles sparkle. Combines with a CSS Transition for the fade in and out effect
//Could be simpler if Firefox allowed calc inside rgba... but the following will have broader support
setInterval(function() {
  style.setProperty('--sparkle-color-1', getColor());
  style.setProperty('--sparkle-color-2', getColor());
  style.setProperty('--sparkle-color-3', getColor());
  style.setProperty('--sparkle-color-4', getColor());
}, 700);
function getColor() {
  return 'rgba(240, 249, 208, ' + (Math.random() * .8) + ')';
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console