Square Illusion
How do I make an square illusion?
As in http://cdn.diply.com/img/6b0d3e41-cffa-4bec-a1b0-bbba6294db96.jpg. What is a square illusion? How do you make a square illusion? This script and codes were developed by Chris Burnell on 16 September 2022, Friday.
Square Illusion - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Square Illusion</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- Hover inside the lines to reveal the illusion! -->
<div class="container"> <div class="square square-1"></div> <div class="square square-2"></div> <div class="circle circle-1"></div> <div class="circle circle-2"></div> <div class="circle circle-3"></div> <div class="circle circle-4"></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>
Square Illusion - Script Codes CSS Codes
html { box-sizing: border-box;
}
*,
*:before,
*:after { box-sizing: inherit;
}
html,
body { height: 100%;
}
body { background-color: black; position: relative; overflow: hidden;
}
.container { width: 30%; width: 25vw; height: 30%; height: 25vw; position: absolute; top: 50%; left: 50%; -webkit-transform: translate3d(-50%, -50%, 0); transform: translate3d(-50%, -50%, 0); cursor: help;
}
.square { width: 70%; height: 100%; position: absolute; top: 0; left: 50%; -webkit-transform: translateX(-50%); transform: translateX(-50%); border-top: 10px solid mediumseagreen; border-top: 1.5vw solid mediumseagreen; border-bottom: 10px solid mediumseagreen; border-bottom: 1.5vw solid mediumseagreen; -webkit-animation-duration: 1s; animation-duration: 1s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-timing-function: linear; animation-timing-function: linear;
}
.square-1 { -webkit-transform: translateX(-50%) rotate(45deg); transform: translateX(-50%) rotate(45deg); -webkit-animation-name: square-1; animation-name: square-1;
}
.square-2 { -webkit-transform: translateX(-50%) rotate(-45deg); transform: translateX(-50%) rotate(-45deg); -webkit-animation-name: square-2; animation-name: square-2;
}
@-webkit-keyframes square-1 { 0%, 100% { -webkit-transform: translateX(-60%) translateY(7%) rotate(45deg); transform: translateX(-60%) translateY(7%) rotate(45deg); } 50% { -webkit-transform: translateX(-40%) translateY(-7%) rotate(45deg); transform: translateX(-40%) translateY(-7%) rotate(45deg); } 25%, 75% { -webkit-transform: translateX(-50%) translateY(0) rotate(45deg); transform: translateX(-50%) translateY(0) rotate(45deg); }
}
@keyframes square-1 { 0%, 100% { -webkit-transform: translateX(-60%) translateY(7%) rotate(45deg); transform: translateX(-60%) translateY(7%) rotate(45deg); } 50% { -webkit-transform: translateX(-40%) translateY(-7%) rotate(45deg); transform: translateX(-40%) translateY(-7%) rotate(45deg); } 25%, 75% { -webkit-transform: translateX(-50%) translateY(0) rotate(45deg); transform: translateX(-50%) translateY(0) rotate(45deg); }
}
@-webkit-keyframes square-2 { 0%, 50%, 100% { -webkit-transform: translateX(-50%) translateY(0) rotate(-45deg); transform: translateX(-50%) translateY(0) rotate(-45deg); } 25% { -webkit-transform: translateX(-40%) translateY(7%) rotate(-45deg); transform: translateX(-40%) translateY(7%) rotate(-45deg); } 75% { -webkit-transform: translateX(-60%) translateY(-7%) rotate(-45deg); transform: translateX(-60%) translateY(-7%) rotate(-45deg); }
}
@keyframes square-2 { 0%, 50%, 100% { -webkit-transform: translateX(-50%) translateY(0) rotate(-45deg); transform: translateX(-50%) translateY(0) rotate(-45deg); } 25% { -webkit-transform: translateX(-40%) translateY(7%) rotate(-45deg); transform: translateX(-40%) translateY(7%) rotate(-45deg); } 75% { -webkit-transform: translateX(-60%) translateY(-7%) rotate(-45deg); transform: translateX(-60%) translateY(-7%) rotate(-45deg); }
}
.circle { background-color: coral; opacity: 0; width: 30%; width: 9vw; height: 30%; height: 9vw; text-align: center; font-size: 5vw; line-height: 9vw; position: absolute; overflow: hidden; text-indent: 100%; border-radius: 50%; -webkit-transition: opacity .2s; transition: opacity .2s; -webkit-animation-duration: 4s; animation-duration: 4s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-timing-function: linear; animation-timing-function: linear;
}
.container:hover .circle, .container:focus .circle { opacity: 1;
}
.circle:hover, .circle:focus { text-indent: 0;
}
.circle-1 { top: 0; left: 50%; -webkit-transform: translateX(-50%) translateY(-100%); transform: translateX(-50%) translateY(-100%);
}
.circle-2 { bottom: 0; left: 50%; -webkit-transform: translateX(-50%) translateY(100%); transform: translateX(-50%) translateY(100%);
}
.circle-3 { top: 50%; left: 0; -webkit-transform: translateX(-100%) translateY(-50%); transform: translateX(-100%) translateY(-50%);
}
.circle-4 { top: 50%; right: 0; -webkit-transform: translateX(100%) translateY(-50%); transform: translateX(100%) translateY(-50%);
}
.container:before,
.container:after { color: white; font-size: 3vw; white-space: nowrap; position: absolute; top: 50%; left: 50%; -webkit-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); -webkit-transition: opacity .5s; transition: opacity .5s;
}
.container:before { opacity: .8; content: "Hover me!";
}
.container:hover:before { opacity: 0;
}
.container:after { content: "Whoa..."; opacity: 0;
}
.container:hover:after { opacity: .5;
}
Developer | Chris Burnell |
Username | chrisburnell |
Uploaded | September 16, 2022 |
Rating | 3.5 |
Size | 3,295 Kb |
Views | 38,456 |
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 |
Modal Container without JS | 3,272 Kb |
Clock Face Idea | 3,196 Kb |
Student Charter Demo for City University | 5,837 Kb |
Square Illusion | 3,295 Kb |
Stupid RTL Demo | 3,075 Kb |
Simple CSS Checkbox | 2,797 Kb |
Flyknife Comics | 2,934 Kb |
The power of transform for centering - INTERACTIVE | 2,439 Kb |
New Brandings | 5,617 Kb |
Cutaway Indicator | 2,435 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 |
Ghost Buttons with CSS3 | Mithicher | 2,509 Kb |
Progressively reveal dots on a Bezier curve | GreenSock | 2,489 Kb |
DFF Website | Hawcubite | 10,123 Kb |
CSS Link Zoom On Click | Bryce | 1,960 Kb |
Using Flickr API | MoyArt | 6,761 Kb |
Portfolio Layout Flex | Lahvjal | 3,489 Kb |
Boom | Mhrjnsa1 | 1,794 Kb |
Dice | Fraina | 5,026 Kb |
Sitemap generator for Sharepoint | Gyusza | 2,518 Kb |
Image Hover | Johnheiner | 3,409 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!