cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-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.

            
              :root {
  /* Image URL  */
  --image: 'https://c1.staticflickr.com/4/3010/2584073277_31d6ec0e13_m.jpg';
  --image2: 'http://data.whicdn.com/images/80072210/large.jpg';
  
  /* Image witdh */
  --image-width: 200px;
  
  /* Image height */
  --image-height: 200px;
  
  /* Image border radius */
  --image-radius: 46px;
  
  /* Shadow X axis (positive or negative) */
  --shadow-x: 0;

  /* Shadow Y axis (positive or negative) */
  --shadow-y: 15px;
  
  /* Shadow opacity */
  --shadow-opacity: 0.5;

  /* Shadow blur range */
  --shadow-blur: 40px;
}














/* MAGIC START HERE */
/* ████████████████████████████ */


@use postcss-cssnext;

.AmbientShadow {
  width: var(--image-width, 200px);
  height: var(--image-width, 200px);
  font-size: 0;
  position: relative;
  transition-property: width, height;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.275);
  
  
  &::before,
  &::after {
    content: "";
    background-image: url(var(--image));
    animation: switchBackground 6s infinite linear;
    animation-direction: both;
    border-radius: var(--image-radius, 46px);
    background-size: cover;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
  }

  
  &::before {
    z-index: 0;
    padding: calc(100% / 2);
    position: absolute;
    top: var(--shadow-y, 20px);
    left: var(--shadow-x, 0);
    right: 0;
    bottom: 0;
    opacity: var(--shadow-opacity, 0.5);
    filter:
      blur(var(--shadow-blur, 20px))
      saturate(200%)
      contrast(1.5);
  }
  
  
  &::after {
    position: absolute;
    z-index: 1;
    filter: contrast(1.15);
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
  }

}





@keyframes switchBackground {
  19% {
    background-image: url(var(--image1));
  }
  
  20%, 30% {
    background-image: url(var(--image2));
  }
  
  100% {
    background-image: url(var(--image1));
  }
}
            
          
!
999px
Loading ..................

Console