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

            
              ul.canvas
  li.vaso.vaso--reutilizable
    .vaso__ojo.vaso__ojo--izq.p-circulo.p-flex
    .vaso__ojo.vaso__ojo--der.p-circulo.p-flex
    .vaso__boca
  - for (var i = 1; i <= 6; i++)
    li(class='vaso vaso--no-reutilizable v--0' + i)
      .vaso__ojo.vaso__ojo--izq.p-circulo.p-flex
      .vaso__ojo.vaso__ojo--der.p-circulo.p-flex
      .vaso__boca
h1 #revolucion
  span refill
            
          
!
            
              // COLOR VARIABLES
$c-01: #FFFFF2; // Creamy
$c-02: #F16B6F; // Red
$c-03: #87bfeb; // Blue
$c-04: #abd2f1; // Light Blue
$c-05: #f5979a; // Light Green
$c-06: #3E4348; // Black
$c-07: #fecee6; // Pink

// SIZE VARIABLES
$vaso: 100px; // Resize animation by editing only this variable
$vaso_sup: round($vaso * 1.5);
$vaso_esq: round($vaso * 0.04);
$vaso_esq2x: round($vaso_esq * 2);
$vaso_lado: round($vaso / 6);
$vaso_boca: round($vaso - ($vaso_lado * 2.8));
$vaso_lengua: round($vaso_boca / 2.5);
$sup_ancho: round($vaso + ($vaso_lado * 2));
$sup_alto: round($vaso_lado * 1.5);

// ANIMATION VARIABLES
$atraso_triste: 3.2s;
$vel_triste: 0.2s;

// MIXINS
@mixin size($w, $h: $w) {
  width: $w;
  height: $h;
}

@mixin half($color, $border) {
  background-color: $color;
  border-bottom-left-radius: $border;
  border-bottom-right-radius: $border;
}

@mixin center-hztl($m-left) {
  margin-left: -($m-left / 2);
  position: absolute;
  left: 50%;
}

// LAYOUT
body {
  background-color: $c-01;
  text-align: center;
}

ul,
li {
  margin: 0;
  padding: 0;
}

ul {
  list-style-type: none;
}

h1 {
  color: $c-06;
  font-family: 'Timmana', sans-serif;
  font-size: ceil($vaso_lado * 1.2);
  font-weight: normal;
}

span {
  color: $c-02;
  padding-left: 0.1em;
}

// PATTERNS
.p-circulo {
  border-radius: 50%;
}

.p-flex {
  display: flex;
  align-items: center;
  justify-content: space-around;
}

// ILLUSTRATION
.canvas {
  width: round($vaso * 3.2);
  margin: 2% auto round($vaso / 2.2);
  padding: $vaso $vaso $vaso_esq2x;
  position: relative;
  overflow: hidden;
}

.vaso {
  @include size($vaso, 0);
  border-top-width: $vaso_sup;
  border-top-style: solid;
  border-right: $vaso_lado solid transparent;
  border-left: $vaso_lado solid transparent;
  position: relative;
 
  // Vaso - Parte Superior
  &:before {
    @include size($sup_ancho, $vaso_esq2x);
    border-bottom: floor($vaso_esq / 1.4) solid $c-01;
    content: '';
    position: absolute;
    top: -$vaso_sup;
    left: -$vaso_lado;
  }
  
  // Vaso - parte inferior
  &:after {
    @include size(($vaso - $vaso_esq2x), $vaso_esq2x);
    content: '';
    position: absolute;
    bottom: -$vaso_esq2x;
    left: $vaso_esq;
  }
  
  &--no-reutilizable {
    border-top-color: $c-03;
    
    &:before,
    &:after {
      background-color: $c-04;
    } 
    
    @for $i from 1 through 6 {
      &.v--0#{$i} {        
        @if $i > 1 {
          margin-top: -($vaso + $sup_alto);
        } 
        
        @if $i == 6 {
          animation: servir_vaso 0.5s 1s ease-in-out forwards; 
          transform: rotate(45deg) translate(-150%, -250%); // For CSS animation
              
        } @else if $i < 6 {
          animation: servir_vaso 0.6s (5.3s - ($i / 2)) ease-in-out forwards;
          transform: rotate(45deg) translate(-40%, -310%); // For CSS animation
        }
      }
    }
  }
  
  &--reutilizable {
    animation: servir_vaso 0.5s 1.5s forwards;
    border-top-color: $c-02;
    position: absolute;
    right: $vaso;
    bottom: $vaso_esq2x;
    transform: rotate(-45deg) translate(150%, -250%); // For CSS animation
    
    &:before,
    &:after {
      background-color: $c-05;
    }
    
    .vaso__ojo:before {
      animation: mira_izq 0.2s ($atraso_triste + 2.5) forwards;
    }
            
    &:hover {
      .vaso__ojo:before {
        animation: none;
      }
    }
  }
  
  &__ojo {
    @include size(round($vaso_lado * 1.3));
    background-color: $c-01;
    box-sizing: border-box;
    position: absolute;
    top: -($vaso_sup - $sup_alto);
    
    // Vaso - pupila
    &:before {
      @include size(round($vaso_esq * 2.5));
      @extend .p-circulo;
      background-color: $c-06;
      content: ''; 
     
      .v--06 & {
        animation: mira_arriba $vel_triste $atraso_triste forwards;
      }
    }

    &--izq {
      left: -$vaso_esq;
    }
    
    &--der {
      right: -$vaso_esq;
    }
  }
  
  &__boca {
    @include size($vaso_boca, ($vaso_boca / 2));
    @include half($c-06, $vaso_boca);
    @include center-hztl($vaso_boca);
    top: -($vaso - $vaso_esq);
    
    // Vaso - lengua
    &:before {
      @include size($vaso_lengua, ($vaso_lengua / 2));
      @include half($c-07, $vaso_lengua);
      @include center-hztl($vaso_lengua);
      content: '';
      bottom: $vaso_esq2x;
      transform: rotateX(180deg);
      
      .v--06 & {
        animation: triste_lengua $vel_triste $atraso_triste forwards;
      }
    }
    
    .v--06 & {
      animation: triste_boca $vel_triste $atraso_triste forwards;
    }
  }
}

// ANIMATIONS
@keyframes servir_vaso {
  100% {
    transform: rotate(0deg) translate(0, 0);
  }
}

@keyframes triste_boca {
  100% {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: $vaso_boca;
    border-top-right-radius: $vaso_boca;
  }
}

@keyframes triste_lengua {
  100% {
    bottom: $vaso_esq;
  }
}

@keyframes mira_arriba {
  100% {
    margin-top: -$vaso_esq2x;
  }
}

@keyframes mira_izq {
  100% {
    margin-right: $vaso_esq2x;
  }
}
            
          
!
            
              /* 
 * PURE CSS #RevolucionRefill
 * Weekly CSS Illustration #06
 * Resizable cups with just 1 Sass edit.
 * By ilithya | 2017
 * 
 * 
 * Esta ilustración va en apoyo a la causa
 * que se desea cimentar en Mty,MX.
 *
 * This illustration encourages a movement
 * a friend initiated also in Mty, MX:
 *
 * https://www.fb.me/RevolucionRefill/ 
 *
 * https://www.change.org/p/palnorteoficial-por-un-tecate-pal-norte-sustentable-por-ti?lang=en-US
 */
            
          
!
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