cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <svg viewBox="0 0 160 90" xmlns="http://www.w3.org/2000/svg" class="character-1">
	<title>Character 1</title>
	<g class="c1-character">
		<path class="c1-eyes c1-main" d="M66.3 34.46a14.72 14.72 0 1 1-14.72-14.72A14.72 14.72 0 0 1 66.3 34.46zM117.07 26.82a14.71 14.71 0 1 1-14.71-14.71 14.71 14.71 0 0 1 14.71 14.71z"/>
		<path class="c1-pupils c1-main" d="M57.67 27a7.23 7.23 0 1 1-7.23-7.23A7.23 7.23 0 0 1 57.67 27zm-7.33-2.32a2 2 0 1 0 2 2 2 2 0 0 0-2.01-2.03zM112.67 19.74a7.23 7.23 0 1 1-7.23-7.23 7.23 7.23 0 0 1 7.23 7.23zm-6.33-3.09a2 2 0 1 0 2 2 2 2 0 0 0-2.01-2z"/>
		<path class="c1-body c1-main" d="M114.5 41.39l2.58-7.89a60.54 60.54 0 0 1-16.87-2.42 50.09 50.09 0 0 1-14.12-7.7l-2.13 6.54c-.75 0-1.5-.06-2.26-.06a52.57 52.57 0 0 0-13.4 1.73l-2.49-4.91A60.54 60.54 0 0 1 52.15 36.9a50.09 50.09 0 0 1-15.43 4.54l3.93 7.74.59-.3a52.51 52.51 0 1 0 73.25-7.49z"/>
		<path class="c1-hand" d="M143.71 87.61a6.52 6.52 0 0 0-11.57-3.79 6.52 6.52 0 0 0-10.05-.06 6.52 6.52 0 0 0-10 0 6.53 6.53 0 1 0 0 8.39 6.52 6.52 0 0 0 10 0 6.52 6.52 0 0 0 10.05-.06 6.52 6.52 0 0 0 11.57-4.47zM53.15 81.42a6.51 6.51 0 0 0-5 2.33 6.52 6.52 0 0 0-10 0 6.52 6.52 0 0 0-9.5-.53 6.53 6.53 0 1 0 0 9.45 6.52 6.52 0 0 0 9.5-.53 6.52 6.52 0 0 0 10 0 6.53 6.53 0 1 0 5-10.73z"/>
		<path class="c1-hand" d="M53.15 81.42a6.51 6.51 0 0 0-5 2.33 6.52 6.52 0 0 0-10 0 6.52 6.52 0 0 0-9.5-.53 6.53 6.53 0 1 0 0 9.45 6.52 6.52 0 0 0 9.5-.53 6.52 6.52 0 0 0 10 0 6.53 6.53 0 1 0 5-10.73z"/>
		<path class="c1-mouth-nose c1-main" d="M76.5 51.31a2.5 2.5 0 1 1-2.5-2.5 2.5 2.5 0 0 1 2.5 2.5zM89.16 49.11a2.35 2.35 0 1 1-3.32 0 2.35 2.35 0 0 1 3.32 0zM93.32 55.1A13.16 13.16 0 0 1 71 66.83 13.16 13.16 0 1 0 93.32 55.1z"/>
		<path class="c1-teeth c1-main" d="M83.18 74.68l4-1.58-1.35-3.38a13.06 13.06 0 0 1-4.1 1.21zM87.78 68.51l1.31 3.27 4-1.58-2-4.9a13.23 13.23 0 0 1-3.31 3.21z"/>
		<path class="c1-accents c1-main" d="M69.07 71.75a4.88 4.88 0 0 1 4.66-8.51M68.82 50.78a4.88 4.88 0 0 1 9.67-.78M82.82 49.78a4.88 4.88 0 0 1 9.67-.78"/>
	</g>
</svg>
            
          
!
            
              body {
	background-color: #C8DFFB;
}

.character-1 {
	position: absolute;
	bottom: 0;
	left: 0;
	max-width: 50vw;
}


// Character 1

.c1-main {
	// transform: translateY(150);
}

.c1-eyes {
	fill:#fff;
}

.c1-body {
	fill:#27aae1;
}

.c1-hand {
	fill: #1b75bc;
}

.c1-mouth-nose,
.c1-pupils {
	fill: #231f20;
}

.c1-accents {
	fill: none;
	stroke: #1b75bc;
	stroke-miterlimit: 10;
}

.c1-teeth {
	fill: white;
}

            
          
!
            
              
function runBlinkingAnimation() {
	const mainBody = document.querySelectorAll(".c1-main"),
				eyes = document.querySelector(".c1-eyes"),
				pupils = document.querySelector(".c1-pupils"),
				characterTrigger = document.querySelector("body");

	var characterVisible = false;
	var tl = new TimelineLite();

	tl.set(mainBody, { y: 150 });
	
	characterTrigger.addEventListener("touchstart", () => {
		showCharacter();
	});

	characterTrigger.addEventListener("mouseover", () => {
		showCharacter();
	});

	if( characterVisible == true ) {
		var moveEye = new TimelineMax({ delay: 2 });
		moveEye.add(TweenMax.to(pupils, 0.2, { x: 1, y: 2, rotation: 2, transformOrigin: "50% 100%" }));
	}


	var blink = new TimelineMax({ delay: 0.5, repeat: 20, repeatDelay: 2 });

	blink.add(TweenMax.fromTo(eyes, 0.5, { fill: '#1B75BC' }, { fill: 'white' }));
	blink.add(TweenMax.fromTo(pupils, 0.5, { fill: '#1B75BC' }, { fill: '#000000' }), '-=0.5');


    function showCharacter() {
			tl.to(mainBody, 0.5, {
				y: 0,
				delay: 0.5,
				ease: Power3.easeOut
			});
      characterVisible = true;
    }
}

runBlinkingAnimation();
            
          
!
999px
Loading ..................

Console