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 = 10
- containers = 48

<div class="camera">

- ( 1..containers ).each do |i|
    %div{:class => "container container--anim container--#{i}"}
        - ( 1..particles ).each do |i|
            %div{:class => "particleOuter particleOuter--anim particleOuter--#{i}"}
        
</div>
            
          
!
            
              /*
there's a glitch as z-index is not being animated. But, this seems amazingly slow in Chrome atm (57, OSX)
*/

$dimParticle: 9vh;
$numParticles: 10;

$numContainers:  44;

//size of rotating surface (normally invisible)
$dimSurface:    50vh;

//anim vars
$containerAnimDuration:  25s;
$containerAnimDelay: $containerAnimDuration / $numContainers;

$tunnelEnd: -300vh;
$tunnelStart:  60vh;
$tunnelRotation: 350deg;

$startColour: red;

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

body {
    background: radial-gradient(circle, $startColour, red, purple, darkBlue );
    background-size: 100vw;
}

.camera {
    width: $dimSurface;
    height: $dimSurface;
    perspective: 70vh;
    perspective-origin: 50% 50%; 
    transform: translate( -50%, -50% );
    position: absolute;
    top: 50%;
    left: 50%;
}

.container {
    width: $dimSurface;
    height: $dimSurface;
    position: absolute;
    top: 0;
    left: 0;
}

.container--anim {
    animation-name: scale;
    animation-iteration-count: infinite;
    animation-duration: $containerAnimDuration;
    animation-timing-function: linear;
}

.particleOuter {
    position: absolute;
    width: $dimParticle;
    height: $dimParticle;
    transform-origin:
        ( $dimSurface / 2 )
        ( $dimSurface / 2 );
    border-radius: 9999px;
}

.particleOuter--anim {
    animation-name: bgFromTo;
    animation-iteration-count: infinite;
    animation-duration: $containerAnimDuration;
    animation-timing-function: linear;
}

//keyframes for the animation
@keyframes bgFromTo {
    0% {
        background-color: $startColour;
    }
    
    100% {
        background-color: gold;
    }
}

@keyframes scale {
    0% {
        transform: translateZ( $tunnelEnd ) rotate( $tunnelRotation );
        opacity: 0;
    }
    
    20% {
      opacity: 1;  
    }
    
    97.5% {
        opacity: 1;
    }
    
    100% {
        transform: translateZ( $tunnelStart ) rotate( 0 );
        opacity: 0;
    }
}

@for $i from 0 through $numParticles {
    .particleOuter--#{$i} {
        transform: rotate( ( ( 360deg / $numParticles ) * $i ) )
    }
}

@for $i from 0 through $numContainers {
    .container--#{$i} {
        animation-delay: -( $containerAnimDelay * $i );
        .particleOuter {
            animation-delay: -( $containerAnimDelay * $i );
        }
    }
}
            
          
!
999px
Loading ..................

Console