CSS动画结束后显示Div

时间:2018-11-09 19:29:14

标签: html css3

我有一个Windows 10 Simulator脚本,主要是用CSS动画制作的。我已成功创建了颜色渐变,但现在对下一步的操作一无所知。

主要HTML和CSS

            <html>
    <head>
    <title>Windows 10 Simulator</title>


    <link href="https://fonts.googleapis.com/
    css?family=Noto+Sans|Open+Sans|PT+Sans|
    Raleway|Source+Sans+Pro" rel="stylesheet">

    </head>

    <body>


    <style onload>

    html, body{
    margin: 0;
    padding: 0;

    background-color: #000;
    }

    .wrapper { 
      height: 100%;
      width: 100%;
      left:0;
      right: 0;
      top: 0;
      bottom: 0;
      position: absolute;
    background: linear-gradient(124deg,  #000000, 
            #000000, #0095f0 ,#0095f0, #0095F0, #ff0000, 
            #ff0000, #0095f0);
    background-size: 1800% 1800%;

    animation-iteration-count: 0;  
    animation-fill-mode: forwards;
    animation: rainbow 30s ease 1;
    }


    @keyframes rainbow { 
        0% {background-position:  0% 0%}
        10%{background-position: 100%% 15%}
        20%{background-position: 100% 30%}
        30%{background-position: 100% 45%}
        40%{background-position: 100% 60%}
        50%{background-position: 100% 85%}
        60%{background-position: 100% 90%}
        70%{background-position: 100% 100%}
        80%{background-position: 100% 90%}
        90%{background-position: 100% 85%}
        80%{background-position: 100% 45%}
        100%{background-position:100% 15%}
        }



      span {
      margin-top: 250px;
      color: #fff;
      font-size: 30px;
      font-family: 'Raleway', sans-serif;
      animation-name: flickerAnimation;
      animation-duration: 5s;
      animation-iteration-count: 1;   
      position: absolute;
      opacity: 0;
      left: 0;
      right: 0;
      text-align: center;
      }

      #message{
      font-size: 10px;
      color: #fff;
      animation-name: alertFade;
      animation-duration: 4s;

      opacity: 0;
      animation-iteration-count: 1000;
      margin-top: 620px;
      }

      span:nth-child(1) {
      animation-delay: 1s;
      animation-duration: 5s;

      }

      span:nth-child(2) {
      animation-delay: 7s;
      animation-duration: 7s;
      }

      span:nth-child(3) {
      animation-delay: 15s;
      }

      span:nth-child(4) {
      animation-delay: 22s;
      }


      @keyframes flickerAnimation{

      0% {opacity: 0;}
      50% {opacity: 1;}
      100% {opacity: .0;}

      }

      @keyframes alertFade{
      0% {opacity: .25}
      50% {opacity: .75}
      100% {opacity: .25}
      }



      </style>
      <div class="wrapper">



      <span>Hello! </span>
      <span>Please Wait While We Setup</span>
      <span>This Will Only Take a Few Seconds</span>
      <span>Just a second...</span>


      <div style="text-align: center;">
      <p id="message" align="center">Please Do Not Turn 
              Off Your Device.</p>
      </div>
      </div>
      </body>
      </html>

我正在尝试使以下代码块在上一个CSS动画结束后出现:

#login{
margin-left: 25px;
margin-top: 80px;
text-align: center;
background-color: #000;
width: 350px;
height: 425px;
}

#icon{
margin-top: 50px; 
width: 150px;
border-radius: 100px;
}

#other{
color: #fff;
font-size: 25px;
 }



input[type=password] {
width: 70%;
height: 40px;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: 1px solid #555;

概述:无;     位置:静态;

}




input[type="submit"] 

/*button*/{
margin-left: -41px;
height: 35.5px;
width: 32.5px;


 }

  #go{
 background-color: gray;
 color: gray;
 border: none;
 }

 #hint{
 color: #fff;
 font-size: 8px;

 }
 </style>

<div style="text-align: center;">

<form action="tbd.htm" id="login">

 <img src="http://chittagongit.com/
/images/windows-user-icon/windows-user-icon-14.jpg"
id="icon">
<p id="other" style="text-align: center;">Other User</p>

<p id="hint">Hint: Type Anything.</p>
<input type="password" name="password" 
placeholder="Password"/>
<input type="submit" id="go">


</form>


</div>

我该如何执行该计划?

1 个答案:

答案 0 :(得分:0)

我只是将其链接到实际动画的序列时间,因为无论如何它都是一个固定值(您需要单击全屏选项以查看示例); < / p>

哦,还有PS-我强烈建议您努力改善您的代码格式化习惯,并坚持使用更简洁的DOM结构,但是无论哪种方式都希望对您有所帮助。干杯!

html, body{
  margin: 0;
  padding: 0;
  background-color: #000;
}

.wrapper {
  position: fixed;
  left:0;
  right: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(124deg,  #000000, 
        #000000, #0095f0 ,#0095f0, #0095F0, #ff0000, 
        #ff0000, #0095f0);
  background-size: 1800% 1800%;

  animation-iteration-count: 0;  
  animation-fill-mode: forwards;
  animation: rainbow 30s ease 1;
}

@keyframes rainbow { 
  0% {background-position:  0% 0%}
  10%{background-position: 100%% 15%}
  20%{background-position: 100% 30%}
  30%{background-position: 100% 45%}
  40%{background-position: 100% 60%}
  50%{background-position: 100% 85%}
  60%{background-position: 100% 90%}
  70%{background-position: 100% 100%}
  80%{background-position: 100% 90%}
  90%{background-position: 100% 85%}
  80%{background-position: 100% 45%}
  100%{background-position:100% 15%}
}

#message{
  font-size: 10px;
  color: #fff;
  animation-name: alertFade;
  animation-duration: 4s;
  text-align: center;
  opacity: 0;
  animation-iteration-count: 1000;
  margin-top: 620px;
}

span {
  margin-top: 250px;
  color: #fff;
  font-size: 30px;
  font-family: 'Raleway', sans-serif;
  animation-name: flickerAnimation;
  animation-duration: 5s;
  animation-iteration-count: 1;   
  position: absolute;
  opacity: 0;
  left: 0;
  right: 0;
  text-align: center;
}

span:nth-child(1) {
  animation-delay: 1s;
  animation-duration: 5s;
}

span:nth-child(2) {
  animation-delay: 7s;
  animation-duration: 7s;
}

span:nth-child(3) {
  animation-delay: 15s;
}

span:nth-child(4) {
  animation-delay: 22s;
}

@keyframes flickerAnimation{
  0% {opacity: 0;}
  50% {opacity: 1;}
  100% {opacity: .0;}
}

@keyframes alertFade{
  0% {opacity: .25}
  50% {opacity: .75}
  100% {opacity: .25}
}

@keyframes finale {
  from {opacity: 0}
    to {opacity: 1}
}

#login {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  border: red 1px dashed;
  opacity: 0;
  animation: finale 1s ease forwards;
  animation-delay: 30s;
}
<div class="wrapper">

  <span>Hello! </span>
  <span>Please Wait While We Setup</span>
  <span>This Will Only Take a Few Seconds</span>
  <span>Just a second...</span>

  <p id="message">
    Please Do Not Turn Off Your Device.
  </p>
  
  <form action="tbd.htm" id="login">

    <img src="http://chittagongit.com/
    /images/windows-user-icon/windows-user-icon-14.jpg"
    id="icon">
    <p id="other" style="text-align: center;">Other User</p>

    <p id="hint">Hint: Type Anything.</p>
    <input type="password"
           name="password"
           placeholder="Password"/>
    <input type="submit" 
           id="go">

  </form>

</div>