cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <div class="promo">
        <h2>Owl Generator</h2>
        <div class="controls">
            <div id="generate" class="roundbtn blue">
                <div class="inner">
                    <span class="text">Generate More Owls</span>
                </div>
            </div>
            <div id="clear" class="roundbtn">
                <div class="inner">
                    <span class="text">Clear Owls</span>
                </div>
            </div>
        </div>
        <div class="advice">Looks like no one is here. Press some buttons!</div>
    </div>
    <div id="wrap" class="wrapper">
        <svg id="owly" class="bird" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-50 -10 230 250" xml:space="preserve">
            <g class="owl">
                <g class="Left_Leg">
                    <path class="st1" d="M47.8,139.4c0,0-4.1,4.7-4.6,10c-0.5,5.3,2.3,10.4,4.6,10.7c2.3,0.2,6.4-3.3,6.2-9.8
		        C53.8,143.9,47.8,139.4,47.8,139.4z" />
                    <path class="st1" d="M37.9,139.8c0,0-6.2,0.7-10.1,4.3c-3.9,3.6-5.4,9.2-3.9,11c1.5,1.7,6.9,1.9,11.2-3
		        C39.3,147.2,37.9,139.8,37.9,139.8z" />
                    <path class="st1" d="M43.6,137.5c0,0-8.7,4-11.8,9.7c-3.2,5.7-3.7,12.7-1,14.3s11-4.5,13.7-9.7C47.1,146.7,43.6,137.5,43.6,137.5z" />
                </g>
                <g class="Right_Leg">
                    <path class="st1" d="M79.5,139.4c0,0,4.1,4.7,4.6,10c0.5,5.3-2.3,10.4-4.6,10.7c-2.3,0.2-6.4-3.3-6.2-9.8
		        C73.5,143.9,79.5,139.4,79.5,139.4z" />
                    <path class="st1" d="M89.4,139.8c0,0,6.2,0.7,10.1,4.3c3.9,3.6,5.4,9.2,3.9,11c-1.5,1.7-6.9,1.9-11.2-3
		        C87.9,147.2,89.4,139.8,89.4,139.8z" />
                    <path class="st1" d="M83.6,137.5c0,0,8.7,4,11.8,9.7c3.2,5.7,3.7,12.7,1,14.3c-2.7,1.7-11-4.5-13.7-9.7
		        C80.1,146.7,83.6,137.5,83.6,137.5z" />
                </g>
                <g class="Body">
                    <path class="st-body" d="M28.1,9.8C29,9,39.8,0,66.3,0s35.5,9.8,35.5,9.8S117.1-0.7,123.6,3c4.2,8.3-4.8,45.3-4.8,45.3l3.8,32
		        c0,0,8.2,62.7-57.2,64C-0.1,145.7,6.1,82,6.1,82l4.3-36.2c0,0-7.2-38.5-2.3-41.5S28.1,9.8,28.1,9.8z" />
                </g>
                <g class="Belly">
                    <path class="st-belly" d="M18,125.5c0,0,7.6-36.2,46.1-38s46.3,38.5,46.3,38.5s-10.8,16.7-45,19S18,125.5,18,125.5z" />
                </g>
                <g class="belly_waves">
                    <path class="st4" d="M34.1,101.6c2.5,2.4,6.3,6.6,10.1,6.7c3.7,0.1,7.2-4.1,9.3-6.7c-0.7,0-1.4,0-2.1,0c3,2.9,7.2,6.4,11.5,6.6
		                c4.6,0.3,8.5-3.5,11.1-6.9c-0.9,0-1.7,0-2.6,0c5.6,8.4,18.1,9.5,23.3,0c0.9-1.7-1.7-3.2-2.6-1.5c-4,7.4-13.8,6.6-18.2,0
		                c-0.7-1-1.9-0.9-2.6,0c-2.5,3.3-6.2,6.5-10.6,4.8c-2.8-1.1-5.2-3.1-7.3-5.1c-0.5-0.5-1.6-0.6-2.1,0c-1.6,1.9-4.7,6.1-7.5,5.7
		                c-2.7-0.4-5.7-3.9-7.6-5.7C34.8,98.2,32.7,100.3,34.1,101.6L34.1,101.6z" />
                    <path class="st4" d="M45.8,122.3c1.7,3.5,4.9,8.5,9.3,8.5c4.4,0,7.8-5,9.5-8.5c-0.9-0.1-1.8-0.2-2.7-0.4
		                c1.7,4.2,5.2,8.8,10.2,8.9c4.9,0,8.1-4.6,9.4-8.9c0.6-1.8-2.3-2.6-2.9-0.8c-0.9,2.9-3.1,6.6-6.6,6.6c-3.5,0-6.1-3.8-7.3-6.6
		                c-0.4-1.1-2.1-1.6-2.7-0.4c-1.2,2.5-3.8,7-7,7c-3.1,0-5.5-4.5-6.7-7C47.6,119.1,45,120.6,45.8,122.3L45.8,122.3z" />
                </g>
                <g class="Wing_Left">
                    <path class="wing" d="M37.4,93.6c0,0,25.5,23.8,21.3,32.8c-3.2,0.9-6.3,1.5-9.2,1.9C30,130.6,18.3,122,12.1,115
		            c-4-4.5-5.7-8.4-5.7-8.4s-4.5-18.3,5.3-23.8S37.4,93.6,37.4,93.6z" />
                    <path class="st4" d="M36.3,94.6c4.8,4.5,9.4,9.4,13.5,14.6c2.8,3.6,6,7.7,7.3,12.2c0.2,0.7,0.6,1.8,0.5,2.6
		                c-0.4,1.6-0.3,1-1.8,1.4c-4.2,1.3-9,1.7-13.3,1.6c-13.5-0.1-26-6.8-33.2-18.3C5.9,103.3,5.2,92,9.8,86.4
		                C17,77.5,30.7,89,36.3,94.6c1.4,1.4,3.5-0.7,2.1-2.1c-6-6.1-16.7-14.9-25.9-11.7c-9.4,3.3-10.3,17.7-7.7,25.8
		                C8.5,118,22,126.7,33,129.1c4.2,0.9,8.6,1.2,12.9,1c3.4-0.2,10.4-0.2,13.1-2.3c3-2.2,1.2-7.3-0.2-10.1
		                c-4.5-9.6-12.8-18-20.4-25.1C37,91.2,34.9,93.3,36.3,94.6z" />
                    <path class="wing" d="M14.4,97.2c-3.4,5-2.3,17.7-2.3,17.7" />
                    <path class="st4" d="M13.1,96.5c-3.2,5.2-3,12.6-2.5,18.5c0.2,1.9,3.2,1.9,3,0c-0.4-5.4-0.8-12.3,2.1-17
		                C16.7,96.3,14.1,94.8,13.1,96.5L13.1,96.5z" />
                    <path class="wing" d="M21.6,106.1c-3.3,5.4-0.6,16.5-0.6,16.5" />
                    <path class="st4" d="M20.3,105.3c-2.8,5.2-2.1,12.1-0.8,17.7c0.4,1.9,3.3,1.1,2.9-0.8c-1.1-4.7-1.9-10.9,0.5-15.4
		                C23.8,105.1,21.3,103.6,20.3,105.3L20.3,105.3z" />
                    <path class="wing" d="M30.1,112c-3.5,5.3-0.7,14.6-0.7,14.6" />
                    <path class="st4" d="M28.8,111.2c-2.8,4.6-2.3,10.7-0.9,15.7c0.5,1.9,3.4,1.1,2.9-0.8c-1.2-4.2-1.8-9.5,0.6-13.4
		                C32.4,111.1,29.8,109.5,28.8,111.2L28.8,111.2z" />
                    <path class="wing" d="M47.5,121c-1.5,2.6,0.8,7.4,0.8,7.4" />
                    <path class="st4" d="M46.2,120.2c-1.4,2.8-0.5,6.2,0.8,8.9c0.8,1.7,3.4,0.2,2.6-1.5c-0.7-1.5-1.6-4.2-0.8-5.9
		                C49.7,120,47.1,118.5,46.2,120.2L46.2,120.2z" />
                    <path class="wing" d="M38,128.4c0,0-2.1-6.3,1-11.8" />
                    <path class="st4" d="M39.4,128c-1.1-3.5-0.8-7.4,0.9-10.6c0.9-1.7-1.7-3.2-2.6-1.5c-2.1,3.9-2.5,8.7-1.2,12.9
		                C37.1,130.6,40,129.8,39.4,128L39.4,128z" />
                </g>
                <g class="Wing_Right">
                    <path class="wing" d="M90.7,93.6c0,0-25.5,23.8-21.3,32.8c3.2,0.9,6.3,1.5,9.2,1.9c19.4,2.4,31.1-6.2,37.4-13.3
		            c4-4.5,5.7-8.4,5.7-8.4s4.5-18.3-5.3-23.8S90.7,93.6,90.7,93.6z" />
                    <path class="st4" d="M89.7,92.5C82.9,98.9,76.1,106,71.2,114c-1.9,3.1-5,8.4-3.4,12.2c1.2,2.6,4.9,2.5,7.5,3
		                c4.7,0.8,9.5,1.2,14.2,0.7c13-1.2,28.3-9.6,33.4-22.4c2.9-7.4,2.2-20.2-4.5-25.2C109.2,75.5,96.1,86,89.7,92.5
		                c-1.4,1.4,0.8,3.5,2.1,2.1c5.1-5.1,14.4-13.2,22.1-11.2c8.4,2.1,8.7,16.5,6.5,22.5c-3.9,10.8-16.9,18.6-27.5,20.5
		                c-4.1,0.7-8.3,0.8-12.4,0.4c-2.2-0.2-4.4-0.6-6.6-1c-1.6-0.3-2.8-0.1-3.3-1.4c-1.2-3.2,3.2-9,4.9-11.4
		                c4.7-6.7,10.4-12.9,16.4-18.4C93.2,93.3,91.1,91.2,89.7,92.5z" />
                    <path class="wing" d="M113.7,97.2c3.4,5,2.3,17.7,2.3,17.7" />
                    <path class="st4" d="M112.5,98c2.9,4.7,2.6,11.6,2.1,17c-0.2,1.9,2.8,1.9,3,0c0.5-5.9,0.7-13.3-2.5-18.5
		                C114,94.8,111.4,96.3,112.5,98L112.5,98z" />
                    <path class="wing" d="M106.5,106.1c3.3,5.4,0.6,16.5,0.6,16.5" />
                    <path class="st4" d="M105.2,106.8c2.4,4.4,1.6,10.6,0.5,15.4c-0.4,1.9,2.5,2.7,2.9,0.8c1.3-5.6,2.1-12.5-0.8-17.7
		                C106.9,103.6,104.3,105.1,105.2,106.8L105.2,106.8z" />
                    <path class="wing" d="M98,112c3.5,5.3,0.7,14.6,0.7,14.6" />
                    <path class="st4" d="M96.7,112.7c2.3,3.9,1.8,9.2,0.6,13.4c-0.5,1.9,2.4,2.7,2.9,0.8c1.5-5,1.9-11.1-0.9-15.7
		                C98.3,109.5,95.7,111.1,96.7,112.7L96.7,112.7z" />
                    <path class="wing" d="M80.6,121c1.5,2.6-0.8,7.4-0.8,7.4" />
                    <path class="st4" d="M79.3,121.7c0.9,1.7-0.1,4.3-0.8,5.9c-0.8,1.7,1.8,3.3,2.6,1.5c1.3-2.7,2.2-6.1,0.8-8.9
		                C81,118.5,78.5,120,79.3,121.7L79.3,121.7z" />
                    <path class="wing" d="M90.1,128.4c0,0,2.1-6.3-1-11.8" />
                    <path class="st4" d="M91.6,128.8c1.4-4.2,0.9-9-1.2-12.9c-0.9-1.7-3.5-0.2-2.6,1.5c1.7,3.2,2,7.2,0.9,10.6
		                C88.1,129.8,91,130.6,91.6,128.8L91.6,128.8z" />
                </g>
                <g class="eyes">
                    <g class="Eye1">
                        <path id="eyelash1" class="st5" d="M19.7,27.2c0.5-0.7-6.6-4.2-11.2-2.5c4.9,4.7,3.9,9.7,3.9,9.7S2.3,33.9,1,37.6c6.1,2.2,6.7,7.5,6.7,7.5
		        S0,49.5,0,52.7c6.5-0.5,7.6,3.6,7.6,3.6s-0.5,5.5-5.8,11.1C4,69.8,11.8,67,11.8,67s-3.5,8.8-1.3,10.3c3.6-4,7.8-3.3,7.8-3.3
		        s-0.7,10.3,1.5,11.4c2.4-5.1,8.5-6.3,8.5-6.3s1.2,9,4.3,9C35.1,82,41,80,41,80s6.4,6.4,10.2,5c-2.1-4.6,2.7-10.5,2.7-10.5
		        s5.1,3,8.1,0.6c-1.8-3.5-1-8.2-1-8.2s2.8,0.8,4.6-1.4c-1.5-2.8-1-7.8-1-7.8V44.8c0,0-0.5-6.8,2.6-9.4c-1.6-2-6.6-0.6-6.6-0.6
		        s1.4-5.5,3.4-8c-1.8-3-10,1-10,1s-0.3-5.1,2.5-9C54.4,16.7,45.4,24,45.4,24s-2.9-7.1-1.8-9.9c-4.4-1.5-9,7.8-9,7.8
		        s-8.4-1.3-11.5-7.1C19.3,16.3,19.7,27.2,19.7,27.2z" />
                        <circle class="st6" cx="36.4" cy="51.1" r="29.3" />
                        <circle class="st7" cx="34.6" cy="48.3" r="20.5" />
                        <circle class="iris" cx="35.1" cy="41.3" r="12" />
                        <circle class="st9" cx="34.6" cy="38.3" r="3.5" />
                    </g>
                    <g class="Eye2">
                        <path id="eyelash2" class="st5" d="M109.6,27.2c-0.5-0.7,6.6-4.2,11.2-2.5c-4.9,4.7-3.9,9.7-3.9,9.7s10-0.5,11.4,3.2c-6.1,2.2-6.7,7.5-6.7,7.5
		        s7.7,4.3,7.7,7.6c-6.5-0.5-7.6,3.6-7.6,3.6s0.5,5.5,5.8,11.1c-2.3,2.4-10.1-0.4-10.1-0.4s3.5,8.8,1.3,10.3c-3.6-4-7.8-3.3-7.8-3.3
		        s0.7,10.3-1.5,11.4c-2.4-5.1-8.5-6.3-8.5-6.3s-1.2,9-4.3,9C94.1,82,88.3,80,88.3,80s-6.4,6.4-10.2,5c2.1-4.6-2.7-10.5-2.7-10.5
		        s-5.1,3-8.1,0.6c1.8-3.5,1-8.2,1-8.2s-2.8,0.8-4.6-1.4c1.5-2.8,1-7.8,1-7.8V44.8c0,0,0.5-6.8-2.6-9.4c1.6-2,6.6-0.6,6.6-0.6
		        s-1.4-5.5-3.4-8c1.8-3,10,1,10,1s0.3-5.1-2.5-9c2.3-2.1,11.3,5.1,11.3,5.1s2.9-7.1,1.8-9.9c4.4-1.5,9,7.8,9,7.8s8.4-1.3,11.5-7.1
		        C110,16.3,109.6,27.2,109.6,27.2z" />
                        <circle class="st5" cx="93.4" cy="51.1" r="29.3" />
                        <circle class="st7" cx="91.6" cy="48.3" r="20.5" />
                        <circle class="iris" cx="92.1" cy="41.3" r="12" />
                        <circle class="st9" cx="91.6" cy="38.3" r="3.5" />
                    </g>
                </g>
                <g class="Nose">
                    <ellipse class="st10" cx="63.4" cy="43.3" rx="5.8" ry="15.5" />
                </g>
            </g>
            <ellipse class="shadow" class="ghost-4" cx="67" cy="230" rx="52" ry="6" />
        </svg>
    </div>
            
          
!
            
              *{
  box-sizing: border-box;
}
body {
	height: 100vh;
	text-align: center;
	background: -webkit-radial-gradient(center, ellipse cover, #009688 0%, #00796B 41%, #004D40 100%);
	color: white;
	display: flex;
	flex-direction: column;
	background-repeat: no-repeat;
	background-size: cover;
	justify-content: flex-start;
	align-items: center;
	min-height: 100vh;
	color: #fff;
	font-size: 20px;
	overflow: hidden;
}
.bird {
	transition-property: box-shadow;
	transition-duration: 0.3s;
	animation: pop 1s 1;
}
.promo {
	position: relative;
	margin-top: 5px;
}
h2 {
	margin: 5px 0 0 0;
	padding: 10px 30px;
	font-size: 60px;
	font-family: 'Chango', cursive;
	font-weight: bold;
	width: 100%;
	text-shadow: 0 2px 2px #000;
	color: beige;
	margin-bottom: 18px;
	border-radius: 33%;
	border: 15px solid transparent;
	background: linear-gradient(#20c350, #2ed0c1) padding-box, repeating-linear-gradient(-45deg, red 0, red 25%, #FFF 0, #FFF 50%) 0 / 1em 1em;
	animation: movingBg 30s linear infinite;
	text-transform: uppercase;
	text-align: center;
	box-shadow: 0 0 15px 0px red, 0 0 0 2px red;
}
/* ------------buttons------------- */
.roundbtn {
	width: 270px;
	height: 80px;
	border: 5px solid #9a9a9a;
	display: inline-block;
	background-color: #6c6161;
	-moz-border-radius: 75px;
	-webkit-border-radius: 75px;
	border-radius: 75px;
	-moz-transition: all 35ms linear;
	-o-transition: all 35ms linear;
	-webkit-transition: all 35ms linear;
	transition: all 35ms linear;
	-ms-transition: all 35ms linear;
	-moz-user-select: -moz-none;
	-ms-user-select: none;
	-webkit-user-select: none;
	user-select: none;
	cursor: pointer;
	margin-right: 20px;
}
.roundbtn.blue {
	border: 5px solid #51a9ff;
	background-color: #0077ea;
}
.roundbtn .inner {
	position: relative;
	width: 260px;
	height: 70px;
	background-color: #9a9a9a;
	margin-top: -8px;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	-moz-border-radius: 50%;
	-webkit-border-radius: 50%;
	border-radius: 75px;
	-moz-box-shadow: none;
	-webkit-box-shadow: none;
	box-shadow: none;
	-moz-transition: margin 35ms 35ms linear, box-shadow 35ms linear;
	-o-transition: margin 35ms 35ms linear, box-shadow 35ms linear;
	-webkit-transition: margin 35ms 35ms, box-shadow 35ms linear;
	-webkit-transition-delay: linear, 0s;
	transition: margin 35ms 35ms linear, box-shadow 35ms linear;
	-ms-transition: margin 35ms 35ms linear, box-shadow 35ms linear;
}
.roundbtn.blue .inner {
	background-color: #51a9ff;
}
.roundbtn:active .inner {
	margin-top: 0;
	-moz-box-shadow: #6c6161 0 8px 0 inset;
	-webkit-box-shadow: #6c6161 0 8px 0 inset;
	box-shadow: #6c6161 0 8px 0 inset;
	-moz-transition: margin 35ms linear, box-shadow 17.5ms 17.5ms linear;
	-o-transition: margin 35ms linear, box-shadow 17.5ms 17.5ms linear;
	-webkit-transition: margin 35ms linear, box-shadow 17.5ms 17.5ms;
	-webkit-transition-delay: 0s, linear;
	transition: margin 35ms linear, box-shadow 17.5ms 17.5ms linear;
	-ms-transition: margin 35ms linear, box-shadow 17.5ms 17.5ms linear;
}
.roundbtn:active.blue .inner {
	-moz-box-shadow: #0077ea 0 8px 0 inset;
	-webkit-box-shadow: #0077ea 0 8px 0 inset;
	box-shadow: #0077ea 0 8px 0 inset;
}
.text {
	position: absolute;
	top: 32px;
	left: 0;
	right: 0;
	color: white;
	font-weight: 300;
	letter-spacing: 1px;
	font: 22px/0.5 'Oswald', sans-serif;
	text-align: center;
	text-transform: uppercase;
	transform: skewX(10deg);
}
.advice {
	position: absolute;
	top: 105%;
	width: 100%;
	font-family: Pacifico, sans-serif;
	font-size: 36px;
	padding: 10px;
	transition: opacity .25s ease-in-out;
	opacity: 0;
	transform: translateX(-50%);
	left: 50%;
}
/* ------Owly Styles-------- */
.owl {
	animation: floaty 1.75s infinite;
}
svg {
	height: 20vh;
}
#owly {
	position: relative;
	display: none;
}
.shadow {
	fill: rgba(42, 24, 66, 0.82);
	animation: shadow 1.75s infinite;
	transform-origin: 50% 50%;
}
.Eye1, .Eye2 {
	animation: blink 5s infinite;
	transform-origin: 0px;
}
.Wing_Left {
	animation: shake-left-wing 500ms infinite;
	transform-origin: 37% 0%;
}
.Wing_Right {
	animation: shake-right-wing 500ms infinite;
	transform-origin: 57% 0%;
}
.Left_Leg {
	animation: shake-left-leg 1.5s infinite;
	transform-origin: 66% 0%;
}
.Right_Leg {
	animation: shake-right-leg 2s infinite;
	transform-origin: 32% 2%;
}
.st0 {
	display: none;
}
.st1 {
	fill: #FE931D;
	stroke: #E4764F;
	stroke-miterlimit: 10;
}
.st4 {
	fill: #D4B2EE;
}
.st5 {
	fill: #BD95DC;
}
.st6 {
	display: none;
	fill: #BD95DC;
}
.st7 {
	fill: #FFFFFF;
}
.st8 {
	stroke: #000000;
	stroke-miterlimit: 10;
}
.st9 {
	fill: #FFFFFF;
	stroke: #000000;
	stroke-miterlimit: 10;
}
.st10 {
	fill: #482D2C;
}
@keyframes blink {
	40% {
		transform: scaleY(1);
	}
	45% {
		transform: scaleY(0.1);
	}
	50% {
		transform: scaleY(1);
	}
}
@keyframes shake-left-wing {
	0% {
		transform: rotate(0deg);
	}
	50% {
		transform: rotate(130deg);
	}
	100% {
		transform: rotate(0deg);
	}
}
@keyframes shake-right-wing {
	0% {
		transform: rotate(0deg);
	}
	50% {
		transform: rotate(-130deg);
	}
	100% {
		transform: rotate(0deg);
	}
}
@keyframes shake-left-leg {
	0% {
		transform: rotate(0deg);
	}
	50% {
		transform: rotate(30deg);
	}
	100% {
		transform: rotate(0deg);
	}
}
@keyframes shake-right-leg {
	0% {
		transform: rotate(0deg);
	}
	50% {
		transform: rotate(-30deg);
	}
	100% {
		transform: rotate(0deg);
	}
}
@keyframes floaty {
	0% {
		transform: translateY(25px);
	}
	50% {
		transform: translateY(0px);
	}
	100% {
		transform: translateY(25px);
	}
}
@keyframes shadow {
	0% {
		transform: scale(0.9);
	}
	50% {
		transform: scale(1);
	}
	100% {
		transform: scale(0.9);
	}
}
@keyframes pop {
	0% {
		height: 0vh;
	}
	100% {
		height: 20vh;
	}
}
@keyframes movingBg {
	to {
		background-position: 100% 100%
	}
}

            
          
!
            
              $("document").ready(function() {
    generateSomeOwls(10, 100);

    var renderBtn = document.getElementById("generate");
    var clearBtn = document.getElementById("clear");
    var cloneCount = 1;

    renderBtn.addEventListener("click", function() {
        generateSomeOwls(1, 200);
    });
    clearBtn.addEventListener("click", clearOwls);

    function generateRandomHexCode() {
        var hexCode = '#';
        var hexSym = ["A", "B", "C", "D", "E", "F", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
        for (var i = 0; i < 6; i++) {
            var randSym = hexSym[Math.floor(hexSym.length * Math.random())];
            hexCode += randSym;
        }
        return hexCode;
    }

    function generateSomeOwls(number, timeout) {
        var count = 0;
        var int = setInterval(function() {
            go();
            if (count > number) clearInterval(int);
            count++;
        }, timeout);
    }

    function go() {
        var svg = document.getElementById("owly");
        var clone = svg.cloneNode(true);
        clone.setAttribute('id', 'owl' + cloneCount++);
        var elements = clone.querySelectorAll('.st-body,.st-belly,.wing');
        for (var i = 0; i < elements.length; i++) {
            elements[i].setAttribute("fill", generateRandomHexCode());
        }
        var wrapper = document.getElementById('wrap');
        wrapper.appendChild(clone);
        toggleAdvice();
    }

    function clearOwls() {
        var allowls = document.querySelectorAll("svg:not(#owly)");
        Array.prototype.forEach.call(allowls, function(node) {
            node.parentNode.removeChild(node);
        });
        toggleAdvice();
    }

    function toggleAdvice() {
        var container = document.querySelector("#wrap");
        var adv = document.querySelector(".advice");
        var children = container.childElementCount;
        if (children > 1) {
            adv.style.opacity = 0;
        } else {
            adv.style.opacity = 1;
        }
    }
});

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console