当前位置: 首页> 文旅> 艺术 > 福田蒙派克e_业之峰装饰公司北京地址_石家庄谷歌seo公司_免费网站推广软文发布

福田蒙派克e_业之峰装饰公司北京地址_石家庄谷歌seo公司_免费网站推广软文发布

时间:2025/7/10 11:48:18来源:https://blog.csdn.net/owo_ovo/article/details/142756286 浏览次数:0次
福田蒙派克e_业之峰装饰公司北京地址_石家庄谷歌seo公司_免费网站推广软文发布

现有一段代码,在不旋转整个元素的前提下,渐变背景无法应用动画

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.card {--direc: 0deg;width: 300px;height: 300px;border-radius: 4px;background-image: linear-gradient(var(--direc), #5aec5a, #3c673c, #3c67e3);animation: rotate 3s linear infinite;}@keyframes rotate {to {--direc: 360deg}}</style>
</head><body><div class="card"></div>
</body></html> 

在这里插入图片描述
传统模式下,开发者无法干预图片绘制过程,使用 houdini API 自定义 CSS属性,如本例中自定义的属性 --direc,性质为角度、初始值为0、该属性不可被继承。

@property --direc {syntax: '<angle>'; initial-value: 0deg;inherits: false;
}

在这里插入图片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>
@property --direc {syntax: '<angle>';initial-value: 0deg;inherits: false;
}.card {--direc: 0deg;width: 300px;height: 300px;border-radius: 4px;background-image: linear-gradient(var(--direc), #5aec5a, #3c673c, #3c67e3);animation: rotate 3s linear infinite;}@keyframes rotate {to {--direc: 360deg}}</style>
</head><body><div class="card"></div>
</body></html>
关键字:福田蒙派克e_业之峰装饰公司北京地址_石家庄谷歌seo公司_免费网站推广软文发布

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: