CSS3下Animations动画库示例

 更新时间:2016年10月2日 16:18  点击:1455
Animations可以用来做动画效果了我们在 里来看一篇CSS3下Animations动画库示例总结,希望下面文章对各位朋友会带来帮助。


一、CSS3动画库 Animatable

什么是css3动画?

通过 CSS3,我们能够创建动画,这可以在许多网页中取代动画图片、Flash 动画以及 JavaScript。

CSS3带来了圆角,半透明,阴影,渐变,多背景图等新的特征,轻松实现了设计稿中常见的图层样式,用简洁的代码替代图片,代替了多余的空标签。

现成的CSS3动画库: http://leaverou.github.io/animatable/

background-color

.background-color { background:#708090; animation:1s ease 0s alternate none infinite background-color;}
@keyframes background-color{
    from{ background:#708090;}
    to{ background:#000;}
}
1

background-position

background-position 属性设置背景图像的起始位置,默认值:0% 0%,效果等同于left top

范例一:

.background-position-1 { background-image: -moz-linear-gradient(-45deg, transparent 25%, black 25%, black 50%, transparent 50%, transparent 75%, black 75%, black); background-size:50px 50px; animation:1s ease 0s alternate none infinite background-position-1;}
@keyframes background-position-1{
  from{ background-position:0 0;}
  to{ background-position:100% 100%;}
}
1

范例二:

.background-position-2 { background-color: #E04332; background-repeat: repeat-x; background-size: 24px 300px; background-image: linear-gradient(-45deg, slategray 25%, transparent 25%), linear-gradient(45deg, transparent 75%, slategray 75%), linear-gradient(45deg, slategray 25%, transparent 25%), linear-gradient(-45deg, transparent 75%, slategray 75%); animation:1s ease 0s alternate none infinite background-position-2;}
@keyframes background-position-2{
  from{ background-position:3px 0, 3px 0, 15px -150px, 15px -150px;}
  to{ background-position:3px -70px, 3px -70px, 15px -80px, 15px -80px;}
}
1

background-size

background-size 属性规定背景图片的尺寸。在 CSS3 之前,背景图片的尺寸是由图片的实际尺寸决定的。在CSS3中,可以规定背景图片的尺寸,这就允许我们在不同的环境中重复使用背景图片。

.background-size {background-image: repeating-radial-gradient(transparent, transparent 9px, black 11px, black 20px); background-position:center; animation:1s ease 0s alternate none infinite background-size;}
@keyframes background-size{
    from{ background-size:5px 5px;}
    to{ background-size:150px 150px;}
}
1

border-radius

border-radius 属性是一个简写属性,用于设置四个 border-*-radius 属性。

范例一

.border-radius-1 { animation:1s ease 0s alternate none infinite border-radius-1;}
@keyframes border-radius-1{
  from{ border-radius:0;}
  to{ border-radius:50%;}
}
1

范例二

.border-radius-2 { animation:1s ease 0s alternate none infinite border-radius-2;}
@keyframes border-radius-2{
  from{ border-radius:0 100%;}
  to{ border-radius:100% 0;}
}
1

border-width

范例一

.border-width-1 {border-style:solid; border-color: black; animation:1s ease 0s alternate none infinite border-width-1;}
@keyframes border-width-1{
    from{ border-width:0;}
    to{ border-width:75px;}
}
1

范例二

.border-width-2 {border-style:dashed; border-color: black; animation:1s ease 0s alternate none infinite border-width-2;}
@keyframes border-width-2{
    from{ border-width:0;}
    to{ border-width:35px;}
}
1

范例三

.border-width-3 {border-style:double; border-color: black; animation:1s ease 0s alternate none infinite border-width-3;}
@keyframes border-width-3{
    from{ border-width:0;}
    to{ border-width:75px;}
}
1

box-shadow

box-shadow 属性向框添加一个或多个阴影

范例一

.box-shadow-1 { animation:1s ease 0s alternate none infinite box-shadow-1;}
@keyframes box-shadow-1{
    from{ box-shadow:0 0 black;}
    to{ box-shadow:0 150px 10px -50px rgba(0,0,0,.5);}
}
1

范例二

.box-shadow-2 { animation:1s ease 0s alternate none infinite box-shadow-2;}
@keyframes box-shadow-2{
    from{ box-shadow:none;}
    to{ box-shadow:inset -75px -75px 400px #000;}
}
1

范例三

.box-shadow-3 { box-radius: 1px; animation:1s ease 0s alternate none infinite box-shadow-3;}
@keyframes box-shadow-3{
    from{ box-shadow:inset 0 0 75px 75px slategray, 0 0 0 slategray;}
    to{ box-shadow:inset 0 0 35px 35px transparent, 0 0 75px 50px transparent;}
}
1

color

CSS3 Color属性在传统的hex和RGB值中增加了HSL特性,也就是增加了Opacity(透明度)和Alpha channels

.color { animation:1s ease 0s alternate none infinite color;}
@keyframes color{
    from{ color:white;}
    to{ color:black;}
}
1

font-size

.font-size { animation:1s ease 0s alternate none infinite font-size;}
@keyframes font-size{
    from{ font-size:60px;}
    to{ font-size:300px;}
}
1

width

.width { animation:1s ease 0s alternate none infinite width;}
@keyframes width{
    from{ width:150px;}
    to{ width:330px;}
}
1

height

.height { animation:1s ease 0s alternate none infinite height;}
@keyframes height{
    from{ height:150px;}
    to{ height:0;}
}
1

letter-spacing

.letter-spacing { animation:1s ease 0s alternate none infinite letter-spacing;}
@keyframes letter-spacing{
    from{ letter-spacing:0;}
    to{ letter-spacing:100px;}
}
1

line-height

.line-height { animation:1s ease 0s alternate none infinite line-height;}
@keyframes line-height{
    from{ line-height:10px;}
    to{ line-height:300px;}
}
1

opacity

.opacity { animation:1s ease 0s alternate none infinite opacity;}
@keyframes opacity{
    from{ opacity:1;}
    to{ opacity:0;}
}
1

outline-width

.outline-width { outline-color:black; outline-style: solid; animation:1s ease 0s alternate none infinite outline-width;}
@keyframes outline-width{
    from{ outline-width:0;}
    to{ outline-width:100px;}
}
1

outline-offset

.outline-offset { outline-style: dashed; outline-color:slategray; animation:1s ease 0s alternate none infinite outline-offset;}
@keyframes outline-offset{
    from{ outline-offset:-5px;}
    to{ outline-offset:30px;}
}
1

outline-color

.outline-color { outline-width: 30px; outline-style: solid; animation:1s ease 0s alternate none infinite outline-color;}
@keyframes outline-color{
    from{ outline-color:transparent;}
    to{ outline-color:red;}
}
1

padding

.padding { animation:1s ease 0s alternate none infinite padding;}
@keyframes padding{
    from{ padding:0;}
    to{ padding:0 200px 0 50px;}
}
1

text-indent

.text-indent { animation:1s ease 0s alternate none infinite text-indent;}
@keyframes text-indent{
    from{ text-indent:0;}
    to{ text-indent:100px;}
}
1

text-shadow

范例一

.text-shadow-1 { animation:1s ease 0s alternate none infinite text-shadow-1;}
@keyframes text-shadow-1{
    from{ text-shadow:0 0 black;}
    to{ text-shadow:20px 20px 10px rgba(0,0,0,.5);}
}
1

范例二

.text-shadow-2 { color: transparent; animation:1s ease 0s alternate none infinite text-shadow-2;}
@keyframes text-shadow-2{
    from{ text-shadow:0 0 0 white;}
    to{ text-shadow:0 0 10px white;}
}
1

范例三

.text-shadow-3 { color: transparent; animation:1s ease 0s alternate none infinite text-shadow-3;}
@keyframes text-shadow-3{
    from{ text-shadow:0 0 white;}
    to{ text-shadow:0 0 rgba(255,255,255,0), -45px -45px 0 red, -30px -30px 0 orange, -15px -15px 0 yellow, 0 0 0 green, 15px 15px 0 blue, 30px 30px 0 indigo, 45px 45px 0 violet;}
}
1

top

.top { position:relative; animation:1s ease 0s alternate none infinite top;}
@keyframes top{
    from{ top:0;}
    to{ top:100px;}
}
1

transform

范例一

.transform-1 { animation:1s ease 0s alternate none infinite transform-1;}
@keyframes transform-1{
    from{ transform:rotate(0deg);}
    to{ transform:rotate(360deg);}
}
1

范例二

.transform-2 { animation:1s ease 0s alternate none infinite transform-2;}
@keyframes transform-2{
    from{ transform:scale(1);}
    to{ transform:scale(2);}
}
1

范例三

.transform-3 { animation:1s ease 0s alternate none infinite transform-3;}
@keyframes transform-3{
    from{ transform:skew(0);}
    to{ transform:skew(180deg);}
}
1

范例四

.transform-4 { animation:1s ease 0s alternate none infinite transform-4;}
@keyframes transform-4{
    from{ transform:rotate(0) scale(1);}
    to{ transform:rotate(360deg) scale(0);}
}
1

范例五

.transform-5 { animation:1s ease 0s alternate none infinite transform-5;}
@keyframes transform-5{
    from{ transform:perspective(400px) rotateY(0);}
    to{ transform:perspective(400px) rotateY(360deg);}
}
1

范例六

.transform-6 { animation:1s ease 0s alternate none infinite transform-6;}
@keyframes transform-6{
    from{ transform:perspective(400px) rotateX(0);}
    to{ transform:perspective(400px) rotateX(360deg);}
}
1

范例七

.transform-7 { animation:1s ease 0s alternate none infinite transform-7;}
@keyframes transform-7{
    from{ transform:perspective(400px) rotateY(0);}
    to{ transform:perspective(400px) translateZ(150px) rotateY(180deg);}
}
1

范例八

.transform-8 { animation:1s ease 0s alternate none infinite transform-8;}
@keyframes transform-8{
    from{ transform:perspective(400px) translate3d(0,0,0) rotateX(0) rotateY(0) rotateZ(0);}
    to{ transform:perspective(400px) translate3d(0,0,-5000px) rotateX(720deg) rotateY(360deg) rotateZ(-360deg);}
}
1

范例九

.transform-9 { animation:1s ease 0s alternate none infinite transform-9;}
@keyframes transform-9{
    from{ transform:perspective(400px) rotate3d(.5,.5,0,0deg);}
    to{ transform:perspective(400px) rotate3d(.5,.5,0,180deg);}
}
1

范例十

.transform-10 {transform-origin: 100% 50%; animation:1s ease 0s alternate none infinite transform-10;}
@keyframes transform-10{
    from{ transform:perspective(400px) rotate3d(0,1,0,0deg);}
    to{ transform:perspective(400px) rotate3d(0,1,0,-180deg);}
}
1

范例十一

.transform-origin {transform:rotate(45deg); animation:1s ease 0s alternate none infinite transform-origin;}
@keyframes transform-origin{
    from{ transform-origin:50% 50%;}
    to{ transform-origin:0 100%;}
}

[!--infotagslink--]

相关文章

  • ps动态环绕动画效果怎么制作

    ps动态环绕动画效果是现在很多人都非常喜欢的,大多数人还不知道ps动态环绕动画效果怎么制作下面文章就给大家介绍下ps怎么制作科技感十足的动态环绕动画效果,一起来看看...2017-07-06
  • jQuery动画效果相关方法实例分析

    这篇文章主要介绍了jQuery动画效果相关方法,结合实例形式较为详细的分析了jQuery实现动画效果所用到的常见方法与相关注意事项,需要的朋友可以参考下...2016-01-05
  • 详解vue过度效果与动画transition使用示例

    Vue 在插入、更新或者移除 DOM 时,提供多种不同方式的应用过渡效果,Vue 提供了内置的过渡封装组件transition,该组件用于包裹要实现过渡效果的组件...2021-10-10
  • 微信小程序实现登录页云层漂浮的动画效果

    微信小程序目前的火热程度相信不用多言,最近利用空余时间用小程序实现了个动态的登录页效果,所以下面这篇文章主要给大家介绍了利用微信小程序实现登录页云层漂浮动画效果的相关资料,需要的朋友可以参考借鉴,下面来一起看看吧。...2017-05-09
  • 利用PS制作“签名”GIF小动画的例子

    本文章来为各位介绍一篇利用PS制作“签名”GIF小动画的例子,希望这个制作过程能够帮助到各位朋友,各位进入看看吧。 先给大家看下效果,有兴趣的童鞋→_→可以...2016-09-14
  • 公众号SVG动画交互实战代码

    这篇文章主要介绍了公众号SVG动画交互实战代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-06-01
  • js实现缓动动画

    这篇文章主要为大家详细介绍了js实现缓动动画,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2020-11-25
  • javascript+css3 实现动态按钮菜单特效

    这篇文章主要介绍了javascript+css3 实现动态按钮菜单特效的相关资料,需要的朋友可以参考下...2016-02-12
  • jQuery实现的给图片点赞+1动画效果(附在线演示及demo源码下载)

    这篇文章主要介绍了jQuery实现的给图片点赞+1动画效果,并附带在线演示及demo源码下载,涉及jQuery鼠标事件响应及页面元素属性动态操作相关技巧,需要的朋友可以参考下...2016-01-05
  • JS实现点击登录弹出窗口同时背景色渐变动画效果

    这篇文章主要介绍了JS实现点击登录弹出窗口同时背景色渐变动画效果,涉及JavaScript基于鼠标事件及时间函数定时触发形成渐变动画的相关技巧,需要的朋友可以参考下...2016-03-28
  • jquery+css3实现会动的小圆圈效果

    这篇文章主要介绍了jquery+css3实现会动的小圆圈效果,涉及jquery基于时间函数动态操作页面元素css3样式的相关技巧,需要的朋友可以参考下...2016-01-29
  • Photoshop利用智能对象将人物制作成花海里飘散消失的GIF动画教程

    今天小编在这里就来给Photoshop的这一款软件的使用者们来说一说利用智能对象将人物制作成花海里飘散消失的GIF动画的教程,各位想知道具体方法的使用者们,那么大家就快来...2016-09-14
  • three.js 实现露珠滴落动画效果的示例代码

    这篇文章主要介绍了three.js 实现露珠滴落动画效果的示例代码,非常不错,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-03-01
  • jQuery实现的点赞随机数字显示动画效果(附在线演示与demo源码下载)

    这篇文章主要介绍了jQuery实现的点赞随机数字显示动画效果,并附带在线演示与demo源码供读者下载.涉及jQuery鼠标事件响应及基于animate动画效果实现技巧,需要的朋友可以参考下...2016-01-05
  • SwiftUI 中创建反弹动画的实现

    这篇文章主要介绍了SwiftUI 中创建反弹动画的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-10-30
  • 详解CSS3中nth-child与nth-of-type的区别

    这篇文章详细解析了CSS3中nth-child与nth-of-type的区别,有兴趣的同学可以参考一下 CSS3中nth-child与nth-of-type的区别其实很简单::nth-of-type为什么要叫:nth-of...2017-01-22
  • AngularJS中实现显示或隐藏动画效果的方式总结

    AngularJS 是一组用于创建单页Web应用的丰富框架,给构建丰富交互地应用带来了所有功能,其中一项主要的特性是Angular对动画的支持。下面通过本文给大家介绍AngularJS中实现显示或隐藏动画效果的方式总结,对angularjs动画效果相关知识感兴趣的朋友一起学习...2016-01-05
  • Android Studio实现帧动画

    这篇文章主要为大家详细介绍了Android Studio实现帧动画,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-11-14
  • 基于jQuery和CSS3制作响应式水平时间轴附源码下载

    我们经常看到有很多的垂直时间轴用来记录事件进展,而有朋友问我要求分享水平的时间轴,其实水平时间轴的难点在于自适应屏幕尺寸。那么 今天我要给大家分享的是一款支持响应式、支持触屏手势滑动的水平时间轴...2015-12-21
  • Android动画背景图自动播放的实现程序

    Android动画背景图自动播放的实现程序,我们在开发android应用的时候,经常会遇到类似从网络加载大图,在加载的过程中,在图片要显示的ImageView位置,先显示一个转圈的loadin...2016-09-20