铁路项目建设 网站企业网站前端建设

张小明 2026/1/7 14:35:13
铁路项目建设 网站,企业网站前端建设,昌大建设三公司,越南网站怎么做一、SVG 概述 官方文档#xff1a;https://developer.mozilla.org/zh-CN/docs/Web/SVGSVG 全称 Scalable Vector Graphics#xff0c;即可缩放矢量图形SVG 基于 XML 标记语言#xff0c;用于描述二维的矢量图形SVG 格式提供的是矢量图#xff0c;这意味着它的图像能够被无限…一、SVG 概述官方文档https://developer.mozilla.org/zh-CN/docs/Web/SVGSVG 全称 Scalable Vector Graphics即可缩放矢量图形SVG 基于 XML 标记语言用于描述二维的矢量图形SVG 格式提供的是矢量图这意味着它的图像能够被无限放大而不失真或降低质量并且可以方便地修改内容无需图形编辑器二、SVG 基本使用1、准备阶段准备一个宽 400 像素、高 300 像素的灰色边框的空白 SVG 画布svgidmySvgwidth400height300xmlnshttp://www.w3.org/2000/svg.../svgsvg{border:1px solid #ccc;}2、基础图形绘制矩形x, y 是左上角坐标fill 是填充色stroke 是描边色stroke-width 是描边粗细rectx50y50width100height60fillsteelbluestrokedarkbluestroke-width3/圆形cx, cy 是圆心坐标r 是半径fill 是填充色opacity 控制透明度0 ~ 1circlecx250cy100r40fillcoralopacity0.8/直线x1, y1 是起点坐标x2, y2 是终点坐标。stroke 是线条颜色stroke-width 是线条粗细linex150y1200x2150y2250strokegreenstroke-width5/多边形points 属性定义了一系列用空格分隔的 x,y 坐标对它会自动连接首尾点形成封闭图形polygonpoints300,200 350,250 250,250filllavenderstrokepurple/路径d 属性包含绘制命令上例中M移动到、L画线到、Z闭合路径pathdM 100,150 L 200,150 L 150,100 Zfilllightyellowstrokeorange/三、SVG 使用 CSSSVG 的 fill、stroke、opacity 等属性可以使用 CSS控制这有助于统一风格与交互效果svgidmySvgwidth400height300xmlnshttp://www.w3.org/2000/svgrectclassshapex50y50width100height60/circleclassshapecx250cy100r40//svgsvg{border:1px solid #ccc;}.shape{stroke-width:2;stroke-opacity:0.7;stroke:blue;fill:gray;transition:fill 0.3s ease;}.shape:hover{fill:gold;}四、SVG 使用 JavaScriptsvgidmySvgwidth400height300xmlnshttp://www.w3.org/2000/svgrectidmyRectclassshapex50y50width100height60//svgsvg{border:1px solid #ccc;}.shape{stroke-width:3;stroke-opacity:0.7;stroke:blue;}constmySvgdocument.getElementById(mySvg);constmyRectdocument.getElementById(myRect);// 生成一个随机颜色改变矩形的填充色myRect.addEventListener(click,function(){constrandomColor#Math.floor(Math.random()*16777215).toString(16);console.log(randomColor);this.setAttribute(fill,randomColor);});// 在 SVG 内部点击时添加圆形mySvg.addEventListener(click,function(event){constpointmySvg.createSVGPoint();point.xevent.clientX;point.yevent.clientY;constsvgPointpoint.matrixTransform(mySvg.getScreenCTM().inverse());constnewCircledocument.createElementNS(http://www.w3.org/2000/svg,circle);newCircle.setAttribute(cx,svgPoint.x);newCircle.setAttribute(cy,svgPoint.y);newCircle.setAttribute(r,15);newCircle.setAttribute(fill,lightcoral);newCircle.classList.add(shape);mySvg.appendChild(newCircle);});五、SVG 实例实操房屋绘制svgwidth400height400viewBox0 0 400 400!-- 房屋主体 --rectclasshouse-bodyx100y200width200height150rx5/!-- 屋顶 --polygonclassroofpoints70,200 330,200 200,100/!-- 烟囱 --rectclasschimneyx260y120width30height60/rectclasschimneyx255y115width40height10/!-- 烟囱烟 --pathdM275,90 Q280,70 290,65 Q300,60 310,55fillnonestroke#aaastroke-width3stroke-linecapround/pathdM280,80 Q285,60 295,55 Q305,50 315,45fillnonestroke#aaastroke-width3stroke-linecapround/!-- 窗户 --rectclasswindowx120y220width40height40rx3/rectclasswindowx240y220width40height40rx3/!-- 窗户十字架 --linex1140y1220x2140y2260stroke#3366ccstroke-width1/linex1120y1240x2160y2240stroke#3366ccstroke-width1/linex1260y1220x2260y2260stroke#3366ccstroke-width1/linex1240y1240x2280y2240stroke#3366ccstroke-width1/!-- 门 --rectclassdoorx180y280width40height70rx3/!-- 门把手 --circlecx210cy315r3fillgold/!-- 台阶 --rectx170y350width60height10fill#888rx2/!-- 文字 --textx200y390text-anchormiddlefont-size14fill#666SVG 房屋绘制/text/svgdivstyletext-align:center;margin:20pxbuttononclickaddSun()添加太阳/buttonbuttononclickchangeColor()改变颜色/buttonbuttononclickreset()重置/button/divsvg{border:1px solid #ddd;background-color:#f8f9fa;display:block;margin:20px auto;}.house-body{fill:#ffcc99;stroke:#cc9966;stroke-width:2;}.roof{fill:#cc3333;stroke:#993333;stroke-width:2;}.window{fill:#99ccff;stroke:#3366cc;stroke-width:1;}.window:hover{fill:#66aaff;}.door{fill:#996633;stroke:#663300;stroke-width:2;}.door:hover{fill:#cc9966;}.chimney{fill:#cccccc;stroke:#999999;stroke-width:2;}functionaddSun(){constsvgdocument.querySelector(svg);constsundocument.createElementNS(http://www.w3.org/2000/svg,circle);sun.setAttribute(cx,350);sun.setAttribute(cy,50);sun.setAttribute(r,30);sun.setAttribute(fill,gold);sun.setAttribute(opacity,0.8);svg.appendChild(sun);// 阳光光线for(leti0;i12;i){constraydocument.createElementNS(http://www.w3.org/2000/svg,line);constangle(i*30*Math.PI)/180;constx1350Math.cos(angle)*30;consty150Math.sin(angle)*30;constx2350Math.cos(angle)*45;consty250Math.sin(angle)*45;ray.setAttribute(x1,x1);ray.setAttribute(y1,y1);ray.setAttribute(x2,x2);ray.setAttribute(y2,y2);ray.setAttribute(stroke,gold);ray.setAttribute(stroke-width,3);svg.appendChild(ray);}}functionchangeColor(){constcolors[#ff9999,#99ff99,#9999ff,#ffff99,#ff99ff];consthouseBodydocument.querySelector(.house-body);constrandomColorcolors[Math.floor(Math.random()*colors.length)];houseBody.style.fillrandomColor;}functionreset(){location.reload();}
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

建设网站需要什么硬件外贸平台网站的营销方式

在现代数字通信中,表情符号已经成为跨越语言障碍的情感表达工具。然而,你是否遇到过在不同设备上看到的表情符号颜色不一致的问题?emojione-color-font项目正是为了解决这一痛点而生,它提供了一套完整的彩色表情符号字体解决方案。…

张小明 2026/1/3 7:44:33 网站建设

wap网站建设如何改造熊掌号品牌建设还有待升华

在当今追求高效工作的时代,MacBook Pro用户往往会忽略Touch Bar这个极具潜力的功能区域。而Pock作为一款专为Touch Bar设计的Widgets管理器,正悄然改变着用户的使用习惯。这款免费开源工具让原本单调的Touch Bar焕发新生,成为真正的生产力提升…

张小明 2026/1/3 7:43:26 网站建设

丹徒网站关于优化培训

文件管理系统的课题背景 随着信息技术的快速发展,数据量呈指数级增长,企业和个人对高效、安全的文件管理需求日益迫切。传统的文件管理方式,如手动分类存储或简单的文件夹管理,已难以应对海量数据的组织、检索和共享需求。特别是在…

张小明 2026/1/4 10:00:54 网站建设

河南网站公司济南高端网站设计

谷歌搜索排名惩罚问题全解析 在谷歌搜索中,网站可能会遇到各种排名相关的问题,其中是否被惩罚是许多站长关心的重点。下面将为你详细介绍如何判断网站是否被惩罚以及相应的解决办法。 惩罚检查工具的局限性与真相 有时候,当你搜索主页 <TITLE> 标签或页面内容中的…

张小明 2026/1/5 3:57:21 网站建设

安徽建设局网站做视频网站 带宽计算

还在为无法保存精彩视频而烦恼吗&#xff1f;当你刷到心动的短视频、看到高清美图时&#xff0c;是不是常常因为平台限制而束手无策&#xff1f;现在&#xff0c;一款革命性的智能下载工具将彻底改变你的下载体验&#xff0c;让资源获取变得前所未有的简单高效。 【免费下载链接…

张小明 2026/1/5 18:44:28 网站建设

北京搜狗建网站的电话广告公司门头

LangFlow&#xff1a;如何让大模型原型验证变得像搭积木一样简单&#xff1f; 在探索大语言模型应用的道路上&#xff0c;你是否也经历过这样的场景&#xff1a;灵光一现想到了一个绝佳的AI产品创意——比如一个能自动整理会议纪要并生成待办事项的智能助手。于是你打开编辑器&…

张小明 2026/1/4 11:27:52 网站建设