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="container">
<!-- remove the height and width from the svg element ... width="555.4" height="277.3"... -->
<svg id="misvg" viewBox="0 0 1120 480">
<rect class="hg1" x="0" y="0" width="1120" height="480"/>
<!-- Stgae left -->
<!-- =========================-->
<!-- 1 -->
<g>
<rect id="s1bg" class="hb" y="0" width="1120" height="0"/>
<g id="oz" transform="translate(-1900 1630) scale(6)">
<path class="ht" d="M535.058,71.316a2.273,2.273,0,0,1-.92-2.871l11.467-24.76a1.218,1.218,0,0,0-1.187-1.869l-95.773-.527a4.024,4.024,0,0,0-3.112,1.739L414.054,94.847a4.109,4.109,0,0,1-3.111,1.771l-29.337.3a4.231,4.231,0,0,0-3.149,1.748L334.04,168.293a12.315,12.315,0,0,1-2.779,2.9l-66.02,46.243a4.424,4.424,0,0,0-1.677,3.223v14.794a11.186,11.186,0,0,0,.853,3.91L312.357,344a12.889,12.889,0,0,1,.962,3.907l1.737,32.477a2.17,2.17,0,0,0,2.158,2.029l44.419-.364a5.53,5.53,0,0,0,3.454-1.506l13.238-14.017a12.513,12.513,0,0,1,3.27-2.337l84.749-38.565a11.146,11.146,0,0,1,3.912-.84l75.089.305a4.267,4.267,0,0,1,3.171,1.721l19.209,29.29a6.285,6.285,0,0,0,3.1,2.253l52.069,14.241a6.855,6.855,0,0,1,3.186,2.192l22.187,30.246a4.559,4.559,0,0,0,3.259,1.652h64.266a3.478,3.478,0,0,0,2.9-1.863L782.5,265.21a11.92,11.92,0,0,0,.9-3.91l.993-41.832a6.891,6.891,0,0,0-1.183-3.685L636.4,20.637c-.677-.9-1.278-.717-1.335.408L629.88,123.129A1.162,1.162,0,0,1,628,124.162Z"/>
<path class="ht" d="M686.324,458.231a1.191,1.191,0,0,1-2.183,0l-21.6-34.307c-.6-.953-.17-1.733.956-1.733H706.97c1.126,0,1.557.78.957,1.733Z"/>
</g>
<g id="s1t1" transform="translate(560 -630)">
<text class="t92 hw" transform="translate(0 0)"><tspan id="s1counter">0</span></text>
<text class="t32 hw" transform="translate(0 40)">SURVEY RESPONDENTS</text>
</g>
</g>
<!-- =========================-->
<!-- s2 -->
<g>
<rect id="s2bg" class="hb" x="0" y="186" width="1120" height="0"/>
<g id="s2t1" transform="translate(560 -300)">
<text class="t92 ht" transform="translate(0 0)">64%</text>
<text class="t32 ht" transform="translate(0 50)">UNDERTOOK</text>
</g>
<text id="s2t2" class="t48 ht" transform="translate(560 610)">Professional leaning activities</text>
<rect class="award ht" x="-310" y="205" width="90" height="94" />
<rect class="award ht" x="-310" y="205" width="90" height="94" />
<rect class="award ht" x="-310" y="205" width="90" height="94" />
<rect class="awardht " x="-310" y="205" width="90" height="94" />
<g class="award">
<rect class="ht" x="-310" y="205" width="237" height="94"/>
<text class="hw t32" x="-190" y="262">4 OR MORE</text>
</g>
</g>
<!-- =========================-->
<!-- s3 -->
<rect id="s3bg" class="hb" transform="translate(-1120 155)" width="1120" height="100"/>
<text id="s3t2" class="t32 ht" transform="translate(560 -80)"><tspan>Average time</tspan><tspan x="0" dy="40">spent professional learning activity</tspan></text>
<text id="s3t1" class="t92 ht" transform="translate(680 -100)"><tspan id="s3counter" dx="1 -9 -10">0</tspan> hrs</text>
<g id="watch" transform="translate(-300 150)">
<g>
<path class="ht" d="M175.7,89.958q-12.51-41.076-53.013-57.216L106.212,0H10.886L8.375.765l8.1,64.327q-24.942,34.98-12.118,77.054t53.012,57.215L72.276,229h99.1l-7.8-61.989Q188.207,131.052,175.7,89.958Zm-26.522,57.624q-13.065,24.515-39.618,32.6T58.493,175.2q-24.51-13.065-32.6-39.619T30.874,84.52q13.065-24.511,39.619-32.6T121.557,56.9q24.508,13.066,32.6,39.619T149.175,147.582Z"/>
<circle class="hg9" cx="89" cy="116" r="68"/>
<circle class="wspin sw" cx="89" cy="116" r="35" transform="rotate(-108, 89, 116)"/>
<circle class="mins sg9" cx="89" cy="116" r="56" />
</g>
</g>
</svg>
</div><!-- </container> -->
<div id="buttons">
<button id="t1">Tween 1</button> <button id="t2">Tween 2</button> <button id="t3">Tween 3</button> <button id="tM">Play Master</button>
</div>
</div><!-- /frame -->
.framework {
max-width: 1120px;
margin: 0 auto;
background: #ffffff;
}
.container {
width: 100%;
height: 0;
padding-top: 42.86%;
position: relative;
border:0px solid green;
overflow: hidden;
}
svg {
position: absolute;
top: 0;
left: 0;
}
#misvg {border:1px solid red;}
#buttons {
position:absolute;
top:0;
right:40%;
padding:1%;
}
.hb { fill: #afe1e3; }
.hw { fill: #ffffff; }
.ht { fill: #007377; }
.hg9 { fill: #67696B; }
.hg1 { fill: #f7f7f7; }
.ho { fill: #ec7700; }
/* STROKE */
.sw { stroke: #ffffff;}
.sg9 { stroke: #67696B;}
.cls-3 {
fill: #007377;
}
.t32 {
font-size: 32px;
font-family: Arial;
text-anchor:middle;
}
.t38 {
font-size: 38px;
font-family: Arial;
text-anchor:middle;
}
.t92 {
font-size: 92px;
font-family: Arial;
font-weight: 700;
text-anchor:middle;
}
.t48 {
font-size: 48px;
font-family: Arial;
font-weight: 700;
text-anchor:middle;
}
.mins {
stroke-width:5;
stroke-dasharray: 8;
fill:none;
}
.wspin {
stroke-width:70;
stroke-dasharray: 252;
stroke-dashoffset:252;
fill:none;
}
var cosas = { count3: 0, count1:0 };
var s1counter = document.getElementById("s1counter");
var s3counter = document.getElementById("s3counter");
var animations = {
t1in: function(){
var ana1 = new TimelineMax({ });
ana1.to("#oz", .4, {x:0, y:0, scale:1})
.to("#s1t1", .2, {x:520, y:230, ease: Back.easeOut.config(1.5)}, "-=0.2")
.to(cosas, 1, { count1:1415, onUpdate:function(){s1counter.textContent = Math.ceil(cosas.count1);}},"-=.1")
.to("#s1bg", .3, {x:0, y:82, attr:{height:318, width:1120}}, "-=1")
//add more twwens
return ana1;
},
t1out: function(){
var ana2 = new TimelineMax({ });
ana2.to("#oz", .2, {x:-220, y:600, scale:3})
.to("#s1t1", .2, {x:520, y:-230, ease: Back.easeOut.config(1.5)}, "-=0.2")
.to("#s1bg", .3, {x:0, y:232, attr:{height:0}}, "-=0.3")
.set(cosas, {count1:0})
return ana2;
},
// ---scene 2 Square
t2in: function(){
var ana3 = new TimelineMax({ });
ana3.staggerTo(".award", .5, {
cycle:{x:function(index){return (index * 100)+560;}
}, ease: Back.easeOut.config(1)}, 0.25)
.to("#s2t1", .5, {y:110, ease: Back.easeOut.config(1)}, "-=1.5")
.to("#s2t2", .2, {y:400, ease: Back.easeOut.config(1)}, "-=0.3")
.to("#s2bg", .5, {attr:{height:129}}, "-=1.5");
return ana3;
},
t2out: function(){
var ana4 = new TimelineMax({});
ana4.staggerTo(".award", 0, {
cycle:{x:function(index){return (index * 100)-560;}
}}, 0)
.to("#s2t1", .2, {y:-100}, 0)
.to("#s2t2", .2, {y:600}, 0)
.to("#s2bg", .2, {attr:{height:0}},0);
return ana4;
},
// ---scene 3 Text
t3in: function(){
var ana5 = new TimelineMax({ });
ana5.to("#s3bg", .5, {x:0, attr:{height:220}})
.to("#s3t2", .5, {y:80, ease: Back.easeOut.config(1.5)})
.to("#watch", 1, {x:300}, "-=.5")
.to(".wspin", 1, { strokeDashoffset:62.84}, "-=1")
.to("#s3t1", .75, {y:300}, "-=1")
.to(cosas, 1, { count3:10, onUpdate:function(){s3counter.textContent = Math.ceil(cosas.count3);}},"-=1")
//not using innerHtml as ie does not play well
return ana5;
},
t3out: function(){
var ana6 = new TimelineMax({ });
ana6
.set(".wspin", { strokeDashoffset:252})
.set("#s3t2", {y:-80})
.to("#watch", 0.3, {x:-300})
.set(cosas, {count3:0})
.to("#s3bg", .2, {x:-1120, attr:{height:100}})
.set("#s3t1", {y:-100}, "-=.6")
// .call()
return ana6;
}
};
animations.t1in();
currScene = "t1"
//need help here
$('#buttons button').click(function(){
var next = $(this).attr("id");
// if(animations[currScene+'out'].isActive() ){console.log('currentOut active')};
if (next !== currScene && next !== "tM") {
animations[currScene+'out'](); //play current timeline out
animations[next+'in'](); //play selected timeline in
currScene = next;
}
});
var master = new TimelineMax({paused:true});
master.add(animations.t1in())
.add(animations.t1out())
.add(animations.t2in())
.add(animations.t2out())
.add(animations.t3in())
.add(animations.t3out()).progress(1).progress(0); //force a recording of all the states immediately (start and end)
$('#tM').click(function(){
master.restart();
})
Also see: Tab Triggers