HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs 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 its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<main class="content-container--large">
<div class="[ grid grid--halves ] [ padding--sides padding-double--ends ] position--relative js-bbb-container">
<div class="grid__item">
<div class="bbb svg-container padding">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 797 838">
<g id="bbb" class="bbb-init bbb-discover" fill="none" fill-rule="evenodd">
<g id="base">
<g id="Lines" stroke="#a2bd30" stroke-linecap="round">
<path class="line-main" stroke-width="5.78" d="M398.33 210.73V61.85"/>
<path class="line" stroke-width="1.42" d="M471.05 223.45L519.5 90.3"/>
<path class="line" stroke-width="1.42" d="M534.9 260.5l91.2-108.67"/>
<path class="line" stroke-width="1.42" d="M582.46 316.95L705.2 246.1"/>
<path class="line" stroke-width="1.42" d="M607.46 386.4l139.8-24.66"/>
<path class="line" stroke-width="1.42" d="M607.64 460.17l139.63 24.62"/>
<path class="line-main" stroke-width="5.78" d="M582.44 529.56l128.88 74.4"/>
<path class="line" stroke-width="1.42" d="M534.74 585.83L626.1 694.7"/>
<path class="line" stroke-width="1.42" d="M471.03 623l48.48 133.23"/>
<path class="line" stroke-width="1.42" d="M398.33 635.86V777.6"/>
<path class="line" stroke-width="1.42" d="M325.6 623.1l-48.46 133.13"/>
<path class="line" stroke-width="1.42" d="M261.67 586.12l-91.1 108.58"/>
<path class="line-main" stroke-width="5.78" d="M214.18 529.58l-128.85 74.4"/>
<path class="line" stroke-width="1.42" d="M188.97 460.18l-139.6 24.6"/>
<path class="line" stroke-width="1.42" d="M188.93 386.34l-139.55-24.6"/>
<path class="line" stroke-width="1.42" d="M214.22 316.97L91.47 246.1"/>
<path class="line" stroke-width="1.42" d="M261.7 260.44l-91.13-108.6"/>
<path class="line" stroke-width="1.42" d="M325.62 223.52L277.14 90.3"/>
</g>
<g class="center-dial-container">
<g class="center-dial">
<path class="middle-circle" fill="#E5E6E7" d="M483.37 271.67C564.7 318.63 592.6 422.65 545.62 504c-46.97 81.35-150.98 109.22-232.33 62.25C231.9 519.3 204 415.27 251 333.92c46.95-81.35 151-109.22 232.32-62.25"/>
<path class="middle-line" stroke="#a2bd30" stroke-width="5.67" d="M287.86 355.18l36.82 21.26" stroke-linecap="round"/>
</g>
</g>
<g id="outer-segments" stroke-width="63.78">
<g>
<path class="js-deliver outer-segment outer-left" stroke="#a2bd30" d="M389.82 139.75c-112.67 3.3-217.23 74.07-258.13 186.44-28.8 79-20.2 162.5 16.7 231.2"/>
<title>Deliver</title>
</g>
<g>
<path class="js-discover outer-segment outer-right is-active" stroke="#a2bd30" d="M648 557.3c53.32-99.2 44.27-225-32.53-316.54-54.07-64.44-130.7-98.7-208.64-101.07"/>
<title>Discover</title>
</g>
<g>
<path class="js-create outer-segment outer-bottom" stroke="#a2bd30" d="M157.2 572c59.22 95.84 172.74 150.95 290.45 130.2 82.84-14.6 150.84-63.85 191.86-130.17"/>
<title>Create</title>
</g>
</g>
<path class="outer-pinkcircle" stroke="#a2bd30" stroke-width="11.34" d="M114 423.46C114 266.9 240.9 140 397.46 140c156.56 0 283.47 126.9 283.47 283.46 0 156.56-126.9 283.47-283.46 283.47C240.9 706.93 114 580.03 114 423.46z"/>
</g>
<g id="discover">
<path class="number-circle" stroke="#a2bd30" stroke-width="2.83" d="M419.23 22c0 11.35-9.2 20.56-20.58 20.56-11.36 0-20.57-9.2-20.57-20.57 0-11.4 9.2-20.6 20.57-20.6 11.37 0 20.58 9.2 20.58 20.5z"/>
<path class="number" fill="#a2bd30" d="M394.2 27.86h3.42V17.83l.02-.97h-.04s-.18.35-.73.9l-1.45 1.43-1.32-1.4 3.72-3.6h2v13.6h3.4v1.9h-9v-1.9z"/>
<path class="arrow-line" stroke="#a2bd30" stroke-width="2.83" d="M441.92 23.4c198.82 21.56 353.6 189.96 353.6 394.52 0 58.17-12.54 113.4-35.03 163.18"/>
<path class="arrow-head" fill="#a2bd30" d="M774.8 577.02l-1.15-2.6-12.8 5.66-4.7-13.17-2.66 1 5.7 16.1z"/>
</g>
<g id="create">
<path class="number-circle" stroke="#a2bd30" stroke-width="2.83" d="M763.88 616.58c0 11.36-9.2 20.57-20.57 20.57-11.3 0-20.5-9.2-20.5-20.57 0-11.36 9.2-20.57 20.6-20.57 11.4 0 20.6 9.3 20.6 20.6z"/>
<path class="number" fill="#a2bd30" d="M745.8 613.17c0-1.43-1.07-2.47-2.74-2.47-1.4 0-2.4.7-2.4 1.48v.68h-2.03v-1.32c0-2.02 2.7-2.86 4.52-2.86 2.83 0 4.88 1.8 4.88 4.47 0 5.34-7.88 5.43-7.88 9.02 0 .3.18.42.55.42h5.53c.3 0 .48-.2.48-.5v-1h2.1v1.9c0 1-.4 1.4-1.4 1.4h-7.92c-1.2 0-1.47-.58-1.47-1.8 0-5.76 7.9-5.37 7.9-9.57"/>
<path class="arrow-line" stroke="#a2bd30" stroke-width="2.83" d="M718.25 654.62c-118.37 161.18-341.68 210.6-518.65 108-50.32-29.17-91.83-67.7-123.6-112.13"/>
<path class="arrow-head" fill="#a2bd30" d="M72.35 664.9l2.82.3 1.52-13.88 13.7 2.53.5-2.8L74.2 648z"/>
</g>
<g id="deliver">
<path class="number-circle" stroke="#a2bd30" stroke-width="2.83" d="M74.88 619.1c0 11.36-9.2 20.57-20.57 20.57-11.3 0-20.5-9.2-20.5-20.58 0-11.4 9.2-20.6 20.6-20.6 11.4 0 20.6 9.2 20.6 20.5z"/>
<path class="number" fill="#a2bd30" d="M50.27 623.16s1.54 1.76 3.94 1.76c1.7 0 3.1-1.16 3.1-2.83 0-1.8-1.5-2.8-3.3-2.8h-1.1l-.4-1.2 3.23-4.1c.48-.7.9-1 .9-1s-.46.02-1.3.02h-3c-.3 0-.5.14-.5.47v1h-2.1v-1.97c0-1 .35-1.4 1.34-1.4h8.18v1.38l-4.1 4.94c2.06.2 4.4 1.5 4.4 4.5 0 2.6-2.05 4.93-5.3 4.93-3.22 0-5.1-2.2-5.1-2.2l1.2-1.64z"/>
<path class="arrow-line" stroke="#a2bd30" stroke-width="2.83" d="M35.14 579.27C-45.72 396.37 22.6 178.07 199.7 75.7c50.35-29.12 104.44-45.92 158.8-51.37"/>
<path class="arrow-head" fill="#a2bd30" d="M347.8 14l-1.68 2.3 11.3 8.23-9.04 10.66 2.16 1.8 11-13z"/>
</g>
</g>
</svg>
</div>
</div>
<div class="grid__item">
<div class="bbb">
<h1>Web Design Process</h1>
<div class="bbb__content bbb__content--discover">
<h2>Discover</h2>
<h3 class="h4">Understanding the the user journey</h3>
<p>Using a combination of interviews, workshops and research to gain an understanding of what your users will need from the new website</p>
</div>
<div class="bbb__content bbb__content--create">
<h2>Design</h2>
<h3 class="h4">UX - The ‘clicky’ Elements</h3>
<p>Designing the ineractivity of the new website. Creating a satisfying and engaging experience</p>
<h3 class="h4">UI - The ‘Visual’ Elements</h3>
<p>Making in on brand while drawing the eye to key components and content while encouraging users to drill down</p>
</div>
<div class="bbb__content bbb__content--deliver">
<h2>Deliver</h2>
<h3 class="h4">Lets get this thing coded up!</h3>
<p>Building and delivering a world-class website using the very best WordPress development toolset</p>
</div>
</div>
</div>
<div class="bbb__controls js-bbb__controls" data-active-content="discover">
<a href="#" class="[ bbb__control-button bbb__control-button--prev ] js-controls__previous" title="Previous Slide">
<svg>
<use xlink:href="https://sandbox.vitamin.ie/_codepen/sprite.svg#boilerplate-arrow" href="https://sandbox.vitamin.ie/_codepen/sprite.svg">
</svg>
</a>
<a href="#" class="[ bbb__control-button bbb__control-button--next ] js-controls__next" title="Next Slide">
<svg>
<use xlink:href="https://sandbox.vitamin.ie/_codepen/sprite.svg#boilerplate-arrow" href="https://sandbox.vitamin.ie/_codepen/sprite.svg#boilerplate-arrow">
</svg>
</a>
</div>
</div>
</main>
//
// BBB Content
//
body{
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap');
font-family: 'Lato', sans-serif;
}
h1, h3{
color: #a2bd30;
}
h2{
text-transform: uppercase;
}
$base-spacing-unit: 24px;
$half-spacing-unit: $base-spacing-unit;
$color-alpha: #a2bd30;
$base-font-size: 16px !default;
/////
//
// Mixin - Font Size
//
// Create a fully formed type style (sizing and vertical rhythm) by passing in a
// single value, e.g.:
//
// @include font-size(10px);
// @include font-size(24px, false); // exclude line-height
// @include font-size(24px, true, true) // apply the !important flag
//
/////
@mixin font-size($font-size, $line-height:true, $important:false){
@if $important == true {
font-size:($font-size / $base-font-size)*1rem !important;
@if $line-height == true {
line-height:ceil($font-size / $base-line-height) * ($base-line-height / $font-size) !important;
}
} @else {
font-size:($font-size / $base-font-size)*1rem;
@if $line-height == true {
line-height:ceil($font-size / $base-line-height) * ($base-line-height / $font-size);
}
}
}
/////
//
// Mixin - Simple min-width media query
//
// @include min-width($base-spacing-unit * 40) {
//
// }
//
/////
@mixin min-width($min-width) {
@media screen and (min-width: ($min-width)) {
@content
}
}
/////
//
// Flex Mixin - Provide support all the way back to IE8
//
/////
@mixin flex($flex-grow, $flex-shrink, $flex-basis) {
display: inline-block;
width: $flex-basis;
@supports(display: flex) {
flex: $flex-grow $flex-shrink $flex-basis;
width: auto;
}
}
/////
//
// Base Grid
// The base grid consists of a progressively enhanced grid utilising
// CSS Grid where supported, falling back to flexbox where CSS Grid
// support is missing and eventually falling back to inline-block when
// flexbox isn't supported.
//
/////
$base-grid-breakpoint-one: $base-spacing-unit * 30;
$base-grid-breakpoint-two: $base-spacing-unit * 40;
.grid {
font-size: 0;
display: inline-block;
margin-left: -($half-spacing-unit);
margin-right: -($half-spacing-unit);
&--full {
margin-left: 0;
margin-right: 0;
}
@supports(display: flex) {
display: flex;
flex-wrap: wrap;
}
@supports(display: grid) {
display: grid;
grid-gap: $base-spacing-unit;
margin-left: 0;
margin-right: 0;
&.grid--full {
grid-gap: 0;
}
&.grid--ends {
grid-gap: $base-spacing-unit 0;
}
&.grid--sides {
grid-gap: 0 $base-spacing-unit;
}
&.grid--halves {
@include min-width($base-grid-breakpoint-one) {
grid-template-columns: repeat(2, 1fr);
}
}
&.grid--thirds {
@include min-width($base-grid-breakpoint-one) {
grid-template-columns: repeat(2, 1fr);
}
@include min-width($base-grid-breakpoint-two) {
grid-template-columns: repeat(3, 1fr);
}
}
&.grid--quarters {
@include min-width($base-grid-breakpoint-one) {
grid-template-columns: repeat(2, 1fr);
}
@include min-width($base-grid-breakpoint-two) {
grid-template-columns: repeat(4, 1fr);
}
}
}
&__item {
@include font-size($base-font-size, false, false);
display: inline-block;
padding-left: $half-spacing-unit;
padding-right: $half-spacing-unit;
margin-bottom: $base-spacing-unit;
.grid--sides & {
margin-bottom: 0;
}
.grid--full & {
padding-left: 0;
padding-right: 0;
}
@include flex(0, 0, 100%);
@supports(display: grid) {
padding-left: 0;
padding-right: 0;
margin-bottom: 0 !important;
flex: none !important;
}
.grid--halves & {
@include min-width($base-grid-breakpoint-one) {
@include flex(0, 0, 50%);
}
}
.grid--thirds & {
@include min-width($base-grid-breakpoint-one) {
@include flex(0, 0, 50%);
}
@include min-width($base-grid-breakpoint-two) {
@include flex(0, 0, 33.333%);
}
}
.grid--quarters & {
@include min-width($base-grid-breakpoint-one) {
@include flex(0, 0, 50%);
}
@include min-width($base-grid-breakpoint-two) {
@include flex(0, 0, 25%);
}
}
}
}
*,
*::before,
*::after {
box-sizing: border-box;
}
.content-container--large {
max-width: 1440px;
margin-left: auto;
margin-right: auto;
}
.bbb {
position: relative;
display: flex;
flex-direction: column;
// justify-content: center;
height: 100%;
padding: $base-spacing-unit;
&__content {
display: none;
}
&__split {
display: none;
}
&__controls {
position: absolute;
bottom: 0;
left: 0;
padding: $base-spacing-unit;
width: 100%;
}
&__control-button {
position: relative;
text-indent: -9999px;
display: inline-block;
width: $base-spacing-unit * 2;
height: $base-spacing-unit * 2;
border: 1px solid #a2bd30;
border-radius: 50%;
margin-right: $half-spacing-unit / 2;
svg {
width: 80%;
height: 80%;
fill: #E5E6E7;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
&:hover {
border: 1px solid $color-alpha;
svg {
fill: $color-alpha;
}
}
&--next {
float: right;
svg {
transform: translate(-50%, -50%) rotate(180deg);
}
}
}
}
//
// Brand Builder Animation - All in one
//
$active-color: #6C6E70;
$highlight-color: darken($active-color, 15%);
#bbb {
.line,
.line-main {
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
}
.line-main {
animation: draw 3s forwards;
}
.line-pulse {
animation: pulse 1s forwards;
}
.middle-circle {
transform: scale(0);
animation: grow 500ms 750ms forwards;
transform-origin: 398.5px;
}
.middle-line {
stroke-dasharray: 50;
stroke-dashoffset: 50;
animation: draw 1s 2s forwards;
}
.outer-left,
.outer-right,
.outer-bottom {
stroke-dasharray: 600;
stroke-dashoffset: 600;
animation: draw 1s 1s forwards;
}
.number-circle {
stroke-dasharray: 600;
stroke-dashoffset: 600;
}
.number {
opacity: 0;
}
.arrow-line {
stroke-dasharray: 750;
stroke-dashoffset: 750;
}
.arrow-head {
opacity: 0;
}
// .center-dial-container {
// transform: rotate(0);
// transform-origin: 398.5px;
// animation: rotate 2s 2.5s infinite cubic-bezier(.75,.01,.25,1.01);
// }
.center-dial {
transform: rotate(120deg);
transform-origin: 398.5px;
}
.outer-pinkcircle {
stroke-dasharray: 1800;
stroke-dashoffset: 1800;
transform-origin: 398.5px;
transform: rotate(90deg) translate(3px, -3px);
pointer-events: none;
}
.outer-segment {
transition: stroke 500ms;
cursor: pointer;
&.is-active {
stroke: $active-color;
}
&:hover {
stroke: $highlight-color;
}
}
// Initial State
&.bbb-init {
.outer-pinkcircle {
animation: outerCircleOne 500ms 2s forwards;
}
#discover .number-circle {
animation: draw 3s 1.75s forwards;
}
#discover .number {
animation: fadeIn 500ms 2s forwards;
}
#discover .arrow-line {
animation: draw 500ms 2s forwards;
}
#discover .arrow-head {
animation: fadeIn 500ms 2.5s forwards;
}
}
// From Discover to Create
&.bbb-discover-create {
.outer-pinkcircle {
animation: discoverCreate_outerCircle 500ms forwards;
}
.center-dial {
animation: discoverCreate_rotate 500ms forwards;
}
#discover .arrow-line {
animation: eraseArrow 500ms forwards;
}
#discover .number-circle {
animation: eraseCircle 500ms forwards;
}
#discover .arrow-head,
#discover .number {
animation: fadeIn 500ms reverse;
}
#create .number-circle {
animation: draw 3s forwards;
}
#create .number {
animation: fadeIn 500ms forwards;
}
#create .arrow-line {
animation: draw 500ms forwards;
}
#create .arrow-head {
animation: fadeIn 500ms forwards;
}
}
// From Discover to Deliver
&.bbb-discover-deliver {
.outer-pinkcircle {
animation: discoverDeliver_outerCircle 500ms forwards;
}
.center-dial {
animation: discoverDeliver_rotate 500ms forwards;
}
#discover .arrow-line {
animation: eraseArrow 500ms forwards;
}
#discover .number-circle {
animation: eraseCircle 500ms forwards;
}
#discover .arrow-head,
#discover .number {
animation: fadeIn 500ms reverse;
}
#deliver .number-circle {
animation: draw 3s forwards;
}
#deliver .number {
animation: fadeIn 500ms forwards;
}
#deliver .arrow-line {
animation: draw 500ms forwards;
}
#deliver .arrow-head {
animation: fadeIn 500ms forwards;
}
}
// From Create to Discover
&.bbb-create-discover {
.outer-pinkcircle {
animation: createDiscover_outerCircle 500ms forwards;
}
.center-dial {
animation: createDiscover_rotate 500ms forwards;
}
#create .arrow-line {
animation: eraseArrow 500ms forwards;
}
#create .number-circle {
animation: eraseCircle 500ms forwards;
}
#create .arrow-head,
#create .number {
animation: fadeIn 500ms reverse;
}
#discover .number-circle {
animation: draw 3s forwards;
}
#discover .number {
animation: fadeIn 500ms forwards;
}
#discover .arrow-line {
animation: draw 500ms forwards;
}
#discover .arrow-head {
animation: fadeIn 500ms forwards;
}
}
// From Create to Deliver
&.bbb-create-deliver {
.outer-pinkcircle {
animation: createDeliver_outerCircle 500ms forwards;
}
.center-dial {
animation: createDeliver_rotate 500ms forwards;
}
#create .arrow-line {
animation: eraseArrow 500ms forwards;
}
#create .number-circle {
animation: eraseCircle 500ms forwards;
}
#create .arrow-head,
#create .number {
animation: fadeIn 500ms reverse;
}
#deliver .number-circle {
animation: draw 3s forwards;
}
#deliver .number {
animation: fadeIn 500ms forwards;
}
#deliver .arrow-line {
animation: draw 500ms forwards;
}
#deliver .arrow-head {
animation: fadeIn 500ms forwards;
}
}
// From Deliver to Create
&.bbb-deliver-create {
.outer-pinkcircle {
animation: deliverCreate_outerCircle 500ms forwards;
}
.center-dial {
animation: deliverCreate_rotate 500ms forwards;
}
#deliver .arrow-line {
animation: eraseArrow 500ms forwards;
}
#deliver .number-circle {
animation: eraseCircle 500ms forwards;
}
#deliver .arrow-head,
#deliver .number {
animation: fadeIn 500ms reverse;
}
#create .number-circle {
animation: draw 3s forwards;
}
#create .number {
animation: fadeIn 500ms forwards;
}
#create .arrow-line {
animation: draw 500ms forwards;
}
#create .arrow-head {
animation: fadeIn 500ms forwards;
}
}
// From Deliver to Discover
&.bbb-deliver-discover {
.outer-pinkcircle {
animation: deliverDiscover_outerCircle 500ms forwards;
}
.center-dial {
animation: deliverDiscover_rotate 500ms forwards;
}
#deliver .arrow-line {
animation: eraseArrow 500ms forwards;
}
#deliver .number-circle {
animation: eraseCircle 500ms forwards;
}
#deliver .arrow-head,
#deliver .number {
animation: fadeIn 500ms reverse;
}
#discover .number-circle {
animation: draw 3s forwards;
}
#discover .number {
animation: fadeIn 500ms forwards;
}
#discover .arrow-line {
animation: draw 500ms forwards;
}
#discover .arrow-head {
animation: fadeIn 500ms forwards;
}
}
}
@keyframes draw {
100% {
stroke-dashoffset: 0;
}
}
@keyframes grow {
100% {
transform: scale(1);
}
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes pulse {
50% {
stroke: #D8D803;
}
}
@keyframes rotate {
100% {
transform: rotate(720deg);
}
}
@keyframes eraseArrow {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 750;
}
}
@keyframes eraseCircle {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 600;
}
}
@keyframes outerCircleOne {
100% {
stroke-dashoffset: 1205;
}
}
// From Discover to Create
@keyframes discoverCreate_outerCircle {
0% {
stroke-dashoffset: 1205;
}
100% {
stroke-dashoffset: 617;
}
}
@keyframes discoverCreate_rotate {
0% {
transform: rotate(120deg);
}
100% {
transform: rotate(240deg);
}
}
// From Discover to Deliver
@keyframes discoverDeliver_outerCircle {
0% {
stroke-dashoffset: 1205;
}
100% {
stroke-dashoffset: 0;
}
}
@keyframes discoverDeliver_rotate {
0% {
transform: rotate(120deg);
}
100% {
transform: rotate(360deg);
}
}
// From Create to Discover
@keyframes createDiscover_outerCircle {
0% {
stroke-dashoffset: 617;
}
100% {
stroke-dashoffset: 1205;
}
}
@keyframes createDiscover_rotate {
0% {
transform: rotate(240deg);
}
100% {
transform: rotate(120deg);
}
}
// From Create to Deliver
@keyframes createDeliver_outerCircle {
0% {
stroke-dashoffset: 617;
}
100% {
stroke-dashoffset: 0;
}
}
@keyframes createDeliver_rotate {
0% {
transform: rotate(240deg);
}
100% {
transform: rotate(360deg);
}
}
// From Deliver to Create
@keyframes deliverCreate_outerCircle {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 617;
}
}
@keyframes deliverCreate_rotate {
0% {
transform: rotate(360deg);
}
100% {
transform: rotate(240deg);
}
}
// From Deliver to Discover
@keyframes deliverDiscover_outerCircle {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 1205;
}
}
@keyframes deliverDiscover_rotate {
0% {
transform: rotate(360deg);
}
100% {
transform: rotate(120deg);
}
}
jQuery(document).ready(function($){
// Animate on load
var lines = $('.line');
$.each(lines, function(i) {
var line = $(this);
var animLength = i * 150;
var delay = 50 * i;
$(line).css('animation', 'draw 1s ' + delay + 'ms forwards');
var counter = setTimeout(function() {
var counter = setTimeout(function() {
linePulse();
}, animLength);
}, 2000);
var mainCounter = setInterval(function() {
$(line).removeClass('line-pulse');
var counter = setTimeout(function() {
linePulse();
}, animLength);
}, 7000);
function linePulse() {
$(line).removeClass('line');
$(line).css('animation','');
$(line).addClass('line-pulse');
}
});
// Create functions for each section
function animateDiscover() {
$('#bbb .js-create').removeClass('is-active');
$('#bbb .js-deliver').removeClass('is-active');
if($('#bbb').hasClass('bbb-create')) {
$('#bbb').removeClass();
$('#bbb').addClass('bbb-discover');
$('#bbb').addClass('bbb-create-discover');
}
if($('#bbb').hasClass('bbb-deliver')) {
$('#bbb').removeClass();
$('#bbb').addClass('bbb-discover');
$('#bbb').addClass('bbb-deliver-discover');
}
$('.bbb__content').hide();
$('.bbb__content--discover').show();
$('.js-bbb__controls').attr('data-active-content','discover');
}
function animateCreate() {
$('#bbb .js-deliver').removeClass('is-active');
$('#bbb .js-create').addClass('is-active');
if($('#bbb').hasClass('bbb-discover')) {
$('#bbb').removeClass();
$('#bbb').addClass('bbb-create');
$('#bbb').addClass('bbb-discover-create');
}
if($('#bbb').hasClass('bbb-deliver')) {
$('#bbb').removeClass();
$('#bbb').addClass('bbb-create');
$('#bbb').addClass('bbb-deliver-create');
}
$('.bbb__content').hide();
$('.bbb__content--create').show();
$('.js-bbb__controls').attr('data-active-content','create');
}
function animateDeliver() {
$('#bbb .js-create').addClass('is-active');
$('#bbb .js-deliver').addClass('is-active');
if($('#bbb').hasClass('bbb-discover')) {
$('#bbb').removeClass();
$('#bbb').addClass('bbb-deliver');
$('#bbb').addClass('bbb-discover-deliver');
}
if($('#bbb').hasClass('bbb-create')) {
$('#bbb').removeClass();
$('#bbb').addClass('bbb-deliver');
$('#bbb').addClass('bbb-create-deliver');
}
$('.bbb__content').hide();
$('.bbb__content--deliver').show();
$('.js-bbb__controls').attr('data-active-content','deliver');
}
// Create Event Listeners for the middle segments
$('.js-discover').click(function() {
animateDiscover();
});
$('.js-create').click(function() {
animateCreate();
});
$('.js-deliver').click(function() {
animateDeliver();
});
// Open 'Deliver' on page load
$('.bbb__content--discover').show();
// Split Slides
$('.bbb__split:first-of-type').show();
$('.bbb__split-nav').click(function() {
var target = $(this).attr('data-split-link');
$('[data-split-content]').hide();
$('[data-split-content*="' + target + '"]').show();
});
// Next and Previous Buttons
$('.js-controls__next').click(function(e) {
e.preventDefault();
var current = $('.js-bbb__controls').attr('data-active-content');
if (current == 'discover') {
$('.js-bbb__controls').attr('data-active-content','create');
animateCreate();
} else if (current == 'create'){
console.log('else if');
$('.js-bbb__controls').attr('data-active-content','deliver');
animateDeliver();
} else {
$('.js-bbb__controls').attr('data-active-content','discover');
animateDiscover();
}
});
$('.js-controls__previous').click(function(e) {
e.preventDefault();
var current = $('.js-bbb__controls').attr('data-active-content');
if (current == 'discover') {
$('.js-bbb__controls').attr('data-active-content','deliver');
animateDeliver();
} else if (current == 'create'){
$('.js-bbb__controls').attr('data-active-content','discover');
animateDiscover();
} else {
$('.js-bbb__controls').attr('data-active-content','create');
animateCreate();
}
});
// AutoPlay
var autoPlayInterval;
var createTimeout;
var deliverTimeout;
$('.js-bbb-container').mouseover(function() {
clearInterval(autoPlayInterval);
clearTimeout(createTimeout);
clearTimeout(deliverTimeout);
});
$('.js-bbb-container').mouseleave(function() {
autoPlay();
});
function autoPlay() {
autoPlayInterval = setInterval(function(){
animateDiscover();
createTimeout = setTimeout(function() {
animateCreate();
}, 10000);
deliverTimeout = setTimeout(function() {
animateDeliver();
}, 20000);
}, 30000);
}
autoPlay();
});
Also see: Tab Triggers