Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                - var point_count = 7;
- var circle_radius = 160;
- var pi = 3.14159;
- var n = 0;
- var dash_array = pi * circle_radius * 2;

.main

	.navigation-circle

		.navigation-circle__inner

			svg.navigation-circle-svg.navigation-circle-svg--opaque(version='1.1' xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' viewbox=`0 0 ${circle_radius * 2} ${circle_radius * 2}` style=`enable-background:new 0 0 ${circle_radius * 2} ${circle_radius * 2}`)
				circle(cx=`${circle_radius}` cy=`${circle_radius}` r=`${circle_radius - 2}` fill='none' stroke-width='1' stroke='#c644fc' stroke-linecap='round' stroke-miterlimit='10' style='stroke-dashoffset:0;stroke-dasharray:none;')

			svg.navigation-circle-svg.navigation-circle-svg--mask(version='1.1' xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' viewbox=`0 0 ${circle_radius * 2} ${circle_radius * 2}` style=`enable-background:new 0 0 ${circle_radius * 2} ${circle_radius * 2}`)
				circle(id='mask-circle' cx=`${circle_radius}` cy=`${circle_radius}` r=`${circle_radius - 2}` fill='none' stroke-width='2' stroke='#c644fc' stroke-linecap='round' stroke-miterlimit='10' style=`stroke-dasharray:${dash_array}px;`)
				
			ul.navigation-circle__list

				while n < point_count
					- n++

					li.navigation-circle-list-item
						a.navigation-circle-list-item__point(onclick=`onClick(${n})` onmouseenter=`calculateOffset(${n})` onMouseLeave='onMouseLeave()')
							.navigation-circle-list-item__meta
								h3.navigation-circle-list-item__title Item #
									=n
								h4.navigation-circle-list-item__subtitle It just goes round and round


              
            
!

CSS

              
                $color_primary: #c644fc;
$color_secondary: #f7f7f7;
$color_background: #000;

$point_count: 7;
$point_radius: 16px;

$circle_radius: 160px;

$start_anim_delta: 5;

* {
	margin: 0;
	padding: 0;
	border: 0;
	outline: none;
	box-sizing: border-box;
	font-family: "Poppins", sans-serif;
}

html,
body {
	height: 100vh;
	width: 100vw;
	background-color: $color_background;
	background: linear-gradient(#1f1f21, $color_background);
}

.main {
	display: flex;
	height: 100vh;
	width: 100vw;
	flex-wrap: wrap;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

.navigation-circle {
	display: block;
	position: relative;
	height: $circle_radius * 2;
	width: $circle_radius * 2;
	margin: auto;

	&__inner {
		display: block;
		position: relative;
		height: 100%;
		width: 100%;
	}

	&__list {
		display: block;
		position: absolute;
		height: $circle_radius * 2;
		width: $circle_radius * 2;
		transform: rotate(-90deg);
		animation: #{1 + (($point_count / $start_anim_delta) - 1 / $start_anim_delta)}s
			cubic-bezier(0.25, -0.25, 0.35, 1) 0 1 animate-in-list forwards;
	}
}

.navigation-circle-svg {
	display: block;
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	transform: rotateZ(-90deg);

	&--opaque {
		opacity: 0.5;
	}

	&--mask {
		circle {
			transition: all 0.5s ease;
			transition-delay: 0.5s;
			animation: #{1 +(($point_count / $start_anim_delta) - 1 / $start_anim_delta)}s
				ease 0 1 animate-in-svg-circle-mask backwards;
		}
	}
}

.navigation-circle-list-item {
	display: block;
	position: absolute;
	height: 0;
	width: calc(50% + #{$point_radius});
	top: 50%;
	left: 50%;
	list-style: none;
	transform-origin: 0 0;

	&__point {
		display: block;
		position: absolute;
		height: $point_radius * 2;
		width: $point_radius * 2;
		top: -#{$point_radius};
		right: 2px;
		cursor: pointer;
		transform: scale(0);

		&:before {
			content: "•";
			display: block;
			position: absolute;
			height: $point_radius * 2;
			width: $point_radius * 2;
			top: 0;
			color: $color_primary;
			background-color: $color_background;
			font-size: 12px;
			font-weight: 400;
			line-height: $point_radius * 2;
			text-align: center;
			border: 2px solid $color_primary;
			border-radius: 50%;
			box-shadow: inset 0px 0px 0px 0px $color_primary;
			transform: scale(0.75);
			transition: all 0.5s ease;
		}

		&:after {
			content: "";
			display: block;
			position: absolute;
			height: 1px;
			width: 0px;
			top: 18px;
			left: 31px;
			background-color: $color_primary;
			transition: all 0.5s ease;
		}
	}

	&__meta {
		display: block;
		position: absolute;
		overflow: hidden;
		opacity: 0;
		transform-origin: center;
		margin-left: 78px;
		min-width: 68px;
		padding: 4px;
	}

	&__title {
		display: block;
		color: $color_secondary;
		text-align: left;
		font-size: 10px;
		border-bottom: 1px solid $color_secondary;
		padding-bottom: 4px;
		margin-bottom: 6px;
	}

	&__subtitle {
		display: block;
		color: $color_secondary;
		text-align: center;
		font-weight: 200;
		font-size: 8px;
	}
}

@for $i from 1 through $point_count {
	.navigation-circle-list-item:nth-of-type(#{$i}) {
		transform: rotateZ(calc((360deg / #{$point_count}) * #{$i}));
	}

	.navigation-circle-list-item:nth-of-type(#{$i})
		.navigation-circle-list-item__meta {
		$angle: 360deg / $point_count * $i;
		$rotateZ: 90 - $angle;

		transform: rotateZ(#{$rotateZ});
	}

	.navigation-circle-list-item:nth-of-type(#{$i})
		.navigation-circle-list-item__point {
		animation: 1s cubic-bezier(0.55, -0.3, 0.6, 1.5) #{$i / $start_anim_delta - 1 /
			$start_anim_delta}s 1 animate-in-list-item-point forwards;
	}
}

.navigation-circle-list-item:hover .navigation-circle-list-item__point:before {
	transform: scale(1);
	font-size: $point_radius;
}

.navigation-circle-list-item:hover .navigation-circle-list-item__point:after {
	width: $point_radius * 2;
	left: $point_radius * 2 + 2;
}

.navigation-circle-list-item:hover .navigation-circle-list-item__meta {
	opacity: 1;
}

.navigation-circle-list-item:active .navigation-circle-list-item__point:before,
.navigation-circle-list-item.active .navigation-circle-list-item__point:before {
	transform: scale(0.85);
	color: $color_background;
	box-shadow: inset 0px 0px 0px $point_radius $color_primary;
	border-color: transparent;
}
.navigation-circle-list-item:active .navigation-circle-list-item__point:after,
.navigation-circle-list-item.active .navigation-circle-list-item__point:after {
	width: $point_radius * 2 + 2;
	left: $point_radius * 2;
}

.navigation-circle-list-item:active .navigation-circle-list-item__meta,
.navigation-circle-list-item.active .navigation-circle-list-item__meta {
	opacity: 1;
}

@keyframes animate-in-list {
	0% {
		transform: rotate(-540deg);
	}
	100% {
		transform: rotate(-90deg);
	}
}

@keyframes animate-in-svg-circle-mask {
	0% {
		stroke-dashoffset: 1005;
	}
	100% {
		stroke-dashoffset: 0;
	}
}

@keyframes animate-in-list-item-point {
	0% {
		transform: scale(0);
	}
	100% {
		transform: scale(1);
	}
}

              
            
!

JS

              
                const pointCount = 7;
const circleRadius = 160;
const startAnimDelta = 5;
const circumference = Math.PI * circleRadius * 2;

var selectedItemIndex = -1;

var circlePath = document.getElementById('mask-circle');

/**
 * @description On Mouse Leave event handler for points
 */
const onMouseLeave = () => {
	let index = (selectedItemIndex !== -1) ? selectedItemIndex : 0;
	calculateOffset(index);
};

/**
 * @description On Click event handler for points
 * @param {Number} index - Index of list item
 */
const onClick = (index) => {
	//If already selected, deselect
	selectedItemIndex = (selectedItemIndex === index) ? -1 : index;
	calculateOffset(index);
	
	//Find active item, deselect
	let activeListItem = document.querySelectorAll('.navigation-circle-list-item.active');
	if (activeListItem.length > 0) activeListItem[0].classList.remove('active');
	
	//Find new item by index, select
	let listItem = document.querySelectorAll('.navigation-circle-list-item:nth-of-type(' + selectedItemIndex + ')');
	if (listItem.length > 0) listItem[0].classList.add('active');
};

/**
 * @description - Calculate offset for circle path by index of list item
 * @param {Number} index - Index of list item
 */
const calculateOffset = (index=0) => {
	let offset = 0;

	if (index !== 0) offset = (circumference / pointCount) * (pointCount - index);
	
	circlePath.style.strokeDashoffset = `${offset}px`;
};

// INTRO

let buffer = 500;
let delay = 1000 * (1 + (pointCount / startAnimDelta) - (1 / startAnimDelta)) + buffer;

setTimeout(() => onClick(1), delay);
              
            
!
999px

Console