.cursor { display: block; position: absolute; width: 18px; height: 30px; background-image: url('data:image/svg+xml;utf8, '); background-repeat: no-repeat; transition: top .125s linear, left .125s linear; pointer-events: none; user-select: none; } /* ====== * Source: https://github.com/codrops/ClickEffects/blob/master/css/component.css * ======= */ .cursor::after { position: absolute; margin: -35px 0 0 -35px; width: 70px; height: 70px; border-radius: 50%; content: ''; opacity: 0; pointer-events: none; user-select: none; box-shadow: inset 0 0 0 35px rgba(111,148,182,0); } .cursor.clicked::after { -webkit-animation: click-animation 0.5s ease-out forwards; animation: click-animation 0.5s ease-out forwards; } @-webkit-keyframes click-animation { 0% { opacity: 1; -webkit-transform: scale3d(0.4, 0.4, 1); transform: scale3d(0.4, 0.4, 1); } 80% { box-shadow: inset 0 0 0 2px rgba(111,148,182,0.8); opacity: 0.1; } 100% { box-shadow: inset 0 0 0 2px rgba(111,148,182,0.8); opacity: 0; -webkit-transform: scale3d(1.2, 1.2, 1); transform: scale3d(1.2, 1.2, 1); } } @keyframes click-animation { 0% { opacity: 1; -webkit-transform: scale3d(0.4, 0.4, 1); transform: scale3d(0.4, 0.4, 1); } 80% { box-shadow: inset 0 0 0 2px rgba(111,148,182,0.8); opacity: 0.1; } 100% { box-shadow: inset 0 0 0 2px rgba(111,148,182,0.8); opacity: 0; -webkit-transform: scale3d(1.2, 1.2, 1); transform: scale3d(1.2, 1.2, 1); } } .cursor.clickedMobile::after { -webkit-animation: anim-effect-sanja 1s ease-out forwards; animation: anim-effect-sanja 1s ease-out forwards; } @-webkit-keyframes anim-effect-sanja { 0% { opacity: 1; -webkit-transform: scale3d(0.5, 0.5, 1); transform: scale3d(0.5, 0.5, 1); } 25% { opacity: 1; -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); } 100% { opacity: 0; -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); } } @keyframes anim-effect-sanja { 0% { opacity: 1; -webkit-transform: scale3d(0.5, 0.5, 1); transform: scale3d(0.5, 0.5, 1); } 25% { opacity: 1; -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); } 100% { opacity: 0; -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); } } .cursor.shaking { width: 45px; height: 75px; -webkit-animation: shaking 0.3s linear; animation: shaking 0.3s linear; animation-iteration-count: 2; } @keyframes shaking { 0% { transform: translate(60px, -60px); } 25% { transform: translate(-60px, 60px); } 50% { transform: translate(60px, -60px); } 75% { transform: translate(-60px, 60px); } 100% { transform: translate(60px, -60px); } }