【问题标题】:Continuous Opacity change in Background背景中的连续不透明度变化
【发布时间】:2017-05-16 05:34:57
【问题描述】:

我在一个网站上工作,我想知道不透明度的连续变化究竟是如何发生的,在后台......

这是链接: 我希望它像这样工作http://www.cecchi.net/ ~

伙计们,我使用 css 动画.. 和关键帧类似的作品,但问题是我不知道如何将不透明度随机分配给每个部门.. 这是代码:

<!DOCTYPE html>
<html>

<head>
  <style>
  .div1,
    div2 {
      width: 100px;
      height: 100px;
      background-color: red;
      animation-name: example;
      animation-duration: 4s;
      animation-iteration-count: infinite;
    }
    /* Standard syntax */
    
    @keyframes example {
      0% {
        opacity: 1;
      }
      20% {
        opacity: 0.8;
      }
      40% {
        opacity: 0.3;
      }
      60% {
        opacity: 0.6;
      }
      80% {
        opacity: 0.8;
      }
      100% {
        opacity: 1;
      }
      .div1 {
        width: 100px;
        height: 100px;
        background-color: red;
        animation-name: example;
        animation-duration: 4s;
        animation-iteration-count: infinite;
      }
    }
    
    .div2 {
      width: 100px;
      height: 100px;
      background-color: red;
      animation-name: example;
      animation-duration: 4s;
      animation-iteration-count: infinite;
    }
    
    box-sizing: border-box;
  }
  </style>
</head>

<body>

  <div class="div1"></div>
  <br>
  <div class="div2"></div>

</body>

</html>

【问题讨论】:

  • 您正在寻找 CSS 动画。
  • @试过了...但我遇到了困难。对不起,我是这个新手.. xD

标签: jquery html css twitter-bootstrap


【解决方案1】:

我不确定,但您必须将 id 分配给覆盖您图片的 div 网格,然后使用 javascript/jQuery 运行一个随机更改每个 div 的不透明度和过滤器的函数。祝你好运。

【讨论】:

    【解决方案2】:

    它是barba.js 点击下面的链接:

    https://github.com/luruke/barba.js/

    您可以在上面的链接中找到很多过渡...

    【讨论】:

      猜你喜欢
      • 2015-06-15
      • 2011-10-24
      • 2011-10-16
      • 2018-08-24
      • 2012-12-01
      • 1970-01-01
      • 2014-01-08
      • 1970-01-01
      相关资源
      最近更新 更多