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,437 |
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 |
The Importance of Proper Navigational CSS | 3,165 Kb |
Stupid RTL Demo | 3,075 Kb |
Zoomy Anchor Thing | 2,680 Kb |
Globule Bleu Jobs Page Anchor Rollover Effect | 2,533 Kb |
Infinite Square | 2,937 Kb |
Slip-n-slide Modal | 3,316 Kb |
Student Charter Demo for City University | 5,837 Kb |
Simple CSS Checkbox | 3,244 Kb |
Message Types | 2,987 Kb |
The power of transform for centering - INTERACTIVE | 2,439 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 |
A Pen by Michael Parenteau | Michaelparenteau | 2,133 Kb |
Magnus 3 | ARocketfish | 7,944 Kb |
Slider | Mohammed-fawzy | 2,634 Kb |
Degree Picker | Idered | 4,307 Kb |
Toggle Time | Petebot | 5,345 Kb |
Boxes | H3l1um | 2,563 Kb |
Draggable directive | YahyaKacem | 2,277 Kb |
Placeholder support for contentEditable elements, without JavaScript | Flesler | 1,863 Kb |
Project_one | MOHIM | 9,592 Kb |
CSS Social Media Icon | TychoBlender | 3,871 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!