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.

            
              - particles = 150

- (1..particles).each do |i|
    %div{:class => "particle particle--anim particle--#{i}"}
        %div{:class => "particle__inner particle__inner--anim particle__inner--#{i}"}
            
          
!
            
              //this could do with some tidying!

$dimParticle: 1.5vw;
$numParticles: 150;

//anim vars (postscript- these are actually for the snowflake containers- the vertical anim)
$animDurationMin: 2s;
$animDurationMax: 3s;

//these are for the snowflakes- the horiz anim
$animSnowflakeMovement: 3.6vw;
$animSnowflakeDuration: 2.5s;

html, body {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

body {
    background: darkBlue;
    background: linear-gradient( 180deg, darkBlue, crimson 55%, white 88%, white 90% );
}

.particle {
    width: $dimParticle;
    height: $dimParticle;
    float: left;
    position: absolute;
    transform: translate( 0, -$dimParticle );
}

.particle--anim {
    animation-name: snowflake;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
}

    .particle__inner {
        background: white;
        width:100%;
        height:100%;
        border-radius:100px;
    }

    .particle__inner--anim {
        animation-name: snowflake__inner;
        animation-iteration-count: infinite;
        animation-timing-function: ease-in-out;
        animation-duration: $animSnowflakeDuration;
    }

//keyframes for the animation
@keyframes snowflake {    
    100% {
        transform: translate( 0, 100vh );
    }
}

@keyframes snowflake__inner {
    0% {
        transform: translate( -$animSnowflakeMovement, 0 );
    }
    
    50% {
        transform: translate( $animSnowflakeMovement, 0 );
    }
    
    100% {
        transform: translate( -$animSnowflakeMovement, 0 );
    }
}

//generate random positions for each particle
@for $i from 1 through $numParticles {
    .particle--#{$i} {
        left: ( random() * 100vw ) - ( $dimParticle / 2 );
        animation-delay: -( random() * $animDurationMax );
        animation-duration: ( random() * $animDurationMin ) + ( $animDurationMax - 1 );
    }
    
    .particle__inner--#{$i} {
        animation-delay: -( random() * $animSnowflakeDuration );
    }
}
            
          
!
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