图片/图形

炫酷coming soon分步显示动画特效

阿里云


这是一款效果十分炫酷的 css3 coming soon 分步显示动画特效。整个 css3 动画分几个场景,每次显示一个场景,就像广告里经常出现的 coming soon 分步显示效果。

HTML 结构

创建一个 class 为 sp-container 的 div 作为包裹容器。在其中 sp-content 为主要显示区域,里面包含多个 sp-row。每一个 sp-row 是一个“动画场景”,里面放置各种图片。sp-side 是最后显示的提交表单。

也想出现在这里?联系我们
创客主机
  1. <div class="sp-container">
  2.     <div class="sp-content">
  3.         <div class="sp-row">
  4.             <span><img src="images/example1/1.png" /></span>
  5.             <span><img src="images/example1/2.png" /></span>
  6.             <span><img src="images/example1/3.png" /></span>
  7.             <span><img src="images/example1/4.png" /></span>
  8.             <span><img src="images/example1/5.png" /></span>
  9.         </div>
  10.         <div class="sp-row sp-side-row">
  11.             <span><img src="images/example1/11.png" /></span>
  12.             <span><img src="images/example1/12.png" /></span>
  13.         </div>
  14.         <div class="sp-row sp-content-row">
  15.             <h1>Coming Soon</h1>
  16.             <h2>Designer Shoes that you dream of for incredible prices</h2>
  17.             <h1 class="sp-title"><em>Little</em> Blue Shoe</h1>
  18.         </div>
  19.         <div class="sp-row sp-side-row">
  20.             <span><img src="images/example1/13.png" /></span>
  21.             <span><img src="images/example1/14.png" /></span>
  22.         </div>
  23.         <div class="sp-row">
  24.             <span><img src="images/example1/6.png" /></span>
  25.             <span><img src="images/example1/7.png" /></span>
  26.             <span><img src="images/example1/8.png" /></span>
  27.             <span><img src="images/example1/9.png" /></span>
  28.             <span><img src="images/example1/10.png" /></span>
  29.         </div>
  30.         <div class="sp-arrow"></div>
  31.     </div>
  32.     <div class="sp-side">
  33.         <h2>Be the first to know:</h2>
  34.         <div class="sp-input">
  35.             <input type="text" value="Your email"/>
  36.             <a href="index.html">Go</a>
  37.         </div>
  38.     </div>
  39. </div>

CSS 样式

这个 demo 的主要思想是制作一系列的场景动画:

1、所有商品的缩略图依次出现

2、h1 标题出现

3、h2 子标题出现

4、h1 和 h2 子标题 fadeOut 消失

5、商品缩略图依次以 fadeOut 的方式消失。第二个 h1 标题以 fadeInColor 的方式出现。内容区域移到左边并以 sizeDownMove 方式缩小

6、箭头和提交表单以 slideIn 的方式出现
下面开始写 css 代码:主内容区域居中并设置为绝对定位:

  1. .sp-container {
  2.     position: relative;
  3.     width: 1000px;
  4.     height: 600px;
  5.     margin: -40px auto 0 auto;
  6. }
  7. .sp-content {
  8.     position: absolute;
  9.     z-index: 100;
  10.     width: 800px;
  11.     height: 600px;
  12.     left: 0px;
  13.     top: 0px;
  14.     animation: sizeDownMove 0.9s ease-in-out 6s backwards;
  15.     transform: scale(0.6);
  16.     transform-origin: 0% 50%;
  17. }

从上面的代码可以看到,主内容区域在 6 秒后移到左侧并缩小。将箭头也居中,并给它一张背景图片:

  1. .sp-arrow {
  2.     background: transparent url(../images/arrow.png) no-repeat top left;
  3.     position: absolute;
  4.     top: 50%;
  5.     margin-top: -77px;
  6.     left: 82%;
  7.     width: 198px;
  8.     height: 155px;
  9.     animation: slideIn 0.6s ease-in-out 6s backwards;
  10.     z-index: 100;
  11. }

在 side 中的元素包括一个 email 提交表单,将它放置到右边:

  1. .sp-side {
  2.     width: 460px;
  3.     height: 300px;
  4.     position: absolute;
  5.     right: 10px;
  6.     top: 25%;
  7.     animation: slideIn 0.6s ease-in-out 6s backwards;
  8. }

下面给标题一些样式:

  1. .sp-side h2 {
  2.     font-size: 70px;
  3.     padding: 20px 0px;
  4.     text-align: center;
  5.     color: #fff;
  6.     text-transform: uppercase;
  7.     text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  8.     font-family: 'Unlock', Arial, sans-serif;
  9. }

提交按钮的样式如下:

  1. .sp-input {
  2.     background-color: rgba(255,255,255,0.3);
  3.     height: 30px;
  4.     padding: 20px;
  5.     border-radius: 10px;
  6.     margin: 0 auto;
  7.     width: 260px;
  8. }
  9. .sp-input input[type="text"] {
  10.     width: 210px;
  11.     padding: 6px;
  12.     background-color: #fff;
  13.     border: 1px solid #ddd;
  14.     border-radius: 4px;
  15.     float: left;
  16.     font-family: 'Cookie', serif;
  17.     font-size: 18px;
  18. }
  19. .sp-input input[type="text"]:focus {
  20.     outline-color: #acdacf;
  21. }
  22. .sp-input a {
  23.     float: left;
  24.     background-color: #418e7b;
  25.     color: #fff;
  26.     width: 30px;
  27.     height: 30px;
  28.     border: none;
  29.     border-radius: 50%;
  30.     margin-left: 5px;
  31.     text-align: center;
  32.     line-height: 30px;
  33.     cursor: pointer;
  34.     font-family: 'Unlock', Arial, sans-serif;
  35. }
  36. .sp-input a:hover {
  37.     background-color: #fff;
  38.     color: #418e7b;
  39. }

现在来看一下主内容区域的样式:首先给标题样式,它将在图片显示后显示,然后消失:

  1. .sp-content h1:first-child {
  2.     font-size: 100px;
  3.     text-align: center;
  4.     color: #fff;
  5.     text-transform: uppercase;
  6.     text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  7.     line-height: 80px;
  8.     padding: 30px 0px 20px 0px;
  9.     font-family: 'Unlock', Arial, sans-serif;
  10.     animation: 
  11.         fromBack 1.2s ease-in-out 1.5s backwards, 
  12.         fadeOut 0.5s linear 4.5s forwards;
  13. }

h2 标题在 h1 标题之后出现,然后和 H1 标题一起消失:

  1. .sp-content h1.sp-title {
  2.     font-size: 90px;
  3.     line-height: 80px;
  4.     position: absolute;
  5.     top: 50px;
  6.     left: 160px;
  7.     width: 470px;
  8.     border-radius: 50%;
  9.     background-color: rgba(255, 255, 255, 0.3);
  10.     padding-top: 155px;
  11.     height: 305px;
  12.     text-transform: uppercase;
  13.     text-align: center;
  14.     color: #518f7e;
  15.     text-shadow: 1px 1px 1px rgba(255,255,255,0.9);
  16.     font-family: 'Unlock', Arial, sans-serif;
  17.     animation: fadeInColor 1.2s linear 5.2s backwards;
  18. }
  19. .sp-content h1:last-child em {
  20.     font-family: 'Cookie', serif;
  21.     text-transform: none;
  22. }
  23. .sp-content h2 {
  24.     font-size: 36px;
  25.     text-align: center;
  26.     color: #518f7e;
  27.     font-family: 'Cookie', serif;
  28.     text-shadow: 1px 1px 1px rgba(255,255,255,0.9);
  29.     opacity: 0;
  30.     animation: 
  31.         fromBack 0.6s ease-in-out 2.6s backwards, 
  32.         fadeOut 0.5s linear 4.5s backwards;
  33. }

最后来给商品缩略图样式:

  1. .sp-content-row {
  2.     width: 466px;
  3.     height: 300px;
  4.     float: left;
  5. }
  6. .sp-side-row {
  7.     width: 150px;
  8.     float: left;
  9. }
  10. .sp-row img {
  11.     display: block;
  12.     z-index: 1000;
  13.     position: relative;
  14. }

每一个商品缩略图将从大小为 0 被放大到 1,并依次出现。之后消失时效果刚好相反。

  1. .sp-row span {
  2.     position: relative;
  3.     float: left;
  4.     margin: 2px;
  5.     z-index: 100;
  6.     transform: scale(1);
  7.     opacity: 0;
  8.     animation: 
  9.         fromBack 0.4s linear backwards, 
  10.         fadeOut 0.3s linear backwards;
  11. }

我们通过指定一些时间延时来制作缩略图依次出现的效果:

  1. .sp-row:nth-child(1) span:nth-child(1) {
  2.     animation-delay: 0s, 5s;
  3. }
  4. .sp-row:nth-child(1) span:nth-child(2) {
  5.     animation-delay: 0.1s, 5.1s;
  6. }
  7. .sp-row:nth-child(1) span:nth-child(3) {
  8.     animation-delay: 0.2s, 5.2s;
  9. }
  10. .sp-row:nth-child(1) span:nth-child(4) {
  11.     animation-delay: 0.3s, 5.3s;
  12. }
  13. .sp-row:nth-child(1) span:nth-child(5) {
  14.     animation-delay: 0.4s, 5.4s;
  15. }
  16. .sp-row:nth-child(4) span:nth-child(1) {
  17.     animation-delay: 0.5s, 5.5s;
  18. }
  19. .sp-row:nth-child(4) span:nth-child(2) {
  20.     animation-delay: 0.6s, 5.6s;
  21. }
  22. .sp-row:nth-child(5) span:nth-child(5) {
  23.     animation-delay: 0.7s, 5.7s;
  24. }
  25. .sp-row:nth-child(5) span:nth-child(4) {
  26.     animation-delay: 0.8s, 5.8s;
  27. }
  28. .sp-row:nth-child(5) span:nth-child(3) {
  29.     animation-delay: 0.9s, 5.9s;
  30. }
  31. .sp-row:nth-child(5) span:nth-child(2) {
  32.     animation-delay: 1s, 6s;
  33. }
  34. .sp-row:nth-child(5) span:nth-child(1) {
  35.     animation-delay: 1.1s, 6.1s;
  36. }
  37. .sp-row:nth-child(2) span:nth-child(2) {
  38.     animation-delay: 1.2s, 6.2s;
  39. }
  40. .sp-row:nth-child(2) span:nth-child(1) {
  41.     animation-delay: 1.3s, 6.3s;
  42. }

使用伪元素为每个缩略图制作一个圆形的背景:

  1. .sp-row span:before {
  2.     content: '';
  3.     position: absolute;
  4.     background-color: rgba(255,255,255,0.3);
  5.     width: 100px;
  6.     height: 100px;
  7.     top: 50%;
  8.     left: 50%;
  9.     margin: -50px 0 0 -50px;
  10.     border-radius: 50%;
  11. }

下面是动画效果的制作,第一个动画效果是 fadeOut 效果,通过设置透明度从 1 到 0 来实现:

  1. @keyframes fadeOut{
  2.     0%{
  3.         opacity: 1;
  4.     }
  5.     100%{
  6.         opacity: 0;
  7.     }
  8. }

第二个动画效果是 fadeInColor,它将使元素 fade in 并改变背景色。

  1. @keyframes fadeInColor{
  2.     0%{
  3.         opacity: 0;
  4.         background-color: rgba(255,255,255,0);
  5.     }
  6.     50%{
  7.         opacity: 0.5;
  8.         background-color: rgba(255,255,255,0);
  9.     }
  10.     100%{
  11.         opacity: 1;
  12.         background-color: rgba(255,255,255,0.3);
  13.     }
  14. }

第三个动画效果是 slideIn,它将简单的使元素移动到左侧:

  1. @keyframes slideIn{
  2.     0%{
  3.         opacity: 0;
  4.         transform: translateX(-200px);
  5.     }
  6.     100%{
  7.         opacity: 1;
  8.         transform: translateX(0px);
  9.     }
  10. }

第四个动画效果是 sizeDownMove,它将使元素缩小并从左边 100 像素移动到 0 像素。

  1. @keyframes sizeDownMove{
  2.     0%{
  3.         transform: scale(1);
  4.         left: 100px;
  5.     }
  6.     100%{
  7.         transform: scale(0.6);
  8.         left: 0px;
  9.     }
  10. }

最后一个动画效果是 fromBack,它将使元素的大小从 0 放大到 1 同时透明度从 0 增大到 1。

  1. @keyframes fromBack{
  2.     0%{
  3.         transform: scale(0);
  4.         opacity: 0;
  5.     }
  6.     100%{
  7.         transform: scale(1);
  8.         opacity: 1;
  9.     }
  10. }

炫酷 coming soon 分步显示动画特效

已有 330 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!