Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch bulb animation #5172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Animations-CSS/switch bulb/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Switch bulb animation

This is an animation of a switch bulb toggling using CSS.
13 changes: 13 additions & 0 deletions Animations-CSS/switch bulb/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Switch bulb animation</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="bulb"></div>
</body>
</html>
35 changes: 35 additions & 0 deletions Animations-CSS/switch bulb/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}

body {
display: flex;
justify-content: center;
align-items: center;
background-color: black;
min-height: 100vh;
}

.bulb {
position: relative;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: rgb(56, 55, 55);
}

.bulb::before {
content: "";
position: absolute;
width: 2px;
height: 200px;
left: calc(50% - 1px);
bottom: 100px;
background-color: darkgray;
}

.bulb:active {
background: radial-gradient(aliceblue, gray);
}