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. PHP简单判断当前使用的是什么浏览器

    PHP简单判断当前使用的是什么浏览器,判断浏览器类型的方法,方便统计网站访问用户使用浏览器的比例. 判断浏览器类型方法 function userBrowser() { $user_OSagent = ...

  2. Java分布式系统---消息中间件

    简介 消息中间件也可以称消息队列,是指用高效可靠的消息传递机制进行与平台无关的数据交流,并基于数据通信来进行分布式系统的集成.通过提供消息传递和消息队列模型,可以在分布式环境下扩展进程的通信.当下主流 ...

  3. SpringBoot+MyBatisPlus整合时提示:Invalid bound statement(not found):**.dao.UserDao.queryById

    场景 在使用SpringBoot+MyBatisPlus搭建后台启动项目时,使用EasyCode自动生成代码. 在访问后台接口时提示: Invilid bound statement (not fou ...

  4. flutter 侧滑删除+侧滑显示删除按钮

    1.侧滑删除 1.1.Dismissible组件 2.侧滑显示删除按钮 2.1.手势监听水平滑动 ------------------------------------分割线------------ ...

  5. Cesium专栏-绕点飞行效果(附源码下载)

    Cesium Cesium 是一款面向三维地球和地图的,世界级的JavaScript开源产品.它提供了基于JavaScript语言的开发包,方便用户快速搭建一款零插件的虚拟地球Web应用,并在性能,精 ...

  6. 基于 Storyboard 多种方式的页面跳转、参数传递

    原文 通过按钮关联跳转 选中 Button ,然后点击 action 右边拖拽到 第二个页面 选择 "Show"即可完成跳转关联. 定义页面间 segue Id,通过代码触发跳转 ...

  7. 【二】Gradle中的gradlew

    gradle 相当于 gradle wapper,是gradle的包装命令 使用gradlew来构建项目被认为是最佳实践. 使用gradlew有以下好处: 当客户机上没有安装gradle时,可以直接用 ...

  8. Linux:nginx服务器的搭建

    搭建nginx网站服务器 安装nginx yum install nginx 启动服务 安装完成后启动服务 systemctl start nginx 通过浏览器测试 地址栏输入localhost 不 ...

  9. 201871010135 张玉晶 《面向对象程序设计(java)》 第一周学习总结

    项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/wyt0455820/ ...

  10. 一天两道PAT(2)1005,1006

    今天的pat1006没什么好说的.就记录一下1005的状况.先上题目. 卡拉兹(Callatz)猜想已经在1001中给出了描述.在这个题目里,情况稍微有些复杂. 当我们验证卡拉兹猜想的时候,为了避免重 ...