There are a variety of ways to alter the animation rates of similarly animated elements.

So far, this has been achieved by applying an animation-iteration-count property and setting @keyframes rules.

To illustrate, the animation on the right consists of two "stars" that each decrease in size and opacity at the 20% mark in the @keyframes rule, which creates the twinkle animation.

You can change the @keyframes rule for one of the elements so the stars twinkle at different rates.

练习题目:

Alter the animation rate for the element with the class name of star-1 by changing its @keyframes rule to 50%.

练习代码:

 <style>
.stars {
background-color: white;
height: 30px;
width: 30px;
border-radius: 50%;
animation-iteration-count: infinite;
} .star-1 {
margin-top: 15%;
margin-left: 60%;
animation-name: twinkle-1;
animation-duration: 1s;
} .star-2 {
margin-top: 25%;
margin-left: 25%;
animation-name: twinkle-2;
animation-duration: 1s;
} @keyframes twinkle-1 {
50% {
transform: scale(0.5);
opacity: 0.5;
}
} @keyframes twinkle-2 {
20% {
transform: scale(0.5);
opacity: 0.5;
}
} #back {
position: fixed;
padding:;
margin:;
top:;
left:;
width: 100%;
height: 100%;
background: linear-gradient(black, #000099, #66c2ff, #ffcccc, #ffeee6);
}
</style> <div id="back"></div>
<div class="star-1 stars"></div>
<div class="star-2 stars"></div>

效果如下:

FCC---Animate Elements at Variable Rates----一闪一闪亮晶晶,不同的闪动节奏的更多相关文章

  1. Openjudge-计算概论(A)-晶晶赴约会

    描述 晶晶的朋友贝贝约晶晶下周一起去看展览,但晶晶每周的1.3.5有课必须上课,请帮晶晶判断她能否接受贝贝的邀请,如果能输出YES:如果不能则输出NO. 输入输入有一行,贝贝邀请晶晶去看展览的日期,用 ...

  2. 2718:晶晶赴约会-poj

    总时间限制:  1000ms 内存限制:  65536kB 描述 晶晶的朋友贝贝约晶晶下周一起去看展览,但晶晶每周的1.3.5有课必须上课,请帮晶晶判断她能否接受贝贝的邀请,如果能输出YES:如果不能 ...

  3. 计算概论(A)/基础编程练习1(8题)/3:晶晶赴约会

    #include<stdio.h> int main() { int w; scanf("%d", &w); || w==) { printf("%s ...

  4. LuoguB2045 晶晶赴约会 题解

    Content 贝贝邀请晶晶下个星期 \(x\)(如果 \(x=7\) 表示星期日)一起去看展览,但是晶晶下个星期 \(1,3,5\) 都有课.请你判断晶晶能否同意贝贝的请求. 数据范围:\(x\in ...

  5. FCC---Animate Multiple Elements at Variable Rates---还可以改循环时间,达到不同律动频率的效果

    In the previous challenge, you changed the animation rates for two similarly animated elements by al ...

  6. (NO.00004)iOS实现打砖块游戏(十一):"一闪一闪亮晶晶,我们都是小星星"

    大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 如果觉得写的不好请告诉我,如果觉得不错请多多支持点赞.谢谢! hopy ;) 现在一个基本的游戏逻辑已经搭建好了,但是感觉还是缺点什么呢? 蠢 ...

  7. 2.HTML+CSS制作一闪一闪亮晶晶的星星(stars)

    效果地址:https://codepen.io/flyingliao/pen/NJxbdB?editors=1100 HTML code: <div class="stars" ...

  8. ios--计时器演示样例:一闪一闪亮晶晶(动画)

    本演示样例实现的动画:UIView定时消失随后又闪现,即一闪一闪的动画 所採用的技术:定时器(NSTimer) + 动画(beginAnimations/commitAnimations) 详细实现步 ...

  9. SVG 动画(animate、animateTransform、animateMotion)

    原文:https://blog.csdn.net/chy555chy/article/details/53535581 参考 MDN开发文档 https://developer.mozilla.org ...

随机推荐

  1. SpringBoot2.0 整合 ElasticSearch框架,实现高性能搜索引擎

    本文源码:GitHub·点这里 || GitEE·点这里 一.安装和简介 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful ...

  2. 【nodejs原理&源码赏析(5)】net模块与通讯的实现

    目录 一. net模块简介 二. Client-Server的通讯 2.1 server的建立 2.2 Socket的建立 三. IPC通讯 四. 撸一个简易的cluster通讯模型 示例代码托管在: ...

  3. TypeScript 装饰器的执行原理

    装饰器本质上提供了对被装饰对象 Property​ Descriptor 的操作,在运行时被调用. 因为对于同一对象来说,可同时运用多个装饰器,然后装饰器中又可对被装饰对象进行任意的修改甚至是替换掉实 ...

  4. 【C#】学习笔记 Linq相关

    Language-Integrated Query(语言集成查询) 写了个demo,具体看

  5. 父子间的通信,以及ref

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  6. IDEA 运行后乱码问题解决

    页面乱码: 在edit configurations->vm options 添加 -Dfile.encoding=UTF-8 调整idea文件编码格式,全部为 UTF-8 (file -> ...

  7. 网络编程~~~ socket(套字节)

    一 socket (套接字) socket处于应用层与传输层之间,提供了一些简单的接口,避免与操作系统之间的对接,省去了相当繁琐复杂的操作. socket在python中属于一个模块,通过调用模块中已 ...

  8. axel 多线程下载工具

    yum install axel-2.4-9.el7.x86_64 -y # 选项 --max-speed=x , -s x 最高速度x --num-connections=x , -n x 连接数x ...

  9. IT宝塔安装,Centos系统

    宝塔安装地址:https://www.bt.cn/btcode.html 本文链接地址:https://www.cnblogs.com/wannengachao/p/12036716.html 版权声 ...

  10. jmeter使用问题——数据库无法连接

    使用Jmeter 数据库连接配置组件,执行sql时jmeter日志报错 WARN o.a.j.p.j.p.AbstractJDBCProcessor: SQL Problem in 查询账号申诉ID: ...