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 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.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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="frame">
<div class="content">
<h1>Radar animation</h1>
<svg version="1.0" id="radar" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="509.426px" height="381.718px" viewBox="0 0 509.426 381.718" enable-background="new 0 0 509.426 381.718"
xml:space="preserve">
<polygon id="back" fill-rule="evenodd" clip-rule="evenodd" fill="#D9D9D9" points="403.4,106.209 402.4,104.477 255.593,189.236
255.593,19.718 253.593,19.718 253.593,189.13 106.592,104.218 105.593,105.951 252.685,190.915 105.786,275.727 106.786,277.459
253.593,192.7 253.593,362.218 255.593,362.218 255.593,192.595 402.093,277.218 403.093,275.486 256.684,190.916 "/>
<path id="dots" fill-rule="evenodd" clip-rule="evenodd" fill="#FFC575" d="M366.593,116.218c-5.523,0-10,4.477-10,10
c0,5.523,4.477,10,10,10s10-4.477,10-10C376.593,120.695,372.116,116.218,366.593,116.218z M352.593,239.274
c-5.523,0-10,4.477-10,10c0,5.523,4.477,10,10,10s10-4.477,10-10C362.593,243.751,358.116,239.274,352.593,239.274z
M253.482,249.274c-5.523,0-10,4.477-10,10s4.477,10,10,10c5.523,0,10-4.477,10-10S259.005,249.274,253.482,249.274z
M159.093,234.274c-5.523,0-10,4.477-10,10c0,5.523,4.477,10,10,10s10-4.477,10-10
C169.093,238.751,164.616,234.274,159.093,234.274z M159.093,130.218c0-5.523-4.477-10-10-10s-10,4.477-10,10
c0,5.523,4.477,10,10,10S159.093,135.741,159.093,130.218z M255.093,41.218c-5.523,0-10,4.477-10,10c0,5.523,4.477,10,10,10
s10-4.477,10-10C265.093,45.695,260.616,41.218,255.093,41.218z"/>
<polygon id="mask" fill-rule="evenodd" clip-rule="evenodd" fill="#FFC575" points="254.593,50.718 149.593,129.718 159.25,244.128
253.593,261.718 352.593,248.7 367.093,125.718 "/>
<polygon id="mask2" fill-rule="evenodd" clip-rule="evenodd" fill="#FFC575" points="254.593,50.718 149.593,129.718 159.25,244.128
253.593,261.718 352.593,248.7 367.093,125.718 "/>
<path id="lines" fill-rule="evenodd" clip-rule="evenodd" fill="#FFC575" d="M161.159,248.058l91.271,13.776l0.597-3.955l-91.271-13.776
L161.159,248.058z M256.854,257.649l0.389,3.981l91.61-8.948l-0.389-3.981L256.854,257.649z M365.511,126.74l-14.307,118.476
l3.971,0.48l14.307-118.476L365.511,126.74z M367.204,123.055l-111.5-74.5l-1.111,1.663l-1.21-1.593l-106,80.5l2.298,3.026
l-2.246,0.157l7.825,112.098l3.99-0.279l-7.825-112.098l-1.38,0.096l104.621-79.453l110.315,73.708L367.204,123.055z"/>
<g id="texts">
<text transform="matrix(1 0 0 1 237.7392 11.7183)">Front</text>
<text transform="matrix(1 0 0 1 232.3003 378.2183)">System</text>
<text transform="matrix(1 0 0 1 413.4819 104.2184)">Management</text>
<text transform="matrix(1 0 0 1 -0.21 104.2184)">Communication</text>
<text transform="matrix(1 0 0 1 21.77 287.4594)">Architecture</text>
<text transform="matrix(1 0 0 1 413.4824 287.2184)">Back</text>
</g>
</svg>
</div>
<div class="author"><a href="https://ggaulard.github.io">Guillaume Gaulard <i class="fa fa-external-link"></i></a></div>
</div>
@import url(https://fonts.googleapis.com/css?family=Roboto:100);
#radar {
font-size: 14px;
font-family: 'Roboto', sans-serif;
//max-width:509.426px;
width: 100%
}
var radar = Snap("#radar");
var radarMask = Snap("#mask");
var radarMask2 = Snap("#mask2");
var radarLines = Snap("#lines");
var radarDots = Snap("#dots");
var p = radar.path("M10-5-10,15M15,0,0,15M0-5-20,15").attr({
fill: "none",
stroke: "#FFC575",
strokeWidth: 5
});
// To create pattern,
// just specify dimensions in pattern method:
p = p.pattern(0, 0, 10, 10);
// Then use it as a fill on big circle
radarMask2.attr({
fill: p
});
radarMask.attr({
mask: radarMask2
});
radarMask.attr({fill: "r(0.5, 0.65, 0.6)#FFC575-#fff"});
var radarGroup = radar.group(radarMask, radarLines, radarDots);
var scale = 0;
var box = radar.getBBox();
var c = {x:box.cx + 9, y: box.cy}
function animate(){
radarGroup.transform('s0,'+c.x+','+c.y)
radarGroup.animate({ transform: 's1,'+c.x+','+c.y }, 1000, mina.bounce);
}
animate();
radar.click(animate);
Also see: Tab Triggers