키프레임 시나리오
- 중앙에서 검정선이 옆으로 1초 동안 서서히 나타난다
- 이 선을 기준으로 타이틀 글자가 위로 서서히 올라가고,
작은 타이틀 글자가 아래로 서서히 나타난다 (animate)
.aniBox.gixobj>.bigTitle+.blackLine+.subTitle
.aniBox.fixobj>.bigTitle.ofh(오버플로우히든)>p{큰글자위로서서히}^.blackLine+.subTitle.ofh>p{작은글자위로서서히}
"마지막 프레임을 생각하며 CSS 짜기"
<style>
.fixobj{
position: absolute; /* width 없음(=자식들에게 맞추겠다) */
/* 근데 자식인 .blackline 너비값 없음. 어쩔? */
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.blackline{
height: 5px;
width: 100%; /* 부모 사이즈에 맞추겠다 */
/* 근데 부모인 .fixobj에 width 없음 */
background-color: black;
}
</style>
Q) 움직임을 주는 것, position: rel? 아니면 transform?
A) transform 써서 움직이면 안된다!! (스와이퍼 등 플러그인이 쓰고있기 때문에)
<style>
@keyframes blackline {
%{
width: 0;
}
/* 50%{
width: 110%;
} */
100%{
width: 100%;
}
}
</style>
+) 중앙선 기준 타이틀 글자가 내려오는 subTitleani 키프레임
<style>
.subTitle p{ font-size: 20px; line-height: 1; margin-top: 1rem;
position: relative; bottom: 50px;
animation-name: subTextani;
animation-duration: 1s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}
@keyframes subTextani{
0%{
bottom: 50px;
}
50%{
bottom: -10px;
}
100%{
bottom: 0px;
}
}
</style>