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.

            
              .maze
	- (1..8) .each do |i|
		.circle
			- (1..36).each do |j|
				.circle__cell
					.circle__cell-walls
	
%span.notice Inspired by "Mazes for Programmers"
            
          
!
            
              @import bourbon

$raw-diameter: 400
$diameter: $raw-diameter * 1px
$cells: 36
$circles: 8
$cell-depth: ($raw-diameter/2)/$circles
$cell-depth-px: $cell-depth * 1px
$subdivide-at: 4

$color-bg: linear-gradient(#990073, #80dfff)
$color-ground: radial-gradient(#99bbff 30%, #990098 80%, #000 100%)
$color-wall: gold
$color-title: red

$pi: 3.1415926535

=block($w, $h)
	display: block
	width: $w
	height: $h

body
	background: $color-bg
	min-height: 100vh
	font-family: 'Ubuntu', sans-serif
	color: white

.title
	color: $color-title
	text-align: center

.maze
	+block($diameter, $diameter)
	position: absolute
	border: 5px solid $color-wall
	background: $color-ground
	border-radius: 50%
	top: 50vh
	left: 50vw
	+transform(translateX(-50%) translateY(-50%))
	

.circle
	+block($diameter, $diameter)
	//border: 2px solid yellow
	border-radius: 50%
	position: absolute
	top: 0

@for $i from 1 through $circles
	$local-cells: $cells/ceil($i/$subdivide-at)
	$rot: 360deg/$local-cells
	
	.circle:nth-child(#{$i})
		$scale: ($diameter - ($i - 1)*($cell-depth*2))/$diameter
		$inv-scale: $diameter/($diameter - ($i - 1)*($cell-depth*2))
		+transform(scale($scale) translateX($i * -1px))
		.circle__cell
			+block((($diameter - ($cell-depth-px*$inv-scale)*2)*$pi)/$local-cells, $cell-depth-px*$inv-scale)
		.circle__cell-walls
			border-width: $i * 1.1px !important
			&:after
				height: $i * 1px !important

		$group-count: 0
		@for $j from 1 through $local-cells
			.circle__cell:nth-child(#{$j})
				+transform(rotate($rot * ($j - 1) ))
				+transform-origin(0 $diameter/2)
		
		@for $j from 0 through $local-cells
			$toss: random(2)
			@if $toss == 1
				$group-count: $group-count + 1
				.circle__cell:nth-child(#{$local-cells - $j}) .circle__cell-walls
					border-left: 0
					&:after
						+transform(rotate(4.5deg + ceil($i/$subdivide-at)))
			@else
				$break: random($group-count + 1)
				$group-count: 0
				.circle__cell:nth-child(#{$local-cells - $j + $break - 1}) .circle__cell-walls
					&:after
						display: none
				
				

		.circle__cell:nth-child(#{$local-cells}) + .circle__cell
			display: none
	
	// hides the inner-most circle
	.circle:nth-child(#{$circles - 1}),
	.circle:last-child
		display: none
	

.circle__cell
	+block(($diameter*$pi)/$cells, $cell-depth-px)
	position: absolute
	left: 50%

.circle__cell-walls
	+block(100%, 100%)
	box-sizing: border-box
	border-left: 1px solid $color-wall
	position: relative
	&:after
		content: ''
		+block(100%, 2px)
		+transform(rotate(4deg))
		background: $color-wall
		position: absolute
		bottom: 0
		left: 0


            
          
!
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