Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource


Add Packages

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.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="wrapper">
	<p class="message">Press <em>Down Arrow</em> to animate the mouth.</p>
	<!-- Head #1 -->
	<svg id="saitama" width="300px" height="300px" viewbox="0 0 100 100">

		<!-- Skull -->
		<path stroke="pink" fill="pink"
					v5h5v5h5v5v20 v5h-5v5h-5v5
					v-5h-5v-5h-5v-5v-20 v-5h5v-5h5v-5z"/>

		<!-- Eye -->
		<!-- Pupil Color -->
		<path stroke="#f9a" fill="white"
		<!-- White -->
	<!-- 	<path stroke="black" fill="cyan"
				m4,0v12h6v-12z"/> -->
		<!-- Pupil -->
		<path fill="black"

		<!-- Eye -->
		<!-- Pupil Color -->
		<path stroke="#f9a" fill="white"
		<!-- White -->
	<!-- 	<path stroke="black" fill="cyan"
				m4,0v12h6v-12z"/> -->
		<!-- Pupil -->
		<path fill="black"

		<!-- Mouth -->
		<path class="mouth" stroke="black" fill="white"
		<path class="mouth" id="mouthOpen" stroke="black" fill="#c48"

	<!-- 	<path stroke="black" fill="white"
			d="M30,40h20c0,10 -20,10 -20,0z"/> -->

	<!-- 	<rect stroke="black" fill="white" x="20" y="20" width="10" height="10"/> -->


                body {
	background-color: #0bf;
	padding: 0px;
	margin: 0px;

.hidden { display: none; }

.wrapper {
	display: flex;
	flex-flow: column;
	justify-content: center;
	align-items: center;
	align-content: center;
	box-sizing: border-box;
	width: 100vw;
	height: 100vh;
	padding: 2em;

.message {
	background-color: white;
	padding: 0.5em 1em;
	margin: 0em 1em;


                let chatBubble1 = document.querySelector("#saitamaBubble");
let chatBubble2;
let face1 = document.querySelector("#saitama");
let face2;
let mouth1 = document.querySelector("#mouthOpen");
let mouth2;
const stringMessage = "Welcome! I'm just an animated SVG Face with a pre-written message to speak to you. I wish I could actually speak to you, or at least allow you to tell me what to say.";

function jab( person ){
	let jabbers = 0;
	let animation = window.setInterval(function(){
		if( jabbers >= 25 ){
		// We use querySelectorAll() on a given person parameter so you can pass an SVG drawing of one head collection and target the element with .mouth on it.
			// We are using this method and choosing the 1 index because our current animation methods relies on two drawings of a mouth, one open one closed, open being on top of closed. We animate by toggling the display of the open mouth which is the first index.
		if( jabbers%2 ){
			person.querySelectorAll(".mouth")[1].style.display = "block";
			person.querySelectorAll(".mouth")[1].style.display = "none";	
	}, 500)

function typeIt( string, target ) {
    var hold = [];
    var step = 1;
    var tick = setInterval(function() {
        if(step == string.length) { clearInterval(tick) };
        hold.push(string.slice(step - 1, step));
        step += 1;
       target.innerHTML = hold.join('');
		 // document.getElementById('box').innerHTML = hold.join('');
    }, 50);

function blab( openMouth ){

document.addEventListener("keypress", (e) => {if( e.keyCode === 40 ){ blab( mouth1 ); }} );

// jab( face1 );
// typeIt( stringMessage, chatBubble1 );