如何利用css3实现光点随着指定位置跑,下面web建站小编给大家简单介绍一下具体实现代码!
1、画一个正方形(在正方形跑圈)
<div class="box run">光点跑动~</div>
2、css3代码
.box {
height: 500px;
width: 400px;
box-shadow: 0 0 2px orange;
text-align: center;
line-height: 260px;
}
.run {
background-image: linear-gradient(90deg, rgba(196, 233, 64, 0) 0%, rgb(62, 224, 84) 100%), linear-gradient(0deg, rgb(62, 224, 84) 0%, rgba(196, 233, 64, 0) 100%), linear-gradient(-90deg, rgba(196, 233, 64, 0) 0%, rgb(62, 224, 84) 100%), linear-gradient(0deg, rgba(196, 233, 64, 0) 0%, rgb(62, 224, 84) 100%);
background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
background-size: 100px 4px, 4px 100px, 100px 4px, 4px 100px;
background-position: -100px 1px, calc(100% - 1px) -100px, calc(100% + 100px) calc(100% - 1px), 1px 0px;
animation: moveLine 8s infinite linear;
height: calc(100% - 2px);
padding: 1px;
background-clip: content-box;
}
@keyframes moveLine {
0% {
background-position: -100px 1px, calc(100% - 1px) -100px, calc(100% + 100px) calc(100% - 1px), 1px 0px;
}
5% {
background-position: 0px 1px, calc(100% - 1px) -100px, calc(100% + 100px) calc(100% - 1px), 1px -100px;
}
30% {
background-position: 100% 1px, calc(100% - 1px) -100px, calc(100% + 100px) calc(100% - 1px), 1px -100px;
}
35% {
background-position: calc(100% + 100px) 1px, calc(100% - 1px) 0px, calc(100% + 100px) calc(100% - 1px), 1px -100px;
}
50% {
background-position: calc(100% + 100px) 1px, calc(100% - 1px) 100%, calc(100% + 100px) calc(100% - 1px), -100px -100px;
}
55% {
background-position: calc(100% + 100px) 1px, calc(100% - 1px) calc(100% + 100px), 100% calc(100% - 1px), -100px calc(100% + 100px);
}
80% {
background-position: calc(100% + 100px) 1px, calc(100% - 1px) calc(100% + 100px), 0px calc(100% - 1px), 1px calc(100% + 100px);
}
85% {
background-position: calc(100% + 100px) 1px, calc(100% - 1px) calc(100% + 100px), -100px calc(100% - 1px), 1px 100%;
}
100% {
background-position: calc(100% + 100px) 1px, calc(100% - 1px) calc(100% + 100px), -100px calc(100% - 1px), 1px 0px;
}
}
上面是“css3如何实现光点随着指定位置跑”的全面内容,想了解更多关于 前端知识 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_3506.html
workflows工作流
一只张大嘴巴露出锋利的牙齿正在咆哮的雪豹
梦幻中的一只猫咪ComfyUI工作流
一条闪闪发光的金鱼ComfyUI工作流
一棵树从鸟笼里长出来的梦幻般场景
一个全脸彩绘和纹身的超级名模ComfyUI工作流
一个戴着破旧莎草帽的机械忍者
一艘来自工业时代的飞船ComfyUI工作流
一个穿绿衣服国风古典女孩
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

barcode条形码/qrcode二维码兼容所有浏览器(含ie6/ie7/ie8)
如何利用svg做一个有趣的loading动画加载
利用css3做一个动态loading效果
利用html5+css3实现滚雪球效果(附代码)
html5如何3D立方体旋转特效
自动打字效果(惊喜在后面)
3D立体人物效果
jquery鼠标滑过图片边框特效(jquery.focus-follow插件)











