Smiley guy

Developer
Size
3,845 Kb
Views
18,216

How do I make an smiley guy?

Still working on getting the JS right. Thanks for all the views, hearts and comments! Inspired by a gif by Bilal Mechairia at http://www.sharpandnimble.com/design-lab/. We're buds now.. What is a smiley guy? How do you make a smiley guy? This script and codes were developed by Eli Fitch on 28 October 2022, Friday.

Smiley guy Previews

Smiley guy - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Smiley guy</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!--Still working on getting the JS right. Thanks for all the views, hearts and comments!-->
<div class="container"> <div class="eyebox"><div class="eye EL"><div class="pupil"></div></div> <div class="eye ER"><div class="pupil"></div></div> </div>
<div class="smile"> <div class="teeth"></div> <div class="tongue"></div>
</div>
</div>
<!--<div class="readout"></div>--> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Smiley guy - Script Codes CSS Codes

* { box-sizing: border-box;
}
.container { width: 80%; min-height: 400px; border-radius: 10px; background-color: #ee3a4c; overflow: auto; display: block; margin: 0; max-width: 700px;
}
.container:hover .smile { transition: all .4s; height: 33.33333px; width: 33.33333px; border-radius: 100%; margin-top: 50px;
}
.container:hover .teeth { margin-left: -25px; margin-top: -40px; transition: all .4s;
}
.container:hover .tongue { transition: all .4s; margin-left: -50px; /*margin-top: $tongueDimensions*2;*/
}
.eyebox { width: 400px; display: block; margin: 0 auto; text-align: center; margin-top: 66.66667px; margin-bottom: 25px;
}
.eye { height: 100px; width: 100px; background-color: #ee3a4c; border: 4px solid white; border-radius: 100%; display: inline-block; margin: 0 20px; position: relative; padding: 20px; overflow: hidden;
}
.eye .pupil { height: 25px; width: 25px; border-radius: 100%; display: inline-block; background-color: white; position: absolute; transform: translateX(-50%); left: 0%;
}
.smile { height: 100px; width: 200px; border-radius: 0 0 200px 200px; background: #770f1a; margin: 0 auto; overflow: hidden; transition: all .4s; transform-origin: center;
}
.smile .teeth { background-color: #fff; transition: all .4s; height: 33.33333px; width: 33.33333px; margin-left: 56.66667px; position: relative;
}
.smile .teeth:after { content: ""; background-color: #fff; height: 33.33333px; width: 33.33333px; position: absolute; left: 50px; top: 0; z-index: 10000;
}
.smile .tongue { transition: all .4s; height: 100px; width: 100px; background-color: pink; border-radius: 100%; margin-top: 40px; margin-left: 15px; display: inline-block; position: relative;
}
.smile .tongue:after { content: ''; height: 100px; width: 100px; background-color: pink; border-radius: 100%; display: inline-block; position: absolute; left: 50px; /*margin-top: 0; margin-left: -($tongueDimensions/3);*/
}

Smiley guy - Script Codes JS Codes

//Still working on getting the JS right. Thanks for all the views, hearts and comments!
var limitX = 100, limitY = 100;
var containerW = $('.container').width() - $('.container').offset().left;
var containerH = $('.container').height() - $('.container').offset().top;
$( ".container" ).mousemove(function( e ) { //var pageCoords = "( " + event.pageX + ", " + event.pageY + " )"; //var clientCoords = "( " + event.clientX + ", " + event.clientY + " )"; var mouseY = Math.min(e.clientY/(containerH*.01), limitY); var mouseX = Math.min(e.clientX/(containerW*.01), limitX); if(e.clientY<260 && e.clientY>20) { $('.pupil').css('top', mouseY+'%'); } if(e.clientX<520) { $('.pupil').css('left', mouseX+'%'); } //$('.readout').html(e.clientX+' '+e.clientY+'\n'+mouseX+" "+mouseY); //$('.readout').html($('.pupil').css('top')+' '+$('.pupil').css('left'));
});
var pupilH = $('.pupil').height();
/*function blink() { //$('.pupil').css('height', '10px').delay( 500 ).css('height', pupilH+'px'); $('.pupil').css('height', '5px') setTimeout(function(){ $('.pupil').css('height', pupilH + 'px') }, 100) //console.log( 'blink' );
};
(function blinkLoop() { var rand = Math.round(Math.random() * (5000 - 500)) + 500; setTimeout(function() { blink(); blinkLoop(); }, rand);
}());*/
Smiley guy - Script Codes
Smiley guy - Script Codes
Home Page Home
Developer Eli Fitch
Username elifitch
Uploaded October 28, 2022
Rating 4.5
Size 3,845 Kb
Views 18,216
Do you need developer help for Smiley guy?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Eli Fitch (elifitch) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!