├── animated-hamburger-icon
├── app.js
├── index.html
└── style.css
├── modern-sliding-push-menu
├── app.js
├── index.html
└── styles.css
├── expanding-search-bar
├── index.html
└── style.css
├── ripple-button
├── index.html
├── app.js
└── styles.css
├── like-dislike-button
├── app.js
├── index.html
└── styles.css
├── custom-cursor
├── app.js
├── index.html
└── style.css
├── plane-send-button
├── index.html
├── app.js
└── styles.css
├── radio-input-animation
├── index.html
└── style.css
└── README.md
/animated-hamburger-icon/app.js:
--------------------------------------------------------------------------------
1 | // On Click Toggles Class
2 | document.querySelector('.wrapper').addEventListener('click', (e) => {
3 | e.currentTarget.classList.toggle('is-active');
4 | });
--------------------------------------------------------------------------------
/modern-sliding-push-menu/app.js:
--------------------------------------------------------------------------------
1 | const button = document.getElementById("button");
2 | const sidebar = document.querySelector(".sidebar");
3 | const main = document.querySelector(".main");
4 | const menu = document.querySelector(".menu");
5 |
6 | menu.addEventListener("click", (e) => {
7 | sidebar.classList.toggle("sidebar--active");
8 | main.classList.toggle("main--sidebar-active");
9 | e.currentTarget.classList.toggle("menu--active");
10 | });
11 |
--------------------------------------------------------------------------------
/animated-hamburger-icon/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Animated Hamburger Icon
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/expanding-search-bar/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Expanding Search Bar
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/ripple-button/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Ripple button
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/like-dislike-button/app.js:
--------------------------------------------------------------------------------
1 | const buttonLike = document.querySelector(".button--like");
2 | const buttonLikeText = document.querySelector(".button__text-like");
3 |
4 | const buttonDislike = document.querySelector(".button--dislike");
5 | const buttonDislikeText = document.querySelector(".button__text-dislike");
6 |
7 | buttonLike.addEventListener("click", () => setActive(buttonLike, "liked", buttonLikeText, "Like"));
8 | buttonDislike.addEventListener("click", () => setActive(buttonDislike, "disliked", buttonDislikeText, "Dislike"));
9 |
10 | function setActive(button, activeClass, buttonText, text) {
11 | button.classList.toggle(activeClass);
12 | checkText(buttonText, text);
13 | }
14 |
15 | function checkText(buttonText, text) {
16 | if (buttonText.innerHTML === text) {
17 | buttonText.innerHTML = text + "d";
18 | } else {
19 | buttonText.innerHTML = text;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ripple-button/app.js:
--------------------------------------------------------------------------------
1 | const button = document.getElementById("button");
2 | button.addEventListener("click", playAnimation);
3 |
4 | function playAnimation(event) {
5 | const rect = event.target.getBoundingClientRect();
6 | const clientX = event.clientX;
7 | const clientY = event.clientY;
8 |
9 | const clientXInButton = clientX - rect.x;
10 | const clientYInButton = clientY - rect.y;
11 |
12 | const rippleDomElement = document.createElement("span");
13 | rippleDomElement.className = "ripple";
14 |
15 | rippleDomElement.style.top = clientYInButton + "px";
16 | rippleDomElement.style.left = clientXInButton + "px";
17 |
18 | const removeFunction = () => {
19 | button.removeChild(rippleDomElement);
20 | };
21 |
22 | rippleDomElement.addEventListener("webkitAnimationEnd", removeFunction);
23 | rippleDomElement.addEventListener("animationend", removeFunction);
24 |
25 | button.appendChild(rippleDomElement);
26 | }
27 |
--------------------------------------------------------------------------------
/custom-cursor/app.js:
--------------------------------------------------------------------------------
1 | const link = document.querySelectorAll('nav > .hover-this');
2 | const cursor = document.querySelector('.cursor');
3 |
4 | const animateit = function (e) {
5 | const span = this.querySelector('span');
6 | const { offsetX: x, offsetY: y } = e,
7 | { offsetWidth: width, offsetHeight: height } = this,
8 |
9 | move = 25,
10 | xMove = x / width * (move * 2) - move,
11 | yMove = y / height * (move * 2) - move;
12 |
13 | span.style.transform = `translate(${xMove}px, ${yMove}px)`;
14 |
15 | if (e.type === 'mouseleave') span.style.transform = '';
16 | };
17 |
18 | const editCursor = e => {
19 | const { clientX: x, clientY: y } = e;
20 | cursor.style.left = x + 'px';
21 | cursor.style.top = y + 'px';
22 | };
23 |
24 | link.forEach(b => b.addEventListener('mousemove', animateit));
25 | link.forEach(b => b.addEventListener('mouseleave', animateit));
26 | window.addEventListener('mousemove', editCursor);
--------------------------------------------------------------------------------
/custom-cursor/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Mouse Cursor Animation
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/plane-send-button/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Plane send button
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/custom-cursor/style.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | margin: 0;
3 | padding: 0;
4 | cursor: none;
5 | }
6 |
7 | .nav-wrapper {
8 | width: 100%;
9 | height: 100vh;
10 | background: #161616;
11 | }
12 |
13 | nav {
14 | width: 100%;
15 | margin: 0 auto;
16 | display: flex;
17 | justify-content: space-around;
18 | text-align: center;
19 | position: absolute;
20 | top: 50%;
21 | }
22 |
23 | .hover-this {
24 | transition: all 0.3s ease;
25 | }
26 |
27 | span {
28 | display: inline-block;
29 | font-family: 'Russo One', sans-serif;
30 | font-weight: 400;
31 | color: #fff;
32 | font-size: 36px;
33 | text-transform: uppercase;
34 | pointer-events: none;
35 | transition: transform 0.1s linear;
36 | }
37 |
38 | .cursor {
39 | pointer-events: none;
40 | position: fixed;
41 | padding: 0.3rem;
42 | background-color: #fff;
43 | border-radius: 50%;
44 | mix-blend-mode: difference;
45 | transition: transform 0.3s ease;
46 | }
47 |
48 | .hover-this:hover ~ .cursor {
49 | transform:translate(-50%, -50%) scale(8);
50 | }
--------------------------------------------------------------------------------
/like-dislike-button/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Like button microinteraction
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/radio-input-animation/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Animated Radio Button
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Microinteractions (HTML)
2 | A micro-interactions repo open for anyone to use in their projects. Built with pure HTML, CSS, and JS.
3 |
4 | ## Preview of MI's in this repo
5 | ### Plane send button
6 | https://user-images.githubusercontent.com/32551220/157372645-fa1f8a06-a3b7-46be-83af-6b509b0284cb.mov
7 |
8 | ### Animated Hamburger icon
9 | https://user-images.githubusercontent.com/32551220/158219644-8bc3c6c0-7445-4300-bcac-805fdbf664ac.mov
10 |
11 | ### Ripple button
12 | https://user-images.githubusercontent.com/32551220/158879127-45e17c9d-6166-45dc-a996-ab511487d988.mov
13 |
14 | ### Radio input
15 | https://user-images.githubusercontent.com/32551220/159953726-7d42f612-961f-4112-9644-fda85e17c8a9.mov
16 |
17 | ### Like dislike button
18 | https://user-images.githubusercontent.com/32551220/160289777-a51ffbf1-5039-4bdc-a508-d7fc853aca67.mov
19 |
20 | ### Custom cursor
21 | https://user-images.githubusercontent.com/32551220/161388700-b3e0d2a7-6f11-479b-a29b-f24214ce7fef.mov
22 |
23 | ### Modern sliding push menu
24 | https://user-images.githubusercontent.com/32551220/162974291-0d3887a8-54bf-4b7c-b398-ec19221f31c8.mov
25 |
26 | ## Contributors
27 | [@mujs.dev](https://www.instagram.com/mujs.dev/)
28 |
29 | [@frontendcharm](https://www.instagram.com/frontendcharm/)
30 |
--------------------------------------------------------------------------------
/expanding-search-bar/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0;
3 | box-sizing: border-box;
4 | }
5 |
6 | body {
7 | background: #101010;
8 | }
9 |
10 | .search-box {
11 | position: absolute;
12 | top: 50%;
13 | left: 50%;
14 | transform: translate(-50%, -50%);
15 | height: 60px;
16 | background: #353535;
17 | line-height: 40px;
18 | padding: 10px;
19 | border-radius: 60px;
20 | cursor: pointer;
21 | }
22 |
23 | .search-input {
24 | background: #353535;
25 | color: #fff;
26 | outline: none;
27 | border: none;
28 | line-height: 40px;
29 | width: 0px;
30 | float: left;
31 | font-size: 1em;
32 | transition: 0.7s ease;
33 | }
34 |
35 | .search-btn {
36 | display: flex;
37 | justify-content: center;
38 | align-items: center;
39 | text-decoration: none;
40 | background: #353535;
41 | padding: 12px;
42 | border-radius: 50%;
43 | float: right;
44 | color: #22ffc0;
45 | transition: 0.4s ease;
46 | }
47 |
48 | .search-box:hover > .search-input,
49 | .search-input:focus {
50 | width: 240px;
51 | margin: 0px 8px;
52 | }
53 |
54 | .search-box:hover > .search-btn,
55 | .search-input:focus + .search-btn {
56 | background: #22ffc0;
57 | color: #101010;
58 | }
59 |
--------------------------------------------------------------------------------
/animated-hamburger-icon/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | }
4 |
5 | html,
6 | body {
7 | margin: 0;
8 | padding: 0;
9 | height: 100%;
10 | }
11 |
12 | body {
13 | background-color: #000;
14 | display: flex;
15 | justify-content: center;
16 | align-items: center;
17 | }
18 |
19 | .wrapper {
20 | width: 50px;
21 | height: 50px;
22 | display: flex;
23 | flex-direction: column;
24 | justify-content: space-between;
25 | cursor: pointer;
26 | transition: transform 330ms ease-out;
27 | }
28 |
29 | .line-menu {
30 | background-color: #fff;
31 | border-radius: 5px;
32 | width: 100%;
33 | height: 6px;
34 | }
35 |
36 | .line-menu.half {
37 | width: 50%;
38 | }
39 |
40 | .line-menu.start {
41 | transition: transform 330ms cubic-bezier(0.54, -0.81, 0.57, 0.57);
42 | transform-origin: right;
43 | }
44 |
45 | .line-menu.end {
46 | align-self: flex-end;
47 | transition: transform 330ms cubic-bezier(0.54, -0.81, 0.57, 0.57);
48 | transform-origin: left;
49 | }
50 |
51 |
52 | /* Click Animation */
53 | .wrapper.is-active {
54 | transform: rotate(-45deg);
55 | }
56 |
57 | .is-active .line-menu.start {
58 | transform: rotate(-90deg) translateX(3px);
59 | }
60 |
61 | .is-active .line-menu.end {
62 | transform: rotate(-90deg) translateX(-3px);
63 | }
--------------------------------------------------------------------------------
/plane-send-button/app.js:
--------------------------------------------------------------------------------
1 | const button = document.getElementById("button");
2 | const buttonText = document.getElementById("button-text");
3 | const buttonIcon = document.getElementById("button-icon");
4 |
5 | button.addEventListener("click", playAnimation);
6 |
7 | function playAnimation() {
8 | buttonText.style.animation = "buttonSendTextAnimation ease-in-out 3s";
9 | buttonIcon.style.animation = "buttonIconAnimation ease-in 3s";
10 | button.disabled = true;
11 |
12 | setTimeout(() => {
13 | buttonText.innerHTML = "Sending...";
14 | }, 250);
15 |
16 | setTimeout(() => {
17 | buttonText.innerHTML = null;
18 | buttonIcon.innerHTML = "check";
19 | buttonIcon.style.fontWeight = "bold";
20 | }, 1500);
21 |
22 | setTimeout(() => {
23 | button.style.backgroundColor = "#7240DE";
24 | button.style.color = "#f8f8f8";
25 | button.style.boxShadow = "0 1rem 2.5rem -1rem rgba(114, 64, 222, .5)";
26 | }, 1800);
27 |
28 | setTimeout(() => {
29 | buttonText.style.animation = "none";
30 | buttonIcon.style.animation = "none";
31 | button.disabled = false;
32 | buttonText.innerHTML = "Send message";
33 | buttonIcon.innerHTML = "send";
34 | button.style.backgroundColor = "#27272b";
35 | button.style.color = "#f8f8f8";
36 | button.style.boxShadow = "0 1rem 2.5rem -1rem rgba(0, 0, 0, 0.25)";
37 | }, 5 * 1000);
38 | }
39 |
--------------------------------------------------------------------------------
/modern-sliding-push-menu/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Modern Sliding Push Menu
8 |
9 |
10 |
11 |
12 |
13 |
14 |
30 |
31 |
32 |
33 |
34 |
35 |
I am the main content
36 |
I'm kinda squished
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/ripple-button/styles.css:
--------------------------------------------------------------------------------
1 | *,
2 | *::after,
3 | *::before {
4 | padding: 0;
5 | margin: 0;
6 | }
7 |
8 | html {
9 | /* sets the base font size to 10px for rems to be easily calculated */
10 | /* 1rem = 10px */
11 | font-size: 62.5%;
12 | }
13 |
14 | html,
15 | body {
16 | height: 100%;
17 | }
18 |
19 | .container {
20 | height: 100vh;
21 | background-color: #27272b;
22 |
23 | display: flex;
24 | align-items: center;
25 | justify-content: center;
26 | }
27 |
28 | button {
29 | position: relative;
30 |
31 | padding: 0 2rem;
32 | height: 5.6rem;
33 | width: 22rem;
34 | border: 0;
35 | border-radius: 99rem;
36 |
37 | display: flex;
38 | align-items: center;
39 | justify-content: center;
40 |
41 | color: #f8f8f8;
42 | font-family: "Poppins", sans-serif;
43 | font-size: 1.6rem;
44 | background-color: #27272b;
45 | box-shadow: 0 1rem 2.5rem -1rem rgba(0, 0, 0, 0.3);
46 | transition: all 0.3s ease-in-out;
47 |
48 | overflow: hidden;
49 | cursor: pointer;
50 | }
51 |
52 | button .ripple {
53 | display: flex;
54 | align-items: center;
55 | justify-content: center;
56 |
57 | position: absolute;
58 |
59 | width: 8rem;
60 | height: 8rem;
61 | border-radius: 50%;
62 | background-color: rgba(248, 69, 159, 0.2);
63 |
64 | opacity: 0;
65 | pointer-events: none;
66 | transform-origin: 0% 0%;
67 |
68 | animation-timing-function: infinite;
69 | animation: rippleAnimation 1.25s;
70 | }
71 |
72 | @keyframes rippleAnimation {
73 | 0% {
74 | opacity: 0;
75 | transform: scale(0.5) translate(-50%, -50%);
76 | }
77 | 50% {
78 | opacity: 1;
79 | }
80 | 100% {
81 | transform: scale(2) translate(-50%, -50%);
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/like-dislike-button/styles.css:
--------------------------------------------------------------------------------
1 | *,
2 | *::after,
3 | *::before {
4 | padding: 0;
5 | margin: 0;
6 | }
7 |
8 | html {
9 | /* sets the base font size to 10px for rems to be easily calculated */
10 | /* 1rem = 10px */
11 | font-size: 62.5%;
12 | }
13 |
14 | html,
15 | body {
16 | height: 100%;
17 | }
18 |
19 | .container {
20 | height: 100vh;
21 | background-color: #27272b;
22 |
23 | display: flex;
24 | align-items: center;
25 | justify-content: center;
26 | }
27 | .container > *:not(:last-child) {
28 | margin-right: 1.2rem;
29 | }
30 |
31 | .button {
32 | position: relative;
33 |
34 | padding: 0 2rem;
35 | height: 5.6rem;
36 | width: 12rem;
37 | border: 0;
38 | border-radius: 1.2rem;
39 |
40 | display: flex;
41 | align-items: center;
42 | justify-content: center;
43 |
44 | font-family: "Poppins", sans-serif;
45 | font-size: 1.6rem;
46 | box-shadow: 0 1rem 2.5rem -1rem rgba(0, 0, 0, 0.25);
47 | transition: all 0.3s ease-in-out;
48 |
49 | cursor: pointer;
50 | }
51 | .button--like {
52 | color: #f8f8f8;
53 | background-color: #1a1a1c;
54 | }
55 | .button--dislike {
56 | color: #f8f8f8;
57 | background-color: #35353a;
58 | }
59 | .button__thumb-up,
60 | .button__thumb-down {
61 | margin-right: 1rem;
62 | font-size: 2rem;
63 | line-height: 1.5;
64 | transition: all 0.2s ease-in-out;
65 | }
66 | .button:hover .button__thumb-up {
67 | transform: rotate(10deg);
68 | color: #727272;
69 | }
70 | .button:hover .button__thumb-down {
71 | transform: rotate(-10deg);
72 | color: #727272;
73 | }
74 | .liked {
75 | background-color: #6fc7d5;
76 | color: #27272b;
77 | animation: buttonPopAnimation 0.5s normal;
78 | }
79 | .disliked {
80 | background-color: #5b5b5b;
81 | animation: buttonPopAnimation 0.5s normal;
82 | }
83 | .button.liked:hover .button__thumb-up,
84 | .button.disliked:hover .button__thumb-down {
85 | transform: rotate(0deg);
86 | color: unset;
87 | }
88 |
89 | @keyframes buttonPopAnimation {
90 | 25% {
91 | transform: rotate(-10deg) scale(0.8);
92 | }
93 | 50% {
94 | transform: rotate(10deg) scale(1.1);
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/modern-sliding-push-menu/styles.css:
--------------------------------------------------------------------------------
1 | *,
2 | *::after,
3 | *::before {
4 | margin: 0;
5 | padding: 0;
6 | box-sizing: border-box;
7 | }
8 |
9 | html,
10 | body {
11 | height: 100%;
12 | }
13 |
14 | html {
15 | font-size: 62.5%;
16 | }
17 |
18 | body {
19 | font-family: "Poppins", system-ui, sans-serif;
20 | color: #fffcf2;
21 | }
22 |
23 | .layout {
24 | height: 100%;
25 | width: 100%;
26 | background-color: #131315;
27 | display: flex;
28 | }
29 |
30 | .sidebar {
31 | width: 8rem;
32 | height: 100%;
33 | padding-top: 4rem;
34 | background-color: #1d1d20;
35 | display: flex;
36 | flex-direction: column;
37 | align-items: center;
38 | position: absolute;
39 | left: -25%;
40 | transition: all 0.3s cubic-bezier(0.63, 0.86, 0.65, 0.82);
41 | }
42 | .sidebar--active {
43 | left: 2.4rem;
44 | transform: scale(0.95);
45 | border-radius: 1.2rem;
46 | }
47 | .sidebar__item {
48 | list-style: none;
49 | color: #fffcf2;
50 | padding: 1.2rem;
51 | border-radius: 1.2rem;
52 | }
53 | .sidebar__item + .sidebar__item {
54 | margin-top: 2.4rem;
55 | }
56 | .sidebar__item:hover {
57 | background-color: #27272b;
58 | cursor: pointer;
59 | }
60 | .sidebar__item.active {
61 | background-color: #131315;
62 | }
63 |
64 | .main {
65 | background-color: #1d1d20;
66 | height: 100%;
67 | width: 100%;
68 | display: grid;
69 | place-items: center;
70 | transition: all 0.3s cubic-bezier(0.63, 0.86, 0.65, 0.82);
71 | }
72 | .main--sidebar-active {
73 | transform: scaleX(0.95) scaleY(0.9);
74 | margin-left: 10.4rem;
75 | opacity: 0.4;
76 | border-radius: 1.8rem;
77 | }
78 | .main__content {
79 | text-align: center;
80 | }
81 | .main__content h1 {
82 | font-size: 3rem;
83 | }
84 | .main__content p {
85 | font-style: italic;
86 | font-size: 1.4rem;
87 | margin-top: 0.8rem;
88 | }
89 |
90 | .menu {
91 | color: #fffcf2;
92 | font-size: 1.6rem;
93 | position: absolute;
94 | left: 4rem;
95 | top: 4rem;
96 | transition: all 0.3s cubic-bezier(0.63, 0.86, 0.65, 0.82);
97 | }
98 | .menu--active {
99 | transform: rotate(-90deg);
100 | left: 1.2rem;
101 | top: 5rem;
102 | }
103 |
--------------------------------------------------------------------------------
/plane-send-button/styles.css:
--------------------------------------------------------------------------------
1 | *,
2 | *::after,
3 | *::before {
4 | padding: 0;
5 | margin: 0;
6 | }
7 |
8 | html {
9 | /* sets the base font size to 10px for rems to be easily calculated */
10 | /* 1rem = 10px */
11 | font-size: 62.5%;
12 | }
13 |
14 | html,
15 | body {
16 | height: 100%;
17 | }
18 |
19 | .container {
20 | height: 100vh;
21 | background-color: #fad161;
22 | /* background-color: #27272b; */
23 |
24 | display: flex;
25 | align-items: center;
26 | justify-content: center;
27 | }
28 |
29 | button {
30 | position: relative;
31 |
32 | padding: 0 2rem;
33 | height: 5.6rem;
34 | width: 24rem;
35 | border: 0;
36 | border-radius: 99rem;
37 |
38 | display: flex;
39 | align-items: center;
40 | justify-content: center;
41 |
42 | color: #f8f8f8;
43 | font-family: "Poppins", sans-serif;
44 | font-size: 1.6rem;
45 | background-color: #27272b;
46 | box-shadow: 0 1rem 2.5rem -1rem rgba(0, 0, 0, 0.25);
47 | transition: all 0.3s ease-in-out;
48 |
49 | overflow: hidden;
50 | cursor: pointer;
51 | }
52 |
53 | button[disabled] {
54 | cursor: not-allowed;
55 | }
56 |
57 | button .material-icons-round {
58 | margin-right: 1rem;
59 | font-size: 2rem;
60 | line-height: 1.5;
61 | }
62 |
63 | @keyframes buttonSendTextAnimation {
64 | 0% {
65 | opacity: 1;
66 | transform: translate(0, 0);
67 | }
68 | 10% {
69 | opacity: 1;
70 | transform: translate(-12px, 0);
71 | }
72 | 30% {
73 | opacity: 1;
74 | transform: translate(-12px, 0);
75 | }
76 | 40% {
77 | opacity: 0;
78 | transform: translate(-12px, 100%);
79 | }
80 | 48% {
81 | opacity: 0;
82 | transform: translate(-100%, 100%);
83 | }
84 | 50% {
85 | opacity: 1;
86 | transform: translate(-360px, -160px);
87 | }
88 | 51% {
89 | opacity: 1;
90 | transform: translate(0, -100%);
91 | }
92 | 70% {
93 | opacity: 1;
94 | transform: translate(0, 0);
95 | }
96 | 100% {
97 | opacity: 1;
98 | transform: translate(0, 0);
99 | }
100 | }
101 |
102 | @keyframes buttonIconAnimation {
103 | 0% {
104 | transform: translate(0, 0);
105 | }
106 | 12% {
107 | transform: translate(-100px, 0) scale(0.8, 0.8);
108 | }
109 | 35% {
110 | transform: translate(-100px, 0) scale(0.8, 0.8);
111 | }
112 | 50% {
113 | transform: translate(250px, 0) scale(1.75, 1.75);
114 | }
115 | 60% {
116 | transform: translate(250px, -80px) scale(1.75, 1.75);
117 | }
118 | 61% {
119 | transform: translate(0, -60px) scale(1, 1);
120 | }
121 | 65% {
122 | transform: translate(0, 0) scale(1, 1);
123 | }
124 | 100% {
125 | transform: translate(0, 0) scale(1, 1);
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/radio-input-animation/style.css:
--------------------------------------------------------------------------------
1 | @charset "UTF-8";
2 |
3 | .inner::after, .inner::before, input[type=radio] {
4 | position: absolute;
5 | cursor: pointer;
6 | opacity: 0;
7 | }
8 |
9 | *, *::before, *::after {
10 | margin: 0;
11 | padding: 0;
12 | box-sizing: border-box;
13 | }
14 |
15 | body {
16 | display: flex;
17 | justify-content: center;
18 | align-items: center;
19 | height: 100vh;
20 |
21 | background: #272936;
22 | font-family: "HelveticaNeue-Light", sans-serif;
23 | font-weight: 600;
24 | font-size: 1em;
25 | }
26 |
27 | .card {
28 | display: flex;
29 | align-items: center;
30 | background: #fff;
31 | text-align: center;
32 | width: 250px;
33 | height: 150px;
34 | border-radius: 5px;
35 | }
36 |
37 | .input-wrapper {
38 | display: block;
39 | margin-left: 20px;
40 | text-align: left;
41 | }
42 |
43 | input[type=radio] {
44 | display: block;
45 | }
46 |
47 | .outer {
48 | width: 30px;
49 | height: 30px;
50 | border: 3px solid #87745C;
51 | position: relative;
52 | display: inline-block;
53 | background: transparent;
54 | margin: 25px 20px 0 30px;
55 | border-radius: 50%;
56 | cursor: pointer;
57 | top: 0;
58 | }
59 |
60 | .inner {
61 | position: relative;
62 | font-family: FontAwesome;
63 | }
64 |
65 | .inner::before {
66 | content: "";
67 | top: 50%;
68 | left: 7px;
69 | color: #4B6279;
70 | transform: scale(0) translateY(-50%);
71 | }
72 |
73 | .inner::after {
74 | content: "";
75 | left: -140px;
76 | bottom: -180px;
77 | font-size: 2em;
78 | transform: scale(3);
79 | color: #4B6279;
80 | }
81 |
82 | .inner::before:hover {
83 | opacity: 1;
84 | }
85 |
86 | .input-name {
87 | position: relative;
88 | top: -27px;
89 | left: 80px;
90 | color: #87745C;
91 | }
92 |
93 | @keyframes boom {
94 | 0% {
95 | box-shadow: 0px 0px 0px 15px rgba(100, 100, 100, 0.25);
96 | }
97 |
98 | 100% {
99 | box-shadow: 0px 0px 0px 15px rgba(100, 100, 100, 0);
100 | }
101 | }
102 |
103 | /* Radio Button Animation */
104 | input[type=radio]:hover + label .inner::before {
105 | opacity: 0.2;
106 | display: inline-block;
107 | position: absolute;
108 | transform: scale(1);
109 | transition: all 0.3s ease;
110 | }
111 |
112 | input[type=radio]:checked label .inner::before {
113 | opacity: 1;
114 | transform: scale(1.5);
115 | transition: all 0.2s ease;
116 | }
117 |
118 | input[type=radio]:focus + label .inner::before {
119 | opacity: 1;
120 | transform: scale(1.5);
121 | transition: all 0.3s ease;
122 | -webkit-transition-delay: 0.75s;
123 | }
124 |
125 | input[type=radio]:focus + label .outer {
126 | transform: translate(0.09em, 0.09em);
127 | box-shadow: 0px 0px 0px 0px rgba(200, 200, 200, 0.1);
128 | border: 3px solid #4B6279;
129 | -webkit-transition-delay: 0.75s;
130 | -webkit-animation: boom 1s ease-out;
131 | -webkit-animation-delay: 0.75s;
132 | }
133 |
134 | /* Text Animation */
135 | input[type=radio]:focus + label .input-name .text__effect {
136 | transition: all 0.2s ease-out;
137 | -webkit-transition-delay: 0.75s;
138 | color: #4B6279;
139 | }
140 |
141 | input[type=radio] + label .input-name .text__effect {
142 | cursor: pointer;
143 | }
144 |
145 | input[type=radio]:focus + label .inner::after {
146 | opacity: 1;
147 | -webkit-transform: translate(140px, -150px) scale(0.01);
148 | transition: all 1s ease;
149 | }
--------------------------------------------------------------------------------