CSS3 SVG绘制模拟旗帜飘动特效

 时间:2024-11-23 08:17:02

1、新建html文档。

CSS3 SVG绘制模拟旗帜飘动特效

3、书写css代码。<style>.banner { width: 800px; height: 100px; border: 0px dotted cyan; position: relative; transform-style: preserve-3d; transform: var(--transform); --transform: scale(1); display: none;}.banner { display: flex; justify-content: space-between;}.flag { display: flex; height: 70px; width: 45px; background: hsl(var(--hue,43), 90%, 55%); color: hsl(43, 90%, var(--text,5%)); clip-path: polygon(0% 0%, 100% 0%, 50% 100%); transform-origin: 50% 0%; justify-content: center; align-items: center; padding-bottom: 1rem;}.string { display: none;}.flag:nth-of-type(odd) { --hue: 343; --text: 95%;}.banner:nth-of-type(even) .flag:nth-of-type(even) { --hue: 333;}.banner:nth-of-type(even) .flag:nth-of-type(odd) { --hue: 193;}.banner:nth-of-type(3) .flag:nth-of-type(odd) { --hue: 33;}.banner:nth-of-type(3) .flag:nth-of-type(even) { --hue: 173;}@supports (offset-path: path('M0,0 C100,100 700,200 800,100')) { .banner { height: 230px; } .banner:nth-of-type(even) { --transform: rotate(0deg); } .banner:nth-of-type(2) { --transform: scaleX(-1) rotate(-8deg); } .banner:nth-of-type(1) { --transform: rotate(-4deg); } .flag:not(.string) { position: absolute; offset-anchor: 50% 0%; offset-path: path('M0,0 C100,100 700,200 800,100'); } .string, .string svg { position: absolute; width: 800px; top: 0; left: 0; height: 230px; display: block; background: transparent; clip-path: none; } .string path { stroke: hsla(183, 20%, 30%, .3); stroke-width: 1px; d: path('M0,0 C100,100 700,200 800,100'); }}body { height: 100vh; display: flex; justify-content: center; align-items: center; flex-direction: column; overflow: hidden; perspective: 700px; background: hsl(183, 100%, 95.25%);}*, *::before, *::after { box-sizing: border-box;}</style>

CSS3 SVG绘制模拟旗帜飘动特效

5、代码整体结构。

CSS3 SVG绘制模拟旗帜飘动特效
  • 乐高积木软件中如何搭建人物模型
  • 怎么画星星魔法棒
  • 画卡通太阳的步骤及图示
  • 画艾格尼丝(卑鄙的我)
  • 怎 样画3D小蜜蜂
  • 热门搜索
    五一北京旅游 广西西部旅游联盟 西部旅游攻略 陕西杨凌旅游景点 平山旅游景点 马尔代夫 旅游 中国旅游资讯 湖北旅游景点推荐 宁波普陀山旅游攻略 韩国旅游介绍