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.

            
              <!-- 
=========================
Author of incredible owl: 
Ben Kwok
http://www.bioworkz.com/ 
=========================
-->
<svg viewBox = "0 0 900 512">
    
    <filter id="invert">
      <feComponentTransfer>
          <feFuncR type="table" tableValues="1 0"/>
          <feFuncG type="table" tableValues="1 0"/>
          <feFuncB type="table" tableValues="1 0"/>
      </feComponentTransfer>
    </filter>
    
    <mask id="mask">
        <image xlink:href="https://img-fotki.yandex.ru/get/16173/5091629.a4/0_8d5ef_68a0b9a4_orig"
               width="900" height="512"
               class="mask__image"
               filter="url(#invert)"
           ></image>
    </mask>
    
    <linearGradient id="gradient-1" 
                    x1="0" y1="0" 
                    y2="100%" y2="100%">
        <stop offset="30%" stop-color="red" class="stop-1"
              stop-opacity="65%"/>
        <stop offset="50%" stop-color="gold" class="stop-transp" 
              stop-opacity="0"/>
        <stop offset="70%" stop-color="red" class="stop-1"
              stop-opacity="65%"/>
    </linearGradient>
    
    <linearGradient id="gradient-2" 
                    x1="100%" y1="100%" 
                    y2="0" y2="0">
        <stop offset="30%" stop-color="red" class="stop-2"
              stop-opacity="50%"/>
        <stop offset="50%" stop-color="gold" class="stop-transp" 
              stop-opacity="0"/>
        <stop offset="70%" stop-color="red" class="stop-2"
              stop-opacity="50%"/>
    </linearGradient>
    
    <radialGradient id="gradient-3" 
                    r="100%">
        <stop offset="15%" stop-color="black"
              stop-opacity="90%"/>
        <stop offset="50%" stop-color="red" class="stop-3"
              stop-opacity="60%"/>
        <stop offset="100%" stop-color="red" class="stop-transp"
              stop-opacity="0"/>
    </radialGradient>
    
    <radialGradient id="gradient-4" 
                    r="100%">
        <stop offset="15%" stop-color="black"
              stop-opacity="90%"/>
        <stop offset="30%" stop-color="red" class="stop-4"
              stop-opacity="60%"/>
        <stop offset="100%" stop-color="red" class="stop-transp"
              stop-opacity="0">
    </radialGradient>
    
    <g mask="url(#mask)"
       transform="translate(0,-20)">
    
        <rect width="100%" height="100%"
              class="rect--fill"></rect>

        <circle r="70%" cx="50%" cy="50%" fill="url(#gradient-1)"
                class="circle--shade">
        </circle>
        <circle r="70%" cx="50%" cy="50%" fill="url(#gradient-2)"
                class="circle--shade">
        </circle>
        
        <!--Bird's Eyes-->
        <circle r="18" cx="405" cy="135" fill="url(#gradient-3)"
                class="circle--eye">
        </circle>
        <circle r="18" cx="480" cy="135" fill="url(#gradient-3)"
                class="circle--eye">
        </circle>
        
        <!--Skull's Eyes-->
        <circle r="33" cx="406" cy="284" fill="url(#gradient-4)"
                class="circle--eye">
        </circle>
        <circle r="33" cx="484" cy="284" fill="url(#gradient-4)"
                class="circle--eye">
        </circle>
    </g>
    
</svg>

<div class="range-wrapper">
    <input type="range" 
           min="0" max="360" value="180"
           class="range-input" />
</div>

            
          
!
            
              // @import compass

* {
    box-sizing: border-box;
}

$width: 900px;
$height: 512px;

BODY {
    background: #000;
}

svg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: $width;
    height: 100%;
    max-height: $height;
    margin: auto;
    // border: 2px solid red;
}

.range-wrapper {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 10vh;
    line-height: 12vh;
    text-align: center;
    background: linear-gradient( to right,
        hsl( 0, 100%,50%),
        hsl( 60, 100%,50%),
        hsl( 90, 100%,50%),
        hsl( 150, 100%,50%),
        hsl( 210, 100%,50%),
        hsl( 270, 100%,50%),
        hsl( 360, 100%,50%)
    );
    }
.range-input {
    width: 98%;
}

.circle--shade {
    transform-origin: $width/2 $height/2;
    animation: rotation 6s linear infinite;
    
    &:nth-child(even) {
        animation-direction: reverse;
        animation-duration: 10s;
        }
    }

@keyframes rotation {
    0% {
        transform: rotate( 0deg );
    }
    50% {
        transform: rotate( 360deg );
    }
}
            
          
!
            
              console.clear();

var doc = document;
var rangeInput = doc.querySelector('.range-input');
var rangeWrapper = doc.querySelector('.range-wrapper');

var rectFill = doc.querySelector('.rect--fill');

var colorizeSet = [
    {
        list: doc.querySelectorAll('.stop-1'),
        colorFunc: increaseHue
    },
    {
        list: doc.querySelectorAll('.stop-2'),
        colorFunc: decreaseHue
    },
    {
        list: doc.querySelectorAll('.stop-3'),
        colorFunc: increaseHueLarge
    },
    {
        list: doc.querySelectorAll('.stop-4'),
        colorFunc: decreaseHueLarge
    },
    {
        list: doc.querySelectorAll('.stop-transp')
    }
];

var colorHue = 180;
var step = 120;
var stepSmall = 30;
var stepLarge = 150;

var direction = 'forward';
var autoScroll = true;
var changeColorFunc = increaseHue;

var myInt;

function setInt () {
    myInt = window.setInterval(changeColor, 30);
}

rangeWrapper.onmouseover = function () {
    autoScroll = false;
    window.clearInterval( myInt );
}

rangeWrapper.onmouseout = function () {
    autoScroll = true;
    setInt();
}

function changeColor () {
    
    if ( autoScroll ) {
        
        if ( colorHue > 355 ) {
            changeColorFunc = decreaseHue;
        }
        else if ( colorHue < 5 ) {
            changeColorFunc = increaseHue;
        }
    } 
    
    colorHue = changeColorFunc(1);
    rangeInput.value = colorHue;
    
    setFill();
    setGradients();
}

rangeInput.oninput = function () {
    colorHue = +this.value;
    setFill();
    setGradients();
};

function setFill() {
    var color = 'hsl(' + colorHue + ', 100%, 50%)';
    rectFill.setAttribute('fill', color);
}

function increaseHue ( newStep ) {
    var colorStep = newStep || step;
    
    /*console.log('colorStep ' + colorStep);
    console.log('newStep ' + newStep);*/
    
    var color = colorHue + colorStep;
    
    if ( color > 360 ) {
        color = color - 360;
    }
    
    return color;
}

function increaseHueSmall () {
    return increaseHue( stepSmall );
}

function increaseHueLarge () {
    return increaseHue( stepLarge );
}

function decreaseHue ( newStep ) {
    var colorStep = newStep || step;
    
    var color = colorHue - colorStep;
    
    if ( color < 0) {
        color = color + 360;
    }
    
    return color;
};

function decreaseHueSmall () {
    return decreaseHue( stepSmall );
}

function decreaseHueLarge () {
    return decreaseHue( stepLarge );
}

function setStops ( list, colorFunc ) {
    var newColorHue = colorFunc ? colorFunc() : colorHue;    
    var color = 'hsl(' + newColorHue + ', 100%, 50%)';
    
    for ( var i = 0; i < list.length; i++) {
        list[ i ].setAttribute('stop-color', color);
    }
}

var setGradients = function () {
    for ( var i = 0; i < colorizeSet.length; i++ ) {
        var item = colorizeSet[i];
        setStops( item.list, item.colorFunc );
    }   
}

setInt ();
setFill ();
setGradients ();

            
          
!
999px
Loading ..................

Console