1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 如何使用纯CSS 实现一个没有DOM元素的动画效果

如何使用纯CSS 实现一个没有DOM元素的动画效果

时间:2020-11-01 19:10:43

相关推荐

如何使用纯CSS 实现一个没有DOM元素的动画效果

web前端|css教程

前端,html5,css,background-image,background-size

web前端-css教程

本篇文章给大家带来的内容是关于如何使用纯CSS 实现一个没有DOM元素的动画效果,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

jsp个人记账系统源码,vscode为什么搜不到中文版,ubuntu装完重启,tomcat缓存配置文件,爬虫店repshop,php自学能学会吗,淮北抖音seo优化推广快速排名lzw

效果预览

p2p贷款金融网站源码,vscode特效设置,ubuntu谷歌浏览器显示图片,jtm启动tomcat,sqlite读写同时进行,百度搜索记忆插件,前端框架排行,爬虫加饲养箱测评,php 图片盗链,江夏seo技术,忘记网站后台admin密码,微信 模仿 网页游戏下载,72团会员模板lzw

视频源码系统,ubuntu麒麟桌面美化,爬虫房天下小区,php ($_files,seo alt设置lzw

代码解读

没有 dom 元素,直接写 css。

设置页面空间:

body { position: fixed; margin: 0; width: 100vw; height: 100vh;}

用伪元素设置背景图案:

body::before { content: \; position: fixed; width: 200vmax; height: 200vmax; background-color: steelblue; color: turquoise; background-image: linear-gradient( 45deg, currentColor 25%, transparent 25%, transparent 75%, currentColor 75%), linear-gradient( 45deg, currentColor 25%, transparent 25%, transparent 75%, currentColor 75%); background-position: 0 0, 5vmax 5vmax; background-size: 10vmax 10vmax;

平移背景图案:

body::before { top: 50%; left: 50%; animation: 9s move infinite ease-in-out alternate;}@keyframes move { from { left: -40%; top: -40%; } to { left: -60%; top: -60%; }}

让背景图案转动起来:

body::before { animation: 9s move infinite ease-in-out alternate, 9s -1.5s rotating infinite ease-in-out alternate;}@keyframes rotating { to { transform: rotate(180deg); }}

平移页面:

body { top: 50%; left: 50%; animation: 3s move infinite ease-in-out alternate;}

缩放页面:

body { animation: 3s move infinite ease-in-out alternate, 3s zoom infinite ease-in-out alternate;}@keyframes zoom { to { transform: scale(10); }}

最后,增加变色效果:

@keyframes rotating { to { transform: rotate(180deg); filter: hue-rotate(1turn); }}

大功告成!

如何使用纯CSS实现一只移动的小白兔动画效果

如何使用纯CSS实现一个微笑打坐的小和尚

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。