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.

            
              <div class="center">
<h1>SVG remake of <a href="https://dribbble.com/nick_buturishvili">
  <svg width="200" height="40" viewBox="0 0 200 40">
  <text text-anchor="middle" x="50%" y="55%" dy="0.76em" class="text" fill="url(#text)">
      Nick Buturishvili
    </text>
</svg>
  </a></h1>
<p>Dribbble "Switch" shot</p>
<div class="checkbox__center">
  <div class="checkbox__wrapper">
    <input id="c" type="checkbox"/>
    <label for="c">
    </label>
    <svg width="105%" height="65" viewBox="0 0 200 100">
      <defs>
        <linearGradient id="bgGrad" x1="0%" y1="0%" x2="100%" y2="0%">
          <stop offset="0%" style="stop-color:#08d6d6;stop-opacity:1" />
          <!-- <stop offset="40%" style="stop-color:#18deb9;stop-opacity:1" /> -->
          <stop offset="46%" style="stop-color:#52ce94;stop-opacity:1" />
          <stop offset="56%" style="stop-color:#97b971;stop-opacity:1" />
          <stop offset="67%" style="stop-color:#ef9429;stop-opacity:1" />
          <stop offset="100%" style="stop-color:#e76339;stop-opacity:1"/>

        </linearGradient>
        
        <linearGradient id="text" x1="0%" y1="0%" x2="200%" y2="0%">
          <stop offset="0%" style="stop-color:#08d6d6;stop-opacity:1" />
          <stop offset="46%" style="stop-color:#52ce94;stop-opacity:1" />
          <stop offset="56%" style="stop-color:#97b971;stop-opacity:1" />
          <stop offset="67%" style="stop-color:#ef9429;stop-opacity:1" />
          <stop offset="100%" style="stop-color:#e76339;stop-opacity:1"/>
        </linearGradient>
        
        <linearGradient id="text2" x1="0%" y1="0%" x2="100%" y2="0%">
          <stop offset="0%" style="stop-color:#ef9429;stop-opacity:1" />
          <stop offset="67%" style="stop-color:#ef9429;stop-opacity:1" />
          <stop offset="100%" style="stop-color:#e76339;stop-opacity:1"/>
        </linearGradient>
      </defs>
       <rect id="bgRect" x="-8" y="0" width="700" height="100" fill="url(#bgGrad)"></rect>
       <g id="arrow_g">
         <path id="arrow__lower"
            d="M29,48.5 L45,65" stroke="white" stroke-width="5.5" stroke-linecap="round"/>
         <path id="arrow__upper"
               d="M45,65 L70,35" stroke="white" stroke-width="5.5" stroke-linecap="round"/>
       </g>
      <circle id="transCircle" cx="50" cy="50" r="4" fill="white" style="opacity:0"/>
       <g id="arrow_x_g">
         <path id="x1" d="M140,50 L125,35" stroke="white" stroke-width="7.5" stroke-linecap="round"/>
         <path id="x2"d="M140,50 L155,65" stroke="white" stroke-width="7.5" stroke-linecap="round"/>
         
         <path id="x3" d="M140,50 L155,35" stroke="white" stroke-width="7.5" stroke-linecap="round"/>
         <path id="x4" d="M140,50 L125,65" stroke="white" stroke-width="7.5" stroke-linecap="round"/>
       </g>
    </svg>
  </div>
</div>

<a href="https://codepen.io/suez/pen/WQjwOb/" target="_blank">
  <p class="last">
  <svg width="240" height="40" viewBox="0 0 200 40">
  <text text-anchor="middle" x="50%" y="55%" dy="0.76em" class="text" fill="url(#text2)">
      CSS Version by Nikolay Talanov
    </text>
</svg>
    </p>
</a>

<h2>THANKS!</h2>
</div>
            
          
!
            
              @import 'compass/css3';
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600);
*{
  box-sizing:border-box;
}
html{
  font-family: Open Sans, serif;
  text-align: center;
}
a{
  text-decoration:none;
}
h1{
  max-width: 500px;
  font-size: 24px;
  color:white;
  margin: 20px auto 10px auto;
  a{
    font-weight: 600;
  }
}
h2{
  margin-top: 0px;
  font-size: 34px;
  font-weight: 600;
  color:white;
}
p{
  margin:10px 0 30px 0;
  color:white;
  &.last{
    margin-top: 10px;
    margin-bottom: 15px;
  }
}
body,html{
  background-color: #24282c;
}
.checkbox__center{
  display:inline-block;
  margin: 0 auto;
}
.checkbox__wrapper{
  width:138px;
  height:65px;
  @include border-radius(65px);
  overflow:hidden;
  position: relative;
  border:2px solid #10393e;
}
input[type="checkbox"]{
  display:none;
  +label{
    display:inline-block;
    width:100%;
    height:100%;
    @include border-radius(65px);
    overflow:hidden;
    position:relative;
    z-index: 1;
    cursor:pointer;
    &+svg{
      position:absolute;
      left:0;
      top:0;
    }
  }
}
input[type="checkbox"]:checked + label{
  opacity:0.5;
}

#arrow_x_g{
  opacity:0;
}
#transCircle{
  opacity:0;
}
#x1,#x2,#x3,#x4{
  stroke-dasharray:21.3;
  stroke-dashoffset:21.3;
}
            
          
!
            
              
//
//  SVG Remake of Nick Buturishvili's "Switch" dribbble shot.
//  Check out Nick's dribbble profile as he has some really cool shots
//
//  Original: dribbble.com/shots/2272690-Switch
//
//  Be sure to also check out the CSS only version developed by the talented
//  Nikolay Talanov -> codepen.io/suez/pen/WQjwOb/
//  
//  Kudos to Nick for the shot and Nikolay for building the CSS only version!
//
//
//  I hope some of you like it and maybe even use it in some of your projects :)!


var bgRect = $('#bgRect');
var botArrow = $('#arrow__lower');
var topArrow = $('#arrow__upper');
var arrowG = $('#arrow_g');
var circle = $('#transCircle');

var x1 = $('#x1');
var x2 = $('#x2');
var x3 = $('#x3');
var x4 = $('#x4');

var x_g = $('#arrow_x_g');


var tl = new TimelineMax({paused:true});

  tl.to(bgRect,0.55,{x:-492,ease:Linear.easeNone},'start');
  tl.to(arrowG,0.2,{scale:1.1,transformOrigin:"center",ease:Back.easeIn},'start');
  tl.to([arrowG,circle],0.2,{x:90,delay:0.35,ease:Sine.easeOut},'start');
  tl.to(arrowG,0.2,{scale:0.15,delay:0.26},'start');
  tl.to(arrowG,0.2,{opacity:0,delay:0.32},'start');
  tl.to(circle,0.2,{opacity:1,delay:0.32},'start');

  tl.to(x_g,0,{opacity:1,delay:0.5},'start');
  tl.to(circle,0,{opacity:0,delay:0.55},'start');

  tl.to([x1,x2],0.15,{'stroke-dashoffset':0,ease:Elastic.easeOut.config(0.25, 3),delay:0.55},'start');
  tl.to([x3,x4],0.15,{'stroke-dashoffset':0,ease:Elastic.easeOut.config(0.25, 3),delay:0.6},'start');

  tl.to([x1,x2],0.15,{strokeWidth:5.5,delay:0.62,ease:Power3.easeOut},'start');
  tl.to([x3,x4],0.15,{strokeWidth:5.5,delay:0.62,ease:Power3.easeOut},'start');

//tl.to([botArrow,topArrow],0.1,{'stroke-width':25});


//tl.to(circle,0,{opacity:0});


//tl.to([x1,x2],0.4,{'stroke-width':5.5});
//tl.to([x3,x4],0.4,{'stroke-width':5.5});

TweenMax.to($('#text'),1,{x:100});

$('#c').click(function(){
  var cb = $(this);
  if($(cb).is(":checked")){
    tl.play();
  } else {
    tl.reverse();
  }
});
            
          
!
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