简体   繁体   English

将淡出效果添加到此动画中

[英]Adding the fade out to this animation

So I found a really cool animation for social link and I wanted to modify it so that I had the ability to make it also fade out. 因此,我找到了一个非常酷的社交链接动画,我想对其进行修改,以便能够使其淡出。 The original code is here: 原始代码在这里:

.right {
position: relative;
height: 60px;
width: 400px;
float: left;
color: $dark;
padding-left: 10px;
font-size: 30px;
line-height: 60px;
white-space: nowrap;
font-family: 'Montserrat';
animation: popup-text 2s 1 ease-out;
-webkit-animation: popup-text 2s 1 ease-out;    

span {
  white-space: nowrap;
}

@keyframes popup-text { //change to popup                                                               
  0% {color: rgba(16,16,16,0); text-indent: -10px}
  40% {color: rgba(16,16,16,0); text-indent: -10px}
  50% {color: rgba(16,16,16,1); text-indent: 0px;}
  100% {color: rgba(16,16,16,1); text-indent: 0px;}
}
@-webkit-keyframes popup-text { //change to popup                                                               
  0% {color: rgba(16,16,16,0); text-indent: -10px}
  40% {color: rgba(16,16,16,0); text-indent: -10px}
  50% {color: rgba(22,16,16,1); text-indent: 0px;}
  100% {color: rgba(16,16,16,1); text-indent: 0px;}
}

.show-popup {
display: block;
animation: popup 1s 1 ease-out;
-webkit-animation: popup 1s 1 ease-out;
}    

@keyframes popup { //change to popup
  0% {width: 60px; margin-top: -10px;opacity: 0;}
  20% {width: 60px; margin-top: 0px;opacity: 1;}
  45% {width: 470px;}
  100% {width: 470px;}
}
@-webkit-keyframes popup { //change to popup
  0% {width: 60px; margin-top: -10px;opacity: 0;}
  20% {width: 60px; margin-top: 0px;opacity: 1;}
  45% {width: 470px;}
  100% {width: 470px;}
}

.no-popup {
  display:none !important;
}

` http://codepen.io/NerdOrDie/pen/vNEvee?editors=0110 . ` http://codepen.io/NerdOrDie/pen/vNEvee?editors=0110

By default the picture drops down and fades in followed by the text shifting right and fading in. I want to change it so after everything fades in wait a couple seconds and then side the text to the left and fade out followed by sliding the picture up and out. 默认情况下,图片会掉落并渐隐,然后文本向右移并渐入。我想对其进行更改,以便在所有渐隐之后等待几秒钟,然后将文本向左倾斜并渐隐,然后向上滑动图片出来。

The problem that I ran into was when I tried to edit the key frames to just be mirrored the text didn't display at first and then after the fade out by the logo the text just seems to pop into exsistence for a second before the next animation starts. 我遇到的问题是,当我尝试将关键帧编辑为仅被镜像时,该文本最初并未显示,然后在徽标淡出之后,该文本似乎在下一帧之前突然出现了一段时间动画开始。 How would I go about changing this to have the whole animation (both in and out) play properly and then not have the entire thing popping up between animations? 我将如何更改此设置以使整个动画(从内到外)都能正常播放,然后在动画之间不弹出整个动画?

Use the animation-direction css property to indicate whether the animation should play in reverse. 使用animation-direction css属性指示动画是否应反向播放。

.right {
  ...
  animation-direction: reverse;
}
.show-pop {
  ...
  animation-direction: reverse;
}

You may want to add animation-delay to sync with your next series of images and text. 您可能需要添加动画延迟,以与下一组图像和文本同步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM