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.
<html >
<head>
<meta charset="UTF-8">
<title>Spinning wheel with svg text</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<section class="full-screen">
<div class="wheel-03">
<svg preserveAspectRatio="xMinYMin meet" class="wheel-svg" version="1.1"
width="800" height="400"
viewBox="0 0 800 400">
<g transform="translate(0,0)">
<g transform="translate(0,250)" class="wheel-container">
<text x="0" y="-225" class="term term00">SMELL</text>
<text x="0" y="-150" class="term term01">HELL</text>
<text x="0" y="-75" class="term term02">SHOCK</text>
<text x="0" y="0" class="term term03">BRAND</text>
<text x="0" y="75" class="term term04">COOL</text>
<text x="0" y="150" class="term term05">NICE</text>
<text x="0" y="225" class="term term06">EYE</text>
<text x="0" y="300" class="term term07">BEAUTY</text>
<text x="0" y="375" class="term term08">CLOCK</text>
<text x="0" y="450" class="term term09">WHEEL</text>
<text x="0" y="525" class="term term10">SMELL</text>
<text x="0" y="600" class="term term11">HELL</text>
<text x="0" y="675" class="term term12">SHOCK</text>
<text x="0" y="750" class="term term13">BRAND</text>
<text x="0" y="825" class="term term14">COOL</text>
<text x="0" y="900" class="term term15">NICE</text>
<text x="0" y="975" class="term term16">EYE</text>
<text x="0" y="1050" class="term term17">BEAUTY</text>
<text x="0" y="1125" class="term term18">CLOCK</text>
<text x="0" y="1200" class="term term19">WHEEL</text>
</g>
</g>
</svg>
</div>
</section>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>
html,
body {
background-color: #000;
color: #ffff00;
}
section {
overflow: hidden;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.full-screen {
height: 100%;
}
.wheel-svg {
margin-left: 10px;
border: 4px dashed yellow;
perspective: 300px;
}
.wheel-svg .term {
font-family: GothamLight, sans-serif;
font-size: 100px;
letter-spacing: -1px;
fill: #ffffff;
opacity: 0;
}
.wheel-svg .term.term03 {
opacity: 1;
}
.wheel-svg .term.term02,
.wheel-svg .term.term04 {
opacity: 0.5;
}
.wheel-svg .term.term01,
.wheel-svg .term.term05 {
opacity: 0.2;
}
$(window).load(function () {
var term01 = $('.wheel-03 .term01');
var term02 = $('.wheel-03 .term02');
var term03 = $('.wheel-03 .term03');
var term04 = $('.wheel-03 .term04');
var term05 = $('.wheel-03 .term05');
var term06 = $('.wheel-03 .term06');
var term07 = $('.wheel-03 .term07');
var term08 = $('.wheel-03 .term08');
var term09 = $('.wheel-03 .term09');
var term10 = $('.wheel-03 .term10');
var term11 = $('.wheel-03 .term11');
var term12 = $('.wheel-03 .term12');
var term13 = $('.wheel-03 .term13');
var term14 = $('.wheel-03 .term13');
var term15 = $('.wheel-03 .term13');
var term16 = $('.wheel-03 .term13');
var term17 = $('.wheel-03 .term13');
var term18 = $('.wheel-03 .term13');
var term19 = $('.wheel-03 .term13');
var term20 = $('.wheel-03 .term13');
var stepFrame = 5;
// css classes
tl01 = new TimelineLite();
tl01
.to(term01, stepFrame, {
css: {className: 'term term00'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
tl02 = new TimelineLite();
tl02
.to(term02, stepFrame, {
css: {className: 'term term01'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term02, stepFrame, {
css:{className: 'term term00'},
attr: {y: '-=75'},
ease: Linear.easeNone
});
tl03 = new TimelineLite();
tl03
.to(term03, stepFrame, {
css: {className: 'term term02'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term03, stepFrame, {
css: {className: 'term term01'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term03, stepFrame, {
css:{className: 'term term00'},
attr: {y: '-=75'},
ease: Linear.easeNone
});
tl04 = new TimelineLite();
tl04
.to(term04, stepFrame, {
css: {className: 'term term03'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css: {className: 'term term02'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css: {className: 'term term01'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css:{className: 'term term00'},
attr: {y: '-=75'},
ease: Linear.easeNone
});
tl05 = new TimelineLite();
tl05
.to(term05, stepFrame, {
css: {className: 'term term04'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: {className: 'term term03'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: {className: 'term term02'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: {className: 'term term01'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css:{className: 'term term00'},
attr: {y: '-=75'},
ease: Linear.easeNone
});
tl06 = new TimelineLite();
tl06
.to(term06, stepFrame, {
css: {className: 'term term05'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: {className: 'term term04'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: {className: 'term term03'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: {className: 'term term02'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: {className: 'term term01'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css:{className: 'term term00'},
attr: {y: '-=75'},
ease: Linear.easeNone
});
tl07 = new TimelineLite();
tl07
.to(term07, stepFrame, {
css: {className: 'term term06'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: {className: 'term term05'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: {className: 'term term04'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: {className: 'term term03'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: {className: 'term term02'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: {className: 'term term01'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css:{className: 'term term00'},
attr: {y: '-=75'},
ease: Linear.easeNone
});
tl08 = new TimelineLite();
tl08
.to(term08, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term08, stepFrame, {
css: {className: 'term term06'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term08, stepFrame, {
css: {className: 'term term05'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term08, stepFrame, {
css: {className: 'term term04'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term08, stepFrame, {
css: {className: 'term term03'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term08, stepFrame, {
css: {className: 'term term02'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term08, stepFrame, {
css: {className: 'term term01'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl09 = new TimelineLite();
tl09
.to(term09, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term09, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term09, stepFrame, {
css: {className: 'term term06'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term09, stepFrame, {
css: {className: 'term term05'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term09, stepFrame, {
css: {className: 'term term04'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term09, stepFrame, {
css: {className: 'term term03'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term09, stepFrame, {
css: {className: 'term term02'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl10 = new TimelineLite();
tl10
.to(term10, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term10, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term10, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term10, stepFrame, {
css: {className: 'term term06'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term10, stepFrame, {
css: {className: 'term term05'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term10, stepFrame, {
css: {className: 'term term04'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term10, stepFrame, {
css: {className: 'term term03'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl11 = new TimelineLite();
tl11
.to(term11, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term11, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term11, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term11, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term11, stepFrame, {
css: {className: 'term term06'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term11, stepFrame, {
css: {className: 'term term05'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term11, stepFrame, {
css: {className: 'term term04'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl12 = new TimelineLite();
tl12
.to(term12, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term12, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term12, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term12, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term12, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term12, stepFrame, {
css: {className: 'term term06'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term12, stepFrame, {
css: {className: 'term term05'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl13 = new TimelineLite();
tl13
.to(term13, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term13, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term13, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term13, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term13, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term13, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term13, stepFrame, {
css: {className: 'term term06'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl14 = new TimelineLite();
tl14
.to(term14, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term14, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term14, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term14, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term14, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term14, stepFrame, {
css: {className: 'term term08'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term14, stepFrame, {
css: {className: 'term term07'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl15 = new TimelineLite();
tl15
.to(term15, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term15, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term15, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term15, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term15, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term15, stepFrame, {
css: {className: 'term term09'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term15, stepFrame, {
css: {className: 'term term08'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl16 = new TimelineLite();
tl16
.to(term16, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term16, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term16, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term16, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term16, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term16, stepFrame, {
css: {className: 'term term10'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term16, stepFrame, {
css: {className: 'term term09'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl17 = new TimelineLite();
tl17
.to(term17, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term17, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term17, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term17, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term17, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term17, stepFrame, {
css: {className: 'term term11'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term17, stepFrame, {
css: {className: 'term term10'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
tl18 = new TimelineLite();
tl18
.to(term18, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term18, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term18, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term18, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term18, stepFrame, {
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term18, stepFrame, {
css: {className: 'term term12'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
.to(term18, stepFrame, {
css: {className: 'term term11'},
attr: {y: '-=75'},
ease: Linear.easeNone
})
;
// tl19 = new TimelineLite();
// tl19
// .to(term19, stepFrame, {
// attr: {y: '-=75'},
// ease: Linear.easeNone
// })
// .to(term19, stepFrame, {
// attr: {y: '-=75'},
// ease: Linear.easeNone
// })
// .to(term19, stepFrame, {
// attr: {y: '-=75'},
// ease: Linear.easeNone
// })
// .to(term19, stepFrame, {
// attr: {y: '-=75'},
// ease: Linear.easeNone
// })
// .to(term19, stepFrame, {
// attr: {y: '-=75'},
// ease: Linear.easeNone
// })
// .to(term19, stepFrame, {
// css: {className: 'term term13'},
// attr: {y: '-=75'},
// ease: Linear.easeNone
// })
// .to(term19, stepFrame, {
// css: {className: 'term term12'},
// attr: {y: '-=75'},
// ease: Linear.easeNone
// })
// ;
var wheelTurn = 0.3;
wheel03 = new TimelineMax({repeat: 200, timeScale: 3});
wheel03.add(tl01, 0);
wheel03.add(tl02, 0);
wheel03.add(tl03, 0);
wheel03.add(tl04, 0);
wheel03.add(tl05, 0);
wheel03.add(tl06, 0);
wheel03.add(tl07, 0);
wheel03.add(tl08, 0);
wheel03.add(tl09, 0);
wheel03.add(tl10, 0);
wheel03.add(tl11, 0);
wheel03.add(tl12, 0);
wheel03.add(tl13, 0);
wheel03.add(tl14, 0);
wheel03.add(tl15, 0);
wheel03.add(tl16, 0);
wheel03.add(tl17, 0);
wheel03.add(tl18, 0);
wheel03.play();
TweenMax.to(wheel03, 0.1, {timeScale: 5, ease: Circ.easeOut})
TweenMax.to(wheel03, 4.9, {timeScale: 5, delay: 5, ease: Circ.easeOut})
});
Also see: Tab Triggers