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.

Quick-add: + add another resource

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.

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