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.

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

  1. <style>
  2.  
  3. #ball {
  4. width: 100px;
  5. height: 100px;
  6. margin: 50px auto;
  7. position: relative;
  8. border-radius: 50%;
  9. background: linear-gradient(
  10. 35deg,
  11. #ccffff,
  12. #ffcccc
  13. );
  14. animation-name: bounce;
  15. animation-duration: 1s;
  16. animation-iteration-count: infinite;
  17. }
  18.  
  19. @keyframes bounce{
  20. 0% {
  21. top: 0px;
  22. }
  23. 50% {
  24. top: 249px;
  25. width: 130px;
  26. height: 70px;
  27. }
  28. 100% {
  29. top: 0px;
  30. }
  31. }
  32. </style>
  33. <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. Mysql - 开发技巧(二)

    本文中的涉及到的表在https://github.com/YangBaohust/my_sql中 本文衔接Mysql - 巧用join来优化sql(https://www.cnblogs.com/dd ...

  2. 创建线程之三:实现Callable接口

    通过Callable和Future创建线程 i. 创建Callable接口的实现类,并实现call方法,该call方法将作为线程执行体,并且有返回值,可以抛出异常. ii. 创建Callable实现类 ...

  3. css知识笔记:垂直居中(别只看,请实操!!!)

    css实现元素的垂直居中. (尝试采用5W2H方法说明): 别只看,请实操!!! What: 1.这篇文档主要描述元素水平方向居中的几种最常见和最实用的几种方式,并说明优缺点. 2.写这篇文章的目的, ...

  4. html-css___table属性(设置细线边框)

    border-collapse 属性设置表格的边框是否被合并为一个单一的边框 //设置table实线边框 table,td{ /*边框合并*/ border-collapse: collapse; b ...

  5. 从零开始的SpringBoot项目搭建

    前言 今天是我加入博客园的第一天今天刚好学习到SpringBoot,就顺便记录一下吧 一.创建项目 1.创建工程 ① 通过File > New > Project,新建工程,选择Sprin ...

  6. php number_format金钱 价格 格式处理 由分单位转换成元(保留2为小数)

    /** * priceFormat * 价格格式处理 * * @access public * @param null * @since 1.0 * @return object */ if(!fun ...

  7. Prometheus Grafana快速搭建

    Prometheus Prometheus和Grafana组合基本上是监控系统的标配.Prometheus做存储后端,Grafana做分析及可视化界面. 普罗米修斯是开源的系统监控/报警工具库,功能非 ...

  8. 工作日志,go get -v -x github.com/pebbe/zmq4 失败问题

    工作日志,go get -v -x github.com/pebbe/zmq4 失败问题 笔者因为工作需要使用ZeroMQ,但是在执行go get -v -x github.com/pebbe/zmq ...

  9. 如何使用 TRANSPORTABLE = ALWAYS 将PDB移回Non-CDB (Doc ID 2027352.1)

    How to Move a PDB Back to a Non-CDB Using TRANSPORTABLE=ALWAYS (Doc ID 2027352.1) APPLIES TO: Oracle ...

  10. SQL注入:HEAD注入

    HEAD注入原理 HEAD注入顾名思义就是在传参的时候,将我们的数据构建在http头部. HEAD注入的使用场景 为什么网站要记录你的ip或者请求头,是为了方便你的二次登陆,区分你的登陆地址和设备,可 ...