zoukankan      html  css  js  c++  java
  • FCC---Animate Multiple Elements at Variable Rates---还可以改循环时间,达到不同律动频率的效果

    In the previous challenge, you changed the animation rates for two similarly animated elements by altering their @keyframes rules.

    You can achieve the same goal by manipulating the animation-duration of multiple elements.

    In the animation running in the code editor, there are three "stars" in the sky that twinkle at the same rate on a continuous loop.

    To make them twinkle at different rates, you can set the animation-duration property to different values for each element.

    练习题目:

    In the previous challenge, you changed the animation rates for two similarly animated elements by altering their @keyframes rules.

    You can achieve the same goal by manipulating the animation-duration of multiple elements.

    In the animation running in the code editor, there are three "stars" in the sky that twinkle at the same rate on a continuous loop. To make them twinkle at different rates, you can set the animation-duration property to different values for each element.

    练习代码:

     1 <style>
     2   .stars {
     3     background-color: white;
     4     height: 30px;
     5     width: 30px;
     6     border-radius: 50%;
     7     animation-iteration-count: infinite;
     8   }
     9 
    10   .star-1 {
    11     margin-top: 15%;
    12     margin-left: 60%;
    13     animation-duration: 1s;
    14     animation-name: twinkle;
    15   }
    16 
    17   .star-2 {
    18     margin-top: 25%;
    19     margin-left: 25%;
    20     animation-duration: 0.9s;
    21     animation-name: twinkle;
    22   }
    23 
    24   .star-3 {
    25     margin-top: 10%;
    26     margin-left: 50%;
    27     animation-duration: 1.1s;
    28     animation-name: twinkle;
    29   }
    30 
    31   @keyframes twinkle {
    32     20% {
    33       transform: scale(0.5);
    34       opacity: 0.5;
    35     }
    36   }
    37 
    38   #back {
    39     position: fixed;
    40     padding: 0;
    41     margin: 0;
    42     top: 0;
    43     left: 0;
    44     width: 100%;
    45     height: 100%;
    46     background: linear-gradient(black, #000099, #66c2ff, #ffcccc, #ffeee6);
    47   }
    48 </style>
    49 
    50 <div id="back"></div>
    51 <div class="star-1 stars"></div>
    52 <div class="star-2 stars"></div>
    53 <div class="star-3 stars"></div>

    效果如下:

  • 相关阅读:
    hdu 1272
    BZOJ_3685_普通van Emde Boas树_权值线段树
    BZOJ_3831_[Poi2014]Little Bird_单调队列优化DP
    BZOJ_3252_攻略_线段树+dfs序
    BZOJ_4653_[Noi2016]区间_线段树+离散化+双指针
    BZOJ_3210_花神的浇花集会_切比雪夫距离
    BZOJ_2124_等差子序列_线段树+Hash
    BZOJ_2212_[Poi2011]Tree Rotations_线段树合并
    BZOJ_1826_[JSOI2010]缓存交换 _线段树+贪心
    BZOJ_4325_NOIP2015 斗地主_DFS
  • 原文地址:https://www.cnblogs.com/jane-panyiyun/p/11756928.html
Copyright © 2011-2022 走看看