I am working on an intro animation for a website where the children slide up from the bottom (margin-top: 80px) with the container being set a fixed height and overflow:hidden to make it look slick.
The children have a transition-delay added to make them show up one after another but the whole line of elements are showing up together.
It would be great if someone could help me out with this code.
setTimeout(function() {
$('.anim_line').addClass('show');
}, 1400);
.container {
height: 100%;
width: 100%;
background: #121212;
}
.anim_container {
margin: 80px;
}
.anim_inner_container {
position: relative;
background-color: hsla(260, 91%, 84%, 1);
background-image:
radial-gradient(at 67% 61%, hsla(250, 67%, 53%, 1) 0px, transparent 40%),
radial-gradient(at 34% -33%, hsla(249, 67%, 53%, 1) 0px, transparent 40%),
radial-gradient(at 44% -15%, hsla(249, 67%, 53%, 1) 0px, transparent 40%);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-family: 'Calibri';
font-size: 64px;
line-height: 96px;
}
.anim_line {
height: 96px;
width: 100%;
overflow: hidden;
text-overflow: clip;
}
.anim_word {
display: inline-block;
margin-top: 100%;
transition: all 1.15s cubic-bezier(0.62, 0.05, 0.01, 0.99) 0s;
-webkit-transition: all 1.15s cubic-bezier(0.62, 0.05, 0.01, 0.99) 0s;
-moz-transition: all 1.15s cubic-bezier(0.62, 0.05, 0.01, 0.99) 0s;
-ms-transition: all 1.15s cubic-bezier(0.62, 0.05, 0.01, 0.99) 0s;
-o-transition: all 1.15s cubic-bezier(0.62, 0.05, 0.01, 0.99) 0s;
}
.anim_word span {}
.anim_line.show .anim_word {
margin-top: 0%;
}
.anim_line:nth-child(1) .anim_word:nth-child(2) {
transition-delay: .15s;
-webkit-transition-delay: .15s;
}
.anim_line:nth-child(1) .anim_word:nth-child(3) {
transition-delay: .25s;
-webkit-transition-delay: .25s;
}
.anim_line:nth-child(1) .anim_word:nth-child(4) {
transition-delay: .35s;
-webkit-transition-delay: .35s;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<div class="container">
<div class="anim_container">
<div class="anim_inner_container">
<div class="anim_line">
<div class="anim_word">A</div>
<div class="anim_word">product</div>
<div class="anim_word">designer</div>
<div class="anim_word">helping</div>
</div>
<div class="anim_line">
<div class="anim_word">design</div>
<div class="anim_word">beautiful,</div>
<div class="anim_word"> user</div>
<div class="anim_word">centered</div>
</div>
<div class="anim_line">
<div class="anim_word">products</div>
</div>
</div>
</div>
</div>
I tried to use several different display properties for children but nothing seems to be working.
3
Answers
You have apparently 2 things here to take into account is that transition delay needs to be declared right after transition itself for it to work and in your animal container class ".anim_inner_container" you are using 96px for line-height so you need to put the height to minimum 384px
To make 3 animations in row for every element with different delay, you need to defind animation for each element.
Edit: every word animation.
example code:
To achieve the exact result you are looking you can make sure of the css variables to calculate delay for each text element.