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. ASP.NET MVC IOC依赖注入之Autofac系列(一)- MVC当中应用

    话不多说,直入主题看我们的解决方案结构: 分别对上面的工程进行简单的说明: 1.TianYa.DotNetShare.Model:为demo的实体层 2.TianYa.DotNetShare.Repo ...

  2. SpringCloud(六):服务网关zuul-API网关(服务降级和过滤)

    什么是API网关: 在微服务架构中,通常会有多个服务提供者.设想一个电商系统,可能会有商品.订单.支付.用户等多个类型的服务,而每个类型的服务数量也会随着整个系统体量的增大也会随之增长和变更.作为UI ...

  3. Linux-打包压缩命令

    内容总结自<鸟哥的Linux私房菜>http://cn.linux.vbird.org/linux_basic/0240tarcompress.php 一.打包/压缩文件常见扩展名 *.g ...

  4. [日常] ubuntu下安装php pdo扩展和导入数据库

    默认安装的php不存在pdo扩展,因此在使用到的时候会报错,直接使用这个命令 apt-get install php-mysql 就可以成功安装pdo扩展 安装完数据库后需要导入sql语句,先进入数据 ...

  5. Error creating bean with name 'sqlSessionFactory' defined in class path resource [config/spring/applicationContext.xml]: Invocation of init method failed;

    我报的错: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSes ...

  6. May 26th, 2019. Week 22nd, Sunday

    A real loser is somebody that's so afraid of not winning, they don't even try. 真正的失败者,是那些因为害怕不能成功,就连 ...

  7. Python踩坑系列之使用redis报错:module 'redis' has no attribute 'Redis'问题

    初次使用redis时,在链接Redis后,运行报错“module 'redis' has no attribute 'Redis' ”. 具体代码如下: import redis r = redis. ...

  8. ​Linux环境下搭建禅道管理工具-包含软件资源

    ​Linux环境下搭建禅道管理工具 1:百度云盘下载: 禅道--链接: https://pan.baidu.com/s/1Stu7nOZVIPO5TnpJWjWtiQ 提取码:dnik CentOs操 ...

  9. Educational Codeforces Round 76 (Rated for Div. 2)

    传送门 A. Two Rival Students 签到. Code /* * Author: heyuhhh * Created Time: 2019/11/13 22:37:26 */ #incl ...

  10. 【转】关闭firefox火狐浏览器下载完成时自动扫描(49.0.2以后版本)

    用firefox火狐浏览器下载文件到最后时,会显示"剩余时间未知",将持续10秒钟左右,即使几KB 的文件,也要持续这么长时间,问度娘才知道是自动扫描,检查是否有毒,用的却是Goo ...