公益html网页,【HTML5校企公益课】第三天

2D动画

/*根据id获取 选择器 #id名,根据class名 .class名*/.classA{

/*设置宽高*/width:20px;height:20px;

/*设置颜色*/background-color:black;

/*设置形状*/border-radius:50%;

/*position*/position:absolute;

/*运算符号两边一定要有空格*/left:calc(50% - 10px);top:calc(50% - 10px);

/*设置动画*/animation:changeColor 3s infinite linear reverse;

}

/*转动的圆*/.classB{

/*设置宽高*/width:100px;height:100px;

/*设置颜色*/background-color:black;

/*设置形状*/

/*border-radius: 50%;*/

/*position*/position:absolute;left:calc(50% - 50px + 100px);top:calc(50% - 50px + 100px);

/*设置动画*/

/*动画名称 必要的*/animation-name:xuanzhuan, changeColor;

/*设置动画时间 必要的。*/animation-duration:5s;

/*设置动画次数 inifinaite 匀速*/animation-iteration-count:infinite;

/*设置速率 linear 匀速*/animation-timing-function:linear;

/*设置动画的方向*/animation-direction:reverse;

/*将上面的动画属性合并为以下写法,仅适用于单个动画,多个动画的设置只能分开写

animation: xuanzhuan 3s infinite linear reverse;

animation: changeColor 0.25s infinite linear reverse;

/*设置旋转中心,默认是自转*/transform-origin:-50px -50px;

}

/*设置动画*/@keyframes xuanzhuan{

/*设置初始状态*/0%{/*转换 transform*/transform:rotate(0deg) scale(1);

}

/*设置结束状态 scale缩放 translate平移 倾斜 skew*/50%{transform:rotate(180deg) scale(2);

}100%{transform:rotate(360deg) scale(1);

}}

@keyframes changeColor{0%{

background-color:white;

}10%{background-color:aliceblue;

}20%{background-color:bisque;

}30%{background-color:white;

}40%{background-color:white;

}50%{background-color:#FF0000;

}60%{background-color:white;

}70%{background-color:#FF0000;

}80%{background-color:aquamarine;

}90%{background-color:blue;

}100%{background-color:red;

}}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值