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.
<div class="trophy-container">
<svg id="svgTrophyAnimation" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="true" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 550 400">
<defs>
<g id="Layer25_0_FILL">
<path id="vectorShadow" fill="#000000" stroke="none" d="
M 203.6 348.1
Q 203.6 351 223.65 353.05 243.7 355.1 272.1 355.1 300.5 355.1 320.55 353.05 340.6 351 340.6 348.1 340.6 345.2 320.55 343.15 300.5 341.1 272.1 341.1 243.7 341.1 223.65 343.15 203.6 345.2 203.6 348.1 Z"/>
</g>
<!--
#FEE448 -->
<g id="Layer24_0_FILL">
<path id="vector-tip-left" fill="#F7CF40" stroke="none" d="
M 271.6 17.7
L 223.4 135.4 272.85 137.1 271.6 17.7 Z"/>
</g>
<g id="Layer23_0_FILL">
<path fill="#FEC400" stroke="none" d="
M 272.85 137.1
L 318.9 137.1 271.6 17.7 272.85 137.1 Z"/>
</g>
<g id="Layer22_0_FILL">
<path fill="#f7cf40" stroke="none" d="
M 246.65 181.45
L 272.45 181.45 272.85 137.1 223.4 135.4 246.65 181.45 Z"/>
</g>
<g id="Layer21_0_FILL">
<path fill="#F6B000" stroke="none" d="
M 318.9 137.1
L 272.85 137.1 272.45 181.45 294 181.25 318.9 137.1 Z"/>
</g>
<g id="Layer17_0_FILL">
<path fill="#8F2418" stroke="none" d="
M 278.5 136.3
Q 278.5 133.45 276.45 131.35 274.45 129.35 271.55 129.35 268.7 129.35 266.65 131.35 264.6 133.45 264.6 136.3 264.6 139.15 266.65 141.2 268.7 143.25 271.55 143.25 274.45 143.25 276.45 141.2 278.5 139.15 278.5 136.3 Z"/>
</g>
<g id="Layer14_0_FILL">
<path fill="#FEE447" stroke="none" d="
M 284.45 180.7
L 241.85 180.7 241.85 203.75 284.45 203.75 284.45 180.7 Z"/>
</g>
<g id="Layer13_0_FILL">
<path fill="#FEC400" stroke="none" d="
M 299.8 180.7
L 284.45 180.7 284.45 203.75 299.8 203.75 299.8 180.7 Z"/>
</g>
<g id="Layer10_0_FILL">
<path fill="#f6b100" stroke="none" d="
M 307 245.55
L 307 204.85 237.35 204.85 237.35 245.55 307 245.55 Z"/>
</g>
<g id="Layer9_0_FILL">
<path fill="#FEE447" stroke="none" d="
M 307 247.05
L 307 202.9 237.35 202.9 237.35 247.05 307 247.05 Z"/>
</g>
<g id="Layer8_0_FILL">
<path fill="#C39359" stroke="none" d="
M 273.95 236.7
L 282.35 216.55 277.8 216.55 272.4 229.85 267 216.55 262.5 216.55 270.5 236.7 273.95 236.7 Z"/>
</g>
<path id="red-ball" fill="#EB3B3A" stroke="none" d="
M 209.1 145.5
Q 211 147.35 213.7 147.35 216.3 147.35 218.2 145.5 220.05 143.65 220.05 140.95 220.05 138.3 218.2 136.45 216.3 134.55 213.7 134.55 211 134.55 209.1 136.45 207.3 138.3 207.3 140.95 207.3 143.65 209.1 145.5 Z"/>
<path id="blue-ball" fill="#6633CC" stroke="none" d="
M 247.9 222.6
Q 246.15 222.6 244.9 223.8 243.65 225.05 243.65 226.8 243.65 228.55 244.9 229.8 246.15 231 247.9 231 249.65 231 250.85 229.8 252.1 228.55 252.1 226.8 252.1 225.05 250.85 223.8 249.65 222.6 247.9 222.6 Z"/>
<g id="Layer3_0_FILL">
<path id="yellow-ball" fill="#FED13C" stroke="none" d="
M 173.25 197.65
Q 173.25 195.55 171.75 194.05 170.25 192.55 168.15 192.55 166 192.55 164.5 194.05 163 195.55 163 197.65 163 199.8 164.5 201.3 166 202.8 168.15 202.8 170.25 202.8 171.75 201.3 173.25 199.8 173.25 197.65 Z"/>
</g>
<path id="Layer20_0_1_STROKES" stroke="#8F2418" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" fill="none" d="
M 223.4 135.4
L 246.65 181.45 294 181.25 318.9 137.1 271.6 17.7 223.4 135.4 Z"/>
<path id="Layer18_0_1_STROKES" stroke="#FEFEFE" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" fill="none" d="
M 271.6 29.45
L 247.6 127.75"/>
<path id="Layer17_0_1_STROKES" stroke="#8F2418" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" fill="none" d="
M 278.5 136.3
Q 278.5 139.15 276.45 141.2 274.45 143.25 271.55 143.25 268.7 143.25 266.65 141.2 264.6 139.15 264.6 136.3 264.6 133.45 266.65 131.35 268.7 129.35 271.55 129.35 274.45 129.35 276.45 131.35 278.5 133.45 278.5 136.3 Z"/>
<path id="Layer16_0_1_STROKES" stroke="#8F2418" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" fill="none" d="
M 271.6 135.1
L 271.6 17.7"/>
<path id="Layer12_0_1_STROKES" stroke="#8F2418" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" fill="none" d="
M 241.85 180.7
L 299.8 180.7 299.8 203.75 241.85 203.75 241.85 180.7 Z"/>
<path id="Layer10_0_1_STROKES" stroke="#8F2418" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" fill="none" d="
M 237.35 204.85
L 307 204.85 307 245.55 237.35 245.55 237.35 204.85 Z"/>
<path id="Layer9_0_1_STROKES" stroke="#8F2418" stroke-width="5" stroke-linejoin="round" stroke-linecap="round" fill="none" d="
M 237.35 202.9
L 307 202.9 307 247.05 237.35 247.05 237.35 202.9 Z"/>
<path id="wizzy" stroke="#fec400" stroke-width="3.5" stroke-linejoin="round" stroke-linecap="round" fill="none" d="
M 282.85 129.6
Q 333.808203125 153.475390625 339.675 160.2 345.5419921875 166.9302734375 344.525 172.95 343.5044921875 178.9619140625 326.05 185.35 323.81640625 185.8197265625 321.55 186.275 303.973046875 189.7763671875 284.45 192.2 270.001171875 194.1857421875 246.475 189.15 222.948046875 184.111328125 211.3 178.65 197.1 172.05 205.7 161.95 234.2 131.3 288.95 121.2 318.25 115.95 339.8 101.65 342.7 99.75 339.95 96.6 327.9 82.9998046875 295.95 73.65 264 64.3005859375 235.25 71.975 206.5 79.6494140625 210.65 87.3 214.8 94.9501953125 224.7 101.25 232.25 105.95 240.35 109.8 255.15 116.95 271.2 119.75"/>
</defs>
<g id="shadowGroup" transform="matrix( 1, 0, 0, 1, 0,0) ">
<use xlink:href="#Layer25_0_FILL"/>
</g>
<g id="back-red-ball">
<use xlink:href="#red-ball"/>
</g>
<g id="back-yellow-ball">
<use xlink:href="#yellow-ball"/>
</g>
<g id="back-blue-ball">
<use xlink:href="#blue-ball"/>
</g>
<g id="back-whizzy">
<use xlink:href="#wizzy"/>
</g>
<g id="vectorGroup" transform="matrix( 1, 0, 0, 1, 0,0) ">
<use xlink:href="#Layer24_0_FILL"/>
<use xlink:href="#Layer23_0_FILL"/>
<use xlink:href="#Layer22_0_FILL"/>
<use xlink:href="#Layer21_0_FILL"/>
<use xlink:href="#Layer18_0_1_STROKES"/>
<use xlink:href="#Layer20_0_1_STROKES"/>
<use xlink:href="#Layer14_0_FILL"/>
<use xlink:href="#Layer13_0_FILL"/>
<use xlink:href="#Layer12_0_1_STROKES"/>
<g id="vHolderBack">
<use xlink:href="#Layer10_0_FILL"/>
<use xlink:href="#Layer10_0_1_STROKES"/>
</g>
<g id="vHolder">
<use xlink:href="#Layer9_0_FILL"/>
<use xlink:href="#Layer9_0_1_STROKES"/>
<use xlink:href="#Layer8_0_FILL"/>
</g>
<g id="vectorInkTop">
<use xlink:href="#Layer16_0_1_STROKES"/>
</g>
<g id="inkBall">
<use xlink:href="#Layer17_0_FILL"/>
<use xlink:href="#Layer17_0_1_STROKES"/>
</g>
</g>
<g id="front-red-ball">
<use xlink:href="#red-ball"/>
</g>
<g id="front-yellow-ball">
<use xlink:href="#yellow-ball"/>
</g>
<g id="front-blue-ball">
<use xlink:href="#blue-ball"/>
</g>
<g id="front-whizzy">
<use xlink:href="#wizzy"/>
</g>
</svg>
</div>
body {
padding: 0;
margin: 0;
}
.trophy-container {
position: relative;
width: 100%;
height: 99vh;
margin: auto;
}
#wizzy {
@media only screen and (max-width: 480px) {
display: none;
}
}
(function(){
"use strict"
// Vector Trophy Animation
var vectorTrophy = {
// Trophy Timeline Animation
trophyTimeline:function() {
// vector elements
var vectorTipLeft = document.getElementById('Layer24_0_FILL'),
vectorTipright = document.getElementById('Layer23_0_FILL'),
vectorTipBottomRight = document.getElementById('Layer22_0_FILL'),
vectorTipBottomLeft = document.getElementById('Layer21_0_FILL'),
vectorshine = document.getElementById('Layer18_0_1_STROKES'),
inkTopGroup = document.getElementById('vectorInkTop'),
inkTopBall = document.getElementById('inkBall'),
middleShade = document.getElementById('Layer13_0_FILL'),
vHolder = document.getElementById('vHolder'),
vHolderBack = document.getElementById('vHolderBack'),
vectorShade = document.getElementById('vectorShadow'),
middleShade = document.getElementById('Layer13_0_FILL'),
vectorDuration = 1.4;
// top-left Diagonal timeline
var VectorTimeLineOne = new TimelineMax({yoyo: true, repeat: -1});
VectorTimeLineOne.fromTo(vectorTipLeft, vectorDuration, {transformOrigin: "80% 0%", scaleX: 0.7, skewX: -9, x: 4, y: 2, ease:Power0.easeOut}, {transformOrigin: "80% 10%", scaleX: 1.3, skewX: 9, x: 0, y: 2, ease:Power0.easeOut })
// top-right Diagonal timeline
var VectorTimeLineTwo = new TimelineMax({yoyo: true, repeat: -1});
VectorTimeLineTwo.fromTo(vectorTipright, vectorDuration, {transformOrigin: "0% 0%", scaleX: 1.3, skewX: -9, x: 2, y: 2, ease:Power0.easeOut }, {transformOrigin: "0% 0%", scaleX: 0.7, skewX: 9, x: -2, y: 2, ease:Power0.easeOut })
// bottom-left Diagonal timeline
var VectorTimeLineThree = new TimelineMax({yoyo: true, repeat: -1});
VectorTimeLineThree.fromTo(vectorTipBottomRight, vectorDuration, {transformOrigin: "0% 0%", scaleX: 0.7, skewX: 9, x: -2, y: 0, ease:Power0.easeOut }, {transformOrigin: "0% 0%", scaleX: 1.3, skewX: -9, x: 2, y: 0, ease:Power0.easeOut })
// bottom-right Diagonal timeline
var VectorTimeLineFour = new TimelineMax({yoyo: true, repeat: -1});
VectorTimeLineFour.fromTo(vectorTipBottomLeft, vectorDuration, {transformOrigin: "80% 10%", scaleX: 1.4, skewX: 9, x: -3, y: 0, ease:Power0.easeOut }, {transformOrigin: "80% 0%", scaleX: 0.7, skewX: -9, x: 1, y: 0, ease:Power0.easeOut })
// Vector Shine timeline
var VectorShineLine = new TimelineMax({yoyo: true, repeat: -1});
VectorShineLine.fromTo(vectorshine, vectorDuration, { x: -2, y: 0, skewX: -3, ease:Power0.easeOut }, { x: 2, y: 0, skewX: 3, ease:Power0.easeOut })
// Vector ink line timeline
var VectorTimeLineInkTop = new TimelineMax({yoyo: true, repeat: -1});
VectorTimeLineInkTop.fromTo(inkTopGroup, vectorDuration, {transformOrigin: "80% 0%", skewX: -6, x: -2, y: 6, ease:Power0.easeOut }, {transformOrigin: "80% 0%", skewX: 6, x: 2, y: 6, ease:Power0.easeOut });
// Vector ink ball timeline
var VectorTimeLineInkTopBall = new TimelineMax({yoyo: true, repeat: -1});
VectorTimeLineInkTopBall.fromTo(inkTopBall, vectorDuration, {transformOrigin: "80% 0%", x: -14, ease:Power0.easeOut }, {transformOrigin: "80% 0%", x: 14, ease:Power0.easeOut });
var middleShadeTimeLine = new TimelineMax({yoyo: true, repeat: -1});
middleShadeTimeLine.fromTo(middleShade, vectorDuration, {transformOrigin: "80% 0%", scaleX: 2.5, skewX: 0, x: -3, y: 0, ease:Power0.easeOut }, {transformOrigin: "80% 0%", scaleX: 1, skewX: 0, x: -2, y: 0, ease:Power0.easeOut });
var vHolderTimeLineOne = new TimelineMax({yoyo: true, repeat: -1});
vHolderTimeLineOne.fromTo(vHolder, vectorDuration, {transformOrigin: "80% 0%", x: -5, ease:Power0.easeOut}, {transformOrigin: "80% 10%", x: 5, ease:Power0.easeOut })
var vHolderBackTimeLine = new TimelineMax({yoyo: true, repeat: -1});
vHolderBackTimeLine.fromTo(vHolderBack, vectorDuration, {transformOrigin: "-40% 0%", scaleY:1.05, x: 7, y: -1, ease:Power0.easeOut}, {transformOrigin: "-40% 0%", scaleY:1.05, x: -7, y: -1, ease:Power0.easeOut })
var vectorBaseTimeLine = new TimelineMax({yoyo: true, repeat: -1});
vectorBaseTimeLine.fromTo(vectorGroup, 0.7, {y: 12, ease:Power0.easeOut}, {y: -6, ease:Power0.easeOut});
var vectorShadow = new TimelineMax({yoyo: true, repeat: -1});
vectorShadow.fromTo(vectorShade, 0.7, {transformOrigin: "10% 0%", scale:1.1, opacity: 0.2, ease:Power0.easeOut}, {transformOrigin: "40% 0%", scale: 1, opacity: 0.2, ease:Power0.easeOut});
},
// Wizzy Timeline Animation
wizzyTimeline:function() {
// wizzy elements
var wizzy = document.getElementById('wizzy'),
backWhizzy = document.getElementById('back-whizzy'),
frontWhizzy = document.getElementById('front-whizzy');
var WhizzLight = new TimelineMax({repeat:-1});
function WizzyGroupToBack() {
backWhizzy.style.transform = "rotateX(45deg)";
frontWhizzy.style.display = "none";
backWhizzy.style.display = "block";
}
function WizzyGroupToFront() {
frontWhizzy.style.transform = "rotateX(45deg)";
frontWhizzy.style.display = "block";
backWhizzy.style.display = "none";
}
TweenMax.set(wizzy, {drawSVG:"0% 0%", opacity: 1, transformOrigin: "70%, 10%", scale: 1.3 });
WhizzLight.to(wizzy, 0.01, {drawSVG:"0% 0%", onStart: WizzyGroupToBack, ease:Power0.easeOut});
WhizzLight.to(wizzy, 0.21, {drawSVG:"15% 10%", onComplete: WizzyGroupToBack , ease:Power0.easeOut});
WhizzLight.to(wizzy, 0.21, {drawSVG:"30% 20%", onStart: WizzyGroupToFront, ease:Power0.easeOut });
WhizzLight.to(wizzy, 0.21, {drawSVG:"40% 30%", onComplete: WizzyGroupToBack, ease:Power0.easeOut });
WhizzLight.to(wizzy, 0.21, {drawSVG:"50% 60%", onComplete: WizzyGroupToBack, ease:Power0.easeOut });
WhizzLight.to(wizzy, 0.21, {drawSVG:"60% 70%", onComplete: WizzyGroupToBack, ease:Power0.easeOut});
WhizzLight.to(wizzy, 0.21, {drawSVG:"70% 80%", onStart: WizzyGroupToFront, ease:Power0.easeOut});
WhizzLight.to(wizzy, 0.21, {drawSVG:"80% 90%", onStart: WizzyGroupToFront, ease:Power0.easeOut });
WhizzLight.to(wizzy, 0.21, {drawSVG:"90% 95%", onComplete: WizzyGroupToBack, ease:Power0.easeOut});
WhizzLight.to(wizzy, 0.11, {drawSVG:"100% 110%", onComplete: WizzyGroupToBack, ease:Power0.easeOut});
},
// Red Orb Timeline Animation
redOrbTimeline:function() {
var redBall = document.getElementById('red-ball');
var frontRed = document.getElementById('front-red-ball');
var backRed = document.getElementById('back-red-ball');
function toFrontRed() {
frontRed.style.display = "block";
backRed.style.display = "none";
}
function toBackRed() {
frontRed.style.display = "none";
backRed.style.display = "block";
}
TweenMax.set(redBall,{scale: 1.1});
var redBallTimeline = new TimelineMax({repeat:-1});
redBallTimeline.to(redBall, 1, {scale: 1.1, x: 180, onStart: toFrontRed, ease:Power0.easeOut });
redBallTimeline.to(redBall, 0.7, {scale: 0.9, x: 80, onStart: toBackRed, ease:Power0.easeOut });
redBallTimeline.to(redBall, 1, {scale: 0.9, x: -60, onStart: toBackRed, ease:Power0.easeOut });
redBallTimeline.to(redBall, 0.5, {scale: 1.1, x: 0, onStart: toFrontRed, ease:Power0.easeOut});
},
// Yellow Orb Timeline Animation
yellowOrbTimeline:function() {
var frontYellow = document.getElementById('front-yellow-ball');
var backYellow = document.getElementById('back-yellow-ball');
var yellowBall = document.getElementById('yellow-ball');
function toFrontYellow() {
frontYellow.style.display = "block";
backYellow.style.display = "none";
}
function toBackYellow() {
frontYellow.style.display = "none";
backYellow.style.display = "block";
}
TweenMax.set(yellowBall, {scale: 1.1, opacity: 0});
var yellowBallTimeline = new TimelineMax({delay: 1, repeat: -1, onStart: function(){
TweenMax.set(yellowBall, {scale: 1.1, opacity: 1});
}});
yellowBallTimeline.to(yellowBall, 1, {opacity:1, scale: 1, x: 230, onStart: toFrontYellow, ease:Power0.easeOut });
yellowBallTimeline.to(yellowBall, 0.7, {opacity:1 ,scale: 0.7, x: 80, onStart: toBackYellow, ease:Power0.easeOut });
yellowBallTimeline.to(yellowBall, 1, {opacity:1, scale: 0.7, x: -20, onStart: toBackYellow, ease:Power0.easeOut });
yellowBallTimeline.to(yellowBall, 0.5, {opacity:1, scale: 1, x: 0, onStart: toFrontYellow, ease:Power0.easeOut});
},
// Blue Orb Timeline Animation
blueOrbTimeline:function() {
var frontBlue = document.getElementById('front-blue-ball'),
backBlue = document.getElementById('back-blue-ball'),
blueBall = document.getElementById('blue-ball');
function toFrontBlue() {
frontBlue.style.display = "block";
backBlue.style.display = "none";
}
function toBackBlue() {
frontBlue.style.display = "none";
backBlue.style.display = "block";
}
TweenMax.set(blueBall, {scale: 1.1, opacity: 0});
var blueBallTimeline = new TimelineMax({delay: 2, repeat: -1, onStart: function(){
TweenMax.set(blueBall, {scale: 1.1, opacity: 1});
}});
blueBallTimeline.to(blueBall, 1, {opacity:1, scale: 1, x: 140, onStart: toFrontBlue, ease:Power0.easeOut });
blueBallTimeline.to(blueBall, 0.7, {opacity:1 ,scale: 0.7, x: 80, onStart: toFrontBlue, ease:Power0.easeOut });
blueBallTimeline.to(blueBall, 1, {opacity:1, scale: 0.7, x: -100, onStart: toBackBlue, ease:Power0.easeOut });
blueBallTimeline.to(blueBall, 0.5, {opacity:1, scale: 1, x: 0, onStart: toFrontBlue, ease:Power0.easeOut});
}
};
vectorTrophy.trophyTimeline();
vectorTrophy.wizzyTimeline();
vectorTrophy.redOrbTimeline();
vectorTrophy.yellowOrbTimeline();
vectorTrophy.blueOrbTimeline();
})();
Also see: Tab Triggers