Skip to content

Instantly share code, notes, and snippets.

@mhekel
Created January 4, 2025 17:32
Show Gist options
  • Select an option

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

Select an option

Save mhekel/fa4b5d74f4b602b392bb64d843fa004a 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%;
display: flex;
align-items: left;
}
.svg {
width: 100px; /* Adjust size as needed */
height: auto;
offset-path: path("M 0 0 L 120vw 0 L -50px 0 L 100vw 0");
animation: drive 20s linear infinite; /* Adjust animation duration for full cycle */
}/* Container for the text reveal */
}
.myDIV {
height:300px;
background-color:#FFFFFF;
margin-top:50%;
margin-left:0px;
display: flex;
width: 600px;}
#div1 {
position: relative;
height: 150px;
width: 0px;
overflow: hidden;
animation: txt 2s linear 8s forwards, txt2 2s linear 10s forwards;
}
#div2, #div3 {
padding: 50px;
position: absolute;
}
@keyframes txt {
0% {width: 0;}
100% { width: 450px;}
}
@keyframes txt2 {
0% {width:455px;}
100% {width: 850px;}
}
/* Styling for the text being revealed */
.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;
}
.donut{margin-left:400px;}
/* Updated SVG animation */
@keyframes drive {
@keyframes drive {
0% {
offset-distance: 0%;
}
40% {
offset-distance: 100%;
transform: rotateY(180deg);
}
80% {
offset-distance: 200%;
transform: rotateY(360deg);
}
100% {
offset-distance: 300%;
}
}
<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 class="myDiv">
<div id="div1">
<div id="div2" class="sl-logo">BecauseDONUT</div>
<div id="div3" class="donut"><img src="http://silversurfer.servehttp.com/img/becausedonut.png"></img></div>
</div> </div>
<div class="svg-container">
<img src="https://silversurfer.servehttp.com/racecar.svg" alt="Racecar SVG" class="svg"></img>
</div></div></div>
// alert('Hello world!');
{"view":"split","fontsize":"130","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment