234234234

svg 绘制旗帜

效果:

 

复制代码
const drawFlag = () => {
  const viewBox = 1024;

  const poleHeight = 1000;
  const poleWidth = 60;
  const poleX = 10;
  const poleY = 10;


  const x = poleX + poleWidth;
  const y = poleY + poleWidth;
  const width = 800;
  const height = 600;
  const radian = 90;

  return `<svg viewBox="0 0 ${viewBox} ${viewBox}" width="50" height="50" style="margin: auto 100px">
            <rect x="${poleX}" y="${poleY}" width="${poleWidth}" height="${poleHeight}" stroke="#000" />
            <path d="M ${x} ${y} Q ${width/4} ${y -radian}, ${width/2} ${y} Q ${width/4*3} ${y+radian}, ${width} ${y} L ${width} ${height} Q ${width/4*3} ${height+radian}, ${width/2} ${height} Q ${width/4} ${height-radian}, ${x} ${height} Z" stroke="#000"  />
          </svg>`;
}
复制代码

 

posted @   你若愿意,我一定去  阅读(33)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
23423423423
点击右上角即可分享
微信分享提示