最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

CSS3学习之animation属性_html/css

来源:动视网 责编:小采 时间:2020-11-27 16:03:25
文档

CSS3学习之animation属性_html/css

CSS3学习之animation属性_html/css_WEB-ITnose:发现animation这个新属性很有趣,在此学习,并整理下! 浏览器支持: Internet Explorer 10、Firefox 以及 Opera 支持 animation 属性; Safari 和 Chrome 支持替代的 -webkit-animation 属性。 定义和用法 animation
推荐度:
导读CSS3学习之animation属性_html/css_WEB-ITnose:发现animation这个新属性很有趣,在此学习,并整理下! 浏览器支持: Internet Explorer 10、Firefox 以及 Opera 支持 animation 属性; Safari 和 Chrome 支持替代的 -webkit-animation 属性。 定义和用法 animation


发现animation这个新属性很有趣,在此学习,并整理下!

浏览器支持:

Internet Explorer 10、Firefox 以及 Opera 支持 animation 属性;

Safari 和 Chrome 支持替代的 -webkit-animation 属性。

定义和用法

animation 属性是一个简写属性,用于设置六个动画属性:

  • animation-name
  • animation-duration
  • animation-timing-function
  • animation-delay
  • animation-iteration-count
  • animation-direction
  • 语法

     animation: name duration timing-function delay iteration-count direction;
    值 描述
    animation-name 规定需要绑定到选择器的 keyframe 名称。
    animation-name: keyframename|none;
    animation-duration

    规定完成动画所花费的时间,以秒或毫秒计。

    animation-duration: time;
    animation-timing-function 规定动画的速度曲线。
    animation-timing-function: value;
    animation-delay

    规定在动画开始之前的延迟。

    animation-delay: time;
    animation-iteration-count 规定动画应该播放的次数。
    animation-iteration-count: n|infinite(无限次);
    animation-direction 规定是否应该轮流反向播放动画。
    animation-direction: normal(正常)|alternate(轮流反向播放);

    其中

    animation-timing-function 使用名为三次贝塞尔(Cubic Bezier)函数的数学函数,来生成速度曲线。您能够在该函数中使用自己的值,也可以预定义的值:

    值 描述
    linear 动画从头到尾的速度是相同的。
    ease 默认。动画以低速开始,然后加快,在结束前变慢。
    ease-in 动画以低速开始。
    ease-out 动画以低速结束。
    ease-in-out 动画以低速开始和结束。
    cubic-bezier(n,n,n,n) 在 cubic-bezier 函数中自己的值。可能的值是从 0 到 1 的数值。

    案例:

    很实际的,一个箭头循环上下跳动

    #auto{

    -webkit-animation:dd 1s infinite;
    animation:dd 1s infinite;

    }

    @keyframes dd{
    0% {transform:translate(0, 10px)}
    50% {transform:translate(0, 0)}
    100% {transform:translate(0, 10px)}
    }
    @-webkit-keyframes dd{
    0% {-webkit-transform:translate(0, 10px)}
    50% {-webkit-transform:translate(0, 0)}
    100% {-webkit-transform:translate(0, 10px)}
    }

    注释:animation 这个属性的使用必须结合@keyframes一起使用

    百分比的意思就是duration的百分比,如果没有设置duration的话,则表示为无穷大。

    transform:translate():含义--变动,位移;也是CSS3里面的新属性。

    文档

    CSS3学习之animation属性_html/css

    CSS3学习之animation属性_html/css_WEB-ITnose:发现animation这个新属性很有趣,在此学习,并整理下! 浏览器支持: Internet Explorer 10、Firefox 以及 Opera 支持 animation 属性; Safari 和 Chrome 支持替代的 -webkit-animation 属性。 定义和用法 animation
    推荐度:
    标签: 教程 动画 html
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top