The previous challenges covered how to use some of the animation properties and the @keyframes rule.

Another animation property is the animation-iteration-count, which allows you to control how many times you would like to loop through the animation.

Here's an example:

animation-iteration-count: 3;

In this case the animation will stop after running 3 times, but it's possible to make the animation run continuously by setting that value to infinite.

把次数改为无线infinite就一直动。

练习题目:

To keep the ball bouncing on the right on a continuous loop, change the animation-iteration-count property to infinite.

练习代码: (不需要全部写,填空进去)

 <style>

   #ball {
width: 100px;
height: 100px;
margin: 50px auto;
position: relative;
border-radius: 50%;
background: linear-gradient(
35deg,
#ccffff,
#ffcccc
);
animation-name: bounce;
animation-duration: 1s;
animation-iteration-count: infinite;
} @keyframes bounce{
0% {
top: 0px;
}
50% {
top: 249px;
width: 130px;
height: 70px;
}
100% {
top: 0px;
}
}
</style>
<div id="ball"></div>

效果:

在设置区域内,带一个好看背景色的小球,上下弹动,小球的大小会挤压又恢复,通过@keyframe设置的0%-100%的值实现的

FCC---Animate Elements Continually Using an Infinite Animation Count---设置animation-iteration-count的次数为无限,让小球一直跳动的更多相关文章

  1. Android中xml设置Animation动画效果详解

    在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现,一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...

  2. android中设置Animation 动画效果

    在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现,一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...

  3. Android 动画——Frame Animation与Tween Animation

    很多手机应用的引导页都是动画的,添加动画后的应用画面会更加生动灵活,今天博主也学习了Android中Animation的使用,下面来总结下.  android中的Animation分为两种,一种是Fr ...

  4. Uni2D 入门 -- Animation Clip 和 Animation API

    转载 csdn kakashi8841 http://blog.csdn.net/kakashi8841/article/details/17599505 Animation Clip 一个anima ...

  5. Android动画View Animation与Drawable Animation

    Animations 一.Animations介绍 Animations是一个实现android UI界面动画效果的API,Animations提供了一系列的动画效果,可以进行旋转.缩放.淡入淡出等, ...

  6. Animation.setFillAfter and Animation.setFillBefore的作用

    转:http://blog.csdn.net/yangweigbh/article/details/9788531 setFillAfter(boolean fillAfter)  在Android ...

  7. 转:在两个页面间翻转设置Animation动作的一些总结

    今天碰到两个页面之间翻转的动作设计问题,发现了一些问题,故做个总结,很多都写在注释部分: 1.首先,我们来手动创建两个view以及相应的viewController.是手动,不是用IB (1)刚开始只 ...

  8. 设置Animation 的播放位置

    AnimationState.normalizedTime 官方文档的描述 Description The normalized time of the animation. A value of 1 ...

  9. (手冊)Animation 之 使用Animation View

    观看游戏物体上的动画(Viewing Animations on a GameObject) Animation View 是与 Hierarchy View.Scene View和Inspector ...

随机推荐

  1. C#斐波那契数列求法(比较阶乘和循环所用时间)

    using System; namespace ConsoleApp3 { class Program { static void Main(string[] args) { Console.Writ ...

  2. Netty服务端Channel注册Selector及绑定服务器端口

    当服务端Channel 创建并且初始化完成之后,会将其注册到 selector,通过语句config().group().register(channel)进行注册工作,该方法最终调用 Abstrac ...

  3. ES6-Symbol的用法 ,symbol在对象中的应用,改变值

    ES6-Symbol的用法,,symbol在对象中的应用,改变值 let a = new String; let b = new Number; let c = new Boolean; let d ...

  4. 三大免费开源的php语言cms系统 用好它们让你一天建好一个网站

    php语言只所以在web开发领域占据半壁江山,是因为它有太多的生态,成熟的框架体系,广泛的开源cms系统.建设网站的时候,都想提升开发效率,效率就是成本,如果你用原生php语言开发一个项目,既要设计数 ...

  5. jeesite3环境部署时初始化数据库注意问题

    ---恢复内容开始--- 首先要修改jeesite.properties下数据库连接方式,注意选择自己的数据库 其次在pom.xml文件中修改对应的数据库连接方式 最后运行db文件夹下的init-db ...

  6. 高性能go服务之高效内存分配

    高性能go服务之高效内存分配 手动内存管理真的很坑爹(如C C++),好在我们有强大的自动化系统能够管理内存分配和生命周期,从而解放我们的双手. 但是呢,如果你想通过调整JVM垃圾回收器参数或者是优化 ...

  7. Linux—vi/vim命令详解

    如何在 vi 里搜索关键字 在命令模式下敲斜杆( / )这时在状态栏(也就是屏幕左下脚)就出现了 "/" 然后输入你要查找的关键字敲回车就行了. 如果你要继续查找此关键字,敲字符 ...

  8. Quasar framework 配置vue apollo

    Quasar 整合 vue-apollo 确保你已经知道quasar 和 vue apollo 在quasar中使用vue apollo客户端时出现的一点小问题 在quasar项目中使用vue-apo ...

  9. 003 C/C++ 数据类型_数组

    #include "stdio.h" #include "stdlib.h" //数据类型的本质: 固定大小内存块的别名. void main() { int ...

  10. go语言设计模式之proxy

    代理模式,单元测试用例真的写得详细, 受教~ proxy.go package proxy import ( //"errors" "fmt" ) type U ...