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.

            
              <div class="panel" id="app">
	<input v-model.number="range" type="range" class="panel__input"
				  min="0" max="2">
	<div class="circles">
		<div v-for="item in circles" class="circles__element" ref="circle"></div>
		<div class="circles__element circles__control" ref="control" ></div>
	</div>
</div>

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <defs>
      <filter id="goo">
          <feGaussianBlur in="SourceGraphic" result="blur" stdDeviation="10" />
          <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 18 -7" result="goo" />
          <feComposite in2="goo" in="SourceGraphic" result="mix" />
      </filter>
    </defs>
</svg>

            
          
!
            
              $c-bg: #28303A;
$c-panel: #FEFFFE;
$c-circle: #D6DAE7;
$circle-size: 8vmin;

html {
	height: 100%;
	display: flex;
}

body {
	position: relative;
	margin: auto;
	background: $c-bg;
}

.panel {
	width: 40vmin;
	height: 14vmin;
	
	background: $c-panel;
	border-radius: 2vw;
	position: relative;
	box-shadow: inset 0px 0px 0px 4px rgba(0,0,0,0.1);
	
	transform: rotate(90deg);
	transform-origin: 50% 50%;
	
	&:after {
		content: '';
		position: absolute;
		top: 50%;
		left: 100%;
		width: 70%;
		height: 20%;
		
		border-radius: 0 1vmin 1vmin 0;
		background: #15191F;
		transform: translateY(-50%);
	}
}

.circles {
	width: calc(100% - 5vmin);
	height: 100%;
	margin: auto;
	display: flex;
	
	position: relative;
	justify-content: space-between;
	align-items: center;
	filter: url('#goo');
	
	&__element {
		width: $circle-size;
		height: $circle-size;
		display: flex;
		
		justify-content: center;
		align-content: center;
		align-items: center;
		background: $c-circle;

		border-radius: 50%;
		color: rgba(255, 255, 255, 1);
		font-size: 1.5em;
		
		box-shadow: inset 4px 4px 0px 0px rgba(0,0,0,0.1);
	}
	
	&__control {
		position: absolute;
		background: #FB5652;
		left: 0;
		transform-origin: 50% 50%;
	}
}
	





// RANGE NORMALIZATION
$thumb-color: transparent !default;
$thumb-radius: 100% !default;
$thumb-height: $circle-size !default;
$thumb-width: $circle-size !default;
$track-color: transparent !default;
$track-radius: 0px !default;
$track-width: auto !default;
$track-height: $circle-size !default;

@mixin track {
  width: $track-width;
  height: $track-height;
  cursor: pointer;
  animation: 0.2s;
}

@mixin thumb {
  width: $thumb-width;
  height: $thumb-height;
  cursor: pointer;
  border-radius: $thumb-radius;
  background: $thumb-color;
	transform: translateY(-50%);
}

@mixin input-type-range {
  -webkit-appearance: none;
  width: $track-width;
  background: transparent;

  &:focus {
    outline: none;
  }

  &::-webkit-slider-runnable-track {
    @include track;
    border-radius: $track-radius;
    background: $track-color;
  }

  &::-webkit-slider-thumb {
    @include thumb;
    -webkit-appearance: none;
  }

  &:focus::-webkit-slider-runnable-track {
    background: $track-color;
  }

  &::-moz-range-track {
    @include track;
    border-radius: $track-radius;
    background: $track-color;
  }

  &::-moz-range-thumb {
    @include thumb;
  }

  &::-ms-track {
    @include track;
    color: transparent;
    background: transparent;
  }

  &::-ms-fill-lower {
    border-radius: $track-radius * 2;
    background: $track-color;
  }

  &::-ms-fill-upper {
    border-radius: $track-radius * 2;
    background: $track-color;
  }

  &::-ms-thumb {
    @include thumb;
  }

  &:focus::-ms-fill-lower {
    background: $track-color;
  }

  &:focus::-ms-fill-upper {
    background: $track-color;
  }
}

.panel__input {
	@include input-type-range();
	position: absolute;
	width: 90%;
	top: 50%;
	left: 50%;
	
	transform: translate(-50%, -50%);
	z-index: 2;	
}
            
          
!
            
              var app = new Vue({
  el: "#app",

  data: {
    range: 0,
		previous: 0,
		circles: [
      { color: '#FB5652' },
      { color: '#FDBD3D' },
			{ color: '#2EC846' },
    ]
  },
	
  methods: {
		translate(el, from, to) {
			// 13.5 is the circle size + the gap 
			const vw = `${13.5 + (2 * (to - from) )}vmin`;
			const colorFrom = this.circles[from].color;
			const colorTo = this.circles[to].color;
			
			el.animate([
				{ transform: `translateX(calc(${from} * 13.5vmin)) scale(1)`, backgroundColor: colorFrom }, 
				{ transform: `translateX(calc(${from} * ${vw})) scale(0.5)`, offset: .2 },
				{ transform: `translateX(calc(${to} * ${-vw})) scale(0.5)`, offset: .8 }, 
				{ transform: `translateX(calc(${to} * 13.5vmin)) scale(1)`, backgroundColor: colorTo }
			], {
				duration: 500,
				fill: 'forwards',
				iteration: 1,
				easing: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)',
			});
		},
		wobble(el, direction) {
			el.animate([
				{ transform: `scaleX(1)` }, 
				{ transform: `scaleX(1.2) scaleY(0.8)`, offset: .06 } ,
				{ transform: `scaleX(0.8) scaleY(1.2)`, offset: .18 }, 
				{ transform: `scaleX(1.1) scaleY(0.9)`, offset: .312  },
				{ transform: `scaleX(0.9) scaleY(1.1)`, offset: .437  },
				{ transform: `scaleX(1.05) scaleY(0.95)`, offset: .625  },
				{ transform: `scaleX(0.95) scaleY(1.05)`, offset: .812 },
				{ transform: `scaleX(1) scaleY(1)` }
			], {
				duration: 600,
				delay: 250,
				fill: 'forwards',
				iteration: 1,
				easing: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)',
			});
		},
		changeValue(toAdd) {
			let newValue = range + toAdd;
			if(newValue >= 0 && newValue <= 2) {
				range += toAdd;
			}
		}
	},
	
	watch: {
    range() {
			this.translate(this.$refs.control, this.previous, this.range);
			this.wobble(this.$refs.circle[this.range]);
			this.previous = this.range;
	 }
	}
});
            
          
!
999px
Loading ..................

Console