Skip to content

Instantly share code, notes, and snippets.

@mhekel
Last active January 4, 2025 07:42
Show Gist options
  • Select an option

  • Save mhekel/a94920cc4884f76cb44b627035bc49d2 to your computer and use it in GitHub Desktop.

Select an option

Save mhekel/a94920cc4884f76cb44b627035bc49d2 to your computer and use it in GitHub Desktop.
Wrapper for the text animation
@import url('https://fonts.googleapis.com/css2?family=Lobster&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fontdiner+Swanky&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap');
* {
box-sizing: border-box;
}
body {
display: grid;
place-content: center;
grid-template-columns: 100%;
min-height: 100vh;
max-width: 100vw;
}
.bg {
background-image: url('http://silversurfer.servehttp.com/img/6.png');
background-color: rgba(0, 0, 0, 0.2);
background-blend-mode: color;
background-repeat: no-repeat;
background-size: cover;
background-position: top center;
z-index: -1;
filter: brightness(75%);
}
/* Wrapper for the text animation */
.container {
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
height: 100vh;
position: relative;
}
/* Base text layer */
.text-layer {
position: absolute;
left: 50%;
top: 25%;
transform: translate(-25%, -50%);
z-index: 1;
font-weight: bold;
font-size: 6em;
font-family: "Permanent Marker";
text-shadow:
}
.text-layer:nth-child(2) {
top: 25%;
left: 50%;
/*transform: translate(-25%, -50%);*/
}
.text-layer:nth-child(3) {
top: 25%;
left: 50%;
/* transform: translate(-50%, -50%); */
}
.text-layer:nth-child(4) {
top: calc (50% +3px);
left: calc(50% + 3px);
transform: translate(-50%, -50%);
}
.text-layer:nth-child(5) {
top: 25%;
left: 50%;
transform: translate(-50%, -50%);
}
.text-layer:nth-child(6) {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
/* Initial slide-in animations */
.text-layer.at-item {
color: #fff;
animation: fade-in 4s linear 0s 1 normal forwards, fade-out 4s ease-in 4s 1 normal forwards;
}
.text-layer.sr-item {
color: #e25836;
animation: slide-in-elliptic-top-fwd 3s linear 0s 1 normal forwards, slide-out-elliptic-bottom-bck 3s linear 6s 1 normal forwards;
}
.text-layer.al-item {
color: #3079ed;
animation: slide-in-elliptic-bottom-fwd 3s linear 0s 1 normal forwards, slide-out-elliptic-top-bck 3s linear 6s 1 normal forwards;
}
.text-layer.se-item {
color: #e2c638;
animation: slide-in-elliptic-left-fwd 3s linear 0s 1 normal forwards, slide-out-elliptic-right-bck 3s linear 6s 1 normal forwards;
}
.text-layer.sf-item {
color: #8dba25;
animation: slide-in-elliptic-right-fwd 3s linear 0s 1 normal forwards, slide-out-elliptic-left-bck 3s linear 6s 1 normal forwards;
}
@keyframes fade-in {
0% {
opacity: 0;
transform: scale(0);
}
100% {
opacity: 1;
transform: scale(2);
}
}
@keyframes fade-out {
0% {
opacity: 1;
transform: scale(2);
}
100% {
opacity: 0;
transform: scale(0);
}
}
/* Keyframes for slide-in animations */
@keyframes slide-in-elliptic-left-fwd {
0% {
transform: translateX(-800px) rotateY(30deg) scale(0);
transform-origin: -100% 50%;
opacity: 0;
}
100% {
transform: translateX(0) rotateY(0) scale(1);
transform-origin: 1800px 50%;
opacity: 1;
}
}
@keyframes slide-out-elliptic-left-bck {
0% {
transform: translateX(0) rotateY(0) scale(1);
transform-origin: 2000px 50%;
opacity: 1;
}
100% {
transform: translateX(-1000px) rotateY(-30deg) scale(0);
transform-origin: -100% 50%;
opacity: 0.5;
}
}
@keyframes slide-in-elliptic-right-fwd {
0% {
transform: translateX(800px) rotateY(-90deg) scale(0);
transform-origin: -100% 50%;
opacity: 0;
}
100% {
transform: translateX(0) rotateY(0) scale(1);
transform-origin: -1800px 50%;
opacity: 1;
}
}
@keyframes slide-out-elliptic-right-bck {
0% {
transform: translateX(0) rotateY(0) scale(1);
transform-origin: -1800px 50%;
opacity: 1;
}
100% {
transform: translateX(1000px) rotateY(-90deg) scale(0);
transform-origin: -100% 50%;
opacity: 0.5;
}
}
@keyframes slide-in-elliptic-top-fwd {
0% {
transform: translateY(-600px) rotateX(-30deg) scale(0);
transform-origin: 50% 100%;
opacity: 0;
}
100% {
transform: translateY(0) rotateX(0) scale(1);
transform-origin: 50% 1400px;
opacity: 1;
}
}
@keyframes slide-out-elliptic-top-bck {
0% {
transform: translateY(0) rotateX(0) scale(1);
transform-origin: 50% 1400px;
opacity: 1;
}
100% {
transform: translateY(-600px) rotateX(-30deg) scale(0);
transform-origin: 50% 100%;
opacity: 0.5;
}
}
@keyframes slide-in-elliptic-bottom-fwd {
0% {
transform: translateY(600px) rotateX(30deg) scale(0);
transform-origin: 50% 100%;
opacity: 0;
}
100% {
transform: translateY(0) rotateX(0) scale(1);
transform-origin: 50% -1400px;
opacity: 1;
}
}
@keyframes slide-out-elliptic-bottom-bck {
0% {
transform: translateY(0) rotateX(0) scale(1);
transform-origin: 50% -1400px;
opacity: 1;
}
100% {
transform: translateY(600px) rotateX(90deg) scale(0);
transform-origin: 50% 100%;
opacity: 0.5;
}
}
/* Container for the car and logo animation */
.car-wrapper {
position: relative;
box-sizing: border-box;
overflow: hidden;
display: flex;
align-items: left;
justify-content: flex-start; /* Start from the left */
width: 100%;
height: 100%;
}
/* Adjust SVG Container */
.svg-container {
position: absolute;
left: -20%; /* Start completely off-screen */
top: 55%;
animation: drive 15s linear forwards;
animation-delay: 10s; /* Adjust delay based on your text animation duration */
display: flex;
align-items: left;
}
.svg {
width: 100vw; /* Adjust size as needed */
height: auto;
display: flex;
}
/* Container for the text reveal */
#div1 {
top: 50%;
position: relative;
height: 250px;
width: 0;
display: flex;
margin-left: 1px;
perspective-origin: left;
overflow: hidden;
animation: txt 1s linear 11s forwards; /* Update animation duration and delay */
}
#div2 {
position: absolute;
height: 300px;
}
/* Styling for the text being revealed */
#div2.sl-logo {
left: 0;
font-size: 40px;
color: white;
-webkit-text-stroke: 3px black;
font-family: "Fontdiner Swanky", serif;
font-weight: bolder;
letter-spacing: 4px;
text-shadow: 3px 5px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, 1px 1px 0 #000, -1px 1px 0 #000;
z-index: -3;
}
/* Animation for text reveal */
@keyframes txt {
0% {
width: 0;
}
100% {
width: 600px; /* Adjust according to your needs */
}
}
/* Animation for logo */
@keyframes image {
0% {
width: 0;
}
100% {
width: 575px; /* Adjust according to your needs */
}
}
/* Updated SVG animation */
@keyframes drive {
0% {
transform: translateX(0);
left: 0%;
}
25% {
transform: translateX(calc(100vw + 50%));
}
40% {
left: 100%;
transform: rotateY(180deg);
}
42% {
transform: translateX(0);
transform: translateX(calc(50vw + 60%));
}
60% {
left: -40%;
transform: rotateY(180deg);
}
61% {transform: translateX(0);
100% {
transform: translateX(calc(100vw + 100%));
}
}
/* Updated SVG animation */
#div3 {
top: 50%;
position: relative;
height: 250px;
width: 0;
margin-left: 400px;
perspective-origin: left;
overflow: hidden;
animation: txt2 1s linear forwards;
animation-delay: 16s; /* Update animation duration and delay */
}
#div4 {
position: absolute;
height: 300px;
}
@keyframes txt2 {
0% {
width: 0;
}
100% {
width: 500px; /* Adjust according to your needs */
}
}
.div4.donut {
background-image: url("img/becausedonut.png");
no-repeat;
top:50%;
}
/* Styling for the text being revealed */
<body class="bg">
<div class="container">
<div class="wrapper">
<div class="text-layer al-item">Welcome</div>
<div class="text-layer se-item">Welcome</div>
<div class="text-layer sf-item">Welcome</div>
<div class="text-layer sr-item">Welcome</div>
<div class="text-layer at-item">Welcome</div>
</div>
<div class="car-wrapper">
<div id="div1">
<div id="div2" class="sl-logo">BecauseDONUT</div>
</div>
<div class="svg-container">
<img src="https://silversurfer.servehttp.com/racecar.svg" alt="Racecar SVG" class="svg"></img>
</div></div></div>
</div>
</body> -->
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"1","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment