Iris
How do I make an iris?
Meet Iris... she doesn't talk much and her other eye was poked out in an unfortunate Touch Event accident... Her mom and dad are Greensock and SVG.. What is a iris? How do you make a iris? This script and codes were developed by Elliot Geno on 11 September 2022, Sunday.
Iris - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Iris</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <svg version="1.1" id="eye" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve"> <g id="iris"> <defs> <path id="eyeMaskReference" d="M45.9,100c15.2,42.7,93,42.7,108.2,0C138.9,57.3,61.1,57.3,45.9,100z"/> </defs> <clipPath id="eyeMask"> <use xlink:href="#eyeMaskReference" overflow="visible"/> </clipPath> <path id="whites" clip-path="url(#eyeMask)" fill="#dddddd" d="M45.9,100c15.2,42.7,93,42.7,108.2,0C138.9,57.3,61.1,57.3,45.9,100z"/> <circle id="pupil" clip-path="url(#eyeMask)" fill="#222222" cx="100" cy="100" r="18.7"/> </g> <path id="outline" fill="none" stroke="#222222" stroke-width="10" stroke-miterlimit="2" d="M45.9,100c15.2,42.7,93,42.7,108.2,0C138.9,57.3,61.1,57.3,45.9,100z"/> <path id="eyeLash" fill="none" stroke="#222222" stroke-width="10" stroke-miterlimit="10" d="M100,55.5v-31 M83.9,56.5l-6.4-28.6M66.8,61.3l-9.7-23.2 M38.9,51.2L52,71.1 M24.7,68.5L40.2,82 M122.5,27.9l-6.4,28.6 M142.9,38.1l-9.7,23.2 M161.1,51.2L148,71.1M159.8,82l15.5-13.5"/>
</svg> <script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.14.2/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Iris - Script Codes CSS Codes
body{ background-color:#444444; margin: 0px; overflow: hidden;
}
Iris - Script Codes JS Codes
var outline,eyeMask;
var outlinePath={valueY:57.3};
var pathString;
outline= document.getElementById("outline");
eyeMask= document.getElementById("eyeMaskReference");
var pathString=outline.getAttribute("d");
outlinePath.prefix=pathString.substring(0,pathString.indexOf("57.3,61.1,57.3"));
outlinePath.suffix=pathString.substring(pathString.indexOf("57.3,61.1,57.3")+14,pathString.length);
animatePupil();
animateBlink();
function animatePupil(){ var x=((Math.random()*50)-25)+100; var y=((Math.random()*50)-25)+100; TweenMax.to("#pupil",.3,{delay:(Math.random()*3)+.1,attr:{cx:x,cy:y},ease:Quint.easeInOut,onComplete:animatePupil})
}
function animateBlink(){ var delay=(Math.random()*3)+1; TweenMax.to(outlinePath,.2,{delay:delay,valueY:140,ease:Quint.easeInOut,onUpdate:updatePath}); TweenMax.to(outlinePath,.2,{delay:delay+.2,valueY:57.3,ease:Quint.easeOut,onUpdate:updatePath,onComplete:animateBlink}); TweenMax.to("#eyeLash",.2,{delay:delay,scaleY:-1,transformOrigin:"50% 130%",ease:Quint.easeInOut}); TweenMax.to("#eyeLash",.2,{delay:delay+.2,scaleY:1,transformOrigin:"50% 130%",ease:Quint.easeOut});
}
function updatePath(object,path){ var string=outlinePath.prefix+outlinePath.valueY+",61.1,"+outlinePath.valueY+outlinePath.suffix; outline.setAttribute("d",string); eyeMask.setAttribute("d",string);
}
Developer | Elliot Geno |
Username | pyrografix |
Uploaded | September 11, 2022 |
Rating | 3.5 |
Size | 2,587 Kb |
Views | 36,432 |
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!
Name | Size |
Cat Silhouette | 4,447 Kb |
Prism | 2,843 Kb |
Alternate Tween Properties - TweenMax | 2,215 Kb |
Clock | 1,978 Kb |
Dot Hopper - Pagination | 2,579 Kb |
Coaster SVG | 2,133 Kb |
Purple Nurple | 5,008 Kb |
Swarm | 2,384 Kb |
Bullseye Game | 5,406 Kb |
A Pen by Elliot Geno | 2,114 Kb |
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!
Name | Username | Size |
CSS Patterns | Alyda | 3,953 Kb |
Sass Get Function | Lukewatts | 2,155 Kb |
Polo, the flying squirrel | Agbales | 2,445 Kb |
Svg sky | Omodev | 7,070 Kb |
Search Box in Content Moves to Fixed Header | Chriscoyier | 2,768 Kb |
Animated Slide Hamburger Mobile Menu | BJack | 2,247 Kb |
A Pen by Gregory Potdevin | GregoryPotdevin | 1,713 Kb |
CSS Tooltips | Darylldoyle | 2,599 Kb |
IPhone5S SVG Space Grey | Onlinechris | 75,035 Kb |
Transitioning application screens with semantically named classes | Djgrant | 3,697 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!