Raphael使用g元素实现变形的操作

本文介绍如何使用SVG DOM和Raphael.js库实现g元素的变形操作,包括平移、旋转及缩放,并展示了如何设置填充颜色和边框样式。
Raphael使用g元素实现变形的操作
    <!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>svgdom实现g元素的变形操作</title>
    <style>
        #myg{
            border: 1px solid red;
            width: 200px;
            height: 200px;
        }
    </style>
    <script src="js/raphael.js"></script>
    <script>
        function createEleG(){
            var root=document.getElementByIdx_x("myg");
            var paper=Raphael(root,200,200);
            var st=paper.set();
            for(var i=0;i<3;i++){
                st.push(paper.rect(10+50*i,10+50*i,40,40,10));
            }
            //变形部分
            st.translate(50,10);
            st.rotate(45,50,50);
            st.scale(0.5);
            st.attr("fill","YellowGreen");
            st.attr("stroke","none");
        }
    </script>

</head>
<body onload="createEleG()">
<h3>Raphael实现g元素的变形操作</h3>
<div id="myg"></div>
</body>
</html>
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information. = RESTART: C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py ===== 中空玻璃热变形分析 (高级气体模型) ===== 数据读取成功: glass_parameters.xlsx Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 21387 (\N{CJK UNIFIED IDEOGRAPH-538B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 21147 (\N{CJK UNIFIED IDEOGRAPH-529B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 21464 (\N{CJK UNIFIED IDEOGRAPH-53D8}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 21270 (\N{CJK UNIFIED IDEOGRAPH-5316}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 19981 (\N{CJK UNIFIED IDEOGRAPH-4E0D}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 21516 (\N{CJK UNIFIED IDEOGRAPH-540C}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 27668 (\N{CJK UNIFIED IDEOGRAPH-6C14}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 20307 (\N{CJK UNIFIED IDEOGRAPH-4F53}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 38543 (\N{CJK UNIFIED IDEOGRAPH-968F}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 28201 (\N{CJK UNIFIED IDEOGRAPH-6E29}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 24230 (\N{CJK UNIFIED IDEOGRAPH-5EA6}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 30340 (\N{CJK UNIFIED IDEOGRAPH-7684}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 26080 (\N{CJK UNIFIED IDEOGRAPH-65E0}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 228 plt.savefig('gas_model_validation.png') UserWarning: Glyph 24418 (\N{CJK UNIFIED IDEOGRAPH-5F62}) missing from font(s) DejaVu Sans. 气体模型验证完成 G001 (air): ΔP=253.1 Pa, 外片=0.7971 mm, 内片=-0.7971 mm G002 (air): ΔP=582.5 Pa, 外片=0.7751 mm, 内片=-0.7751 mm G003 (air): ΔP=1086.0 Pa, 外片=0.7418 mm, 内片=-0.7418 mm G004 (air): ΔP=352.9 Pa, 外片=0.4863 mm, 内片=-1.0945 mm G005 (air): ΔP=410.5 Pa, 外片=0.3068 mm, 内片=-1.2663 mm G006 (air): ΔP=758.3 Pa, 外片=0.5308 mm, 内片=-0.9961 mm G007 (air): ΔP=339.7 Pa, 外片=1.0551 mm, 内片=-1.0551 mm G008 (air): ΔP=774.5 Pa, 外片=1.0165 mm, 内片=-1.0165 mm G009 (air): ΔP=1424.1 Pa, 外片=0.9595 mm, 内片=-0.9595 mm G010 (air): ΔP=472.2 Pa, 外片=0.6364 mm, 内片=-1.4502 mm G011 (air): ΔP=548.4 Pa, 外片=0.3956 mm, 内片=-1.6774 mm G012 (air): ΔP=1003.2 Pa, 外片=0.6885 mm, 内片=-1.3042 mm G013 (argon): ΔP=251.7 Pa, 外片=0.7930 mm, 内片=-0.7930 mm G014 (argon): ΔP=579.4 Pa, 外片=0.7711 mm, 内片=-0.7711 mm G015 (argon): ΔP=1080.1 Pa, 外片=0.7380 mm, 内片=-0.7380 mm G016 (argon): ΔP=351.0 Pa, 外片=0.4839 mm, 内片=-1.0888 mm G017 (argon): ΔP=408.3 Pa, 外片=0.3054 mm, 内片=-1.2596 mm G018 (argon): ΔP=754.1 Pa, 外片=0.5281 mm, 内片=-0.9910 mm G019 (argon): ΔP=343.6 Pa, 外片=0.4774 mm, 内片=-1.0792 mm G020 (krypton): ΔP=12.1 Pa, 外片=0.9012 mm, 内片=-0.2562 mm Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 27668 (\N{CJK UNIFIED IDEOGRAPH-6C14}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 20307 (\N{CJK UNIFIED IDEOGRAPH-4F53}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 31867 (\N{CJK UNIFIED IDEOGRAPH-7C7B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 22411 (\N{CJK UNIFIED IDEOGRAPH-578B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 24179 (\N{CJK UNIFIED IDEOGRAPH-5E73}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 22343 (\N{CJK UNIFIED IDEOGRAPH-5747}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 21464 (\N{CJK UNIFIED IDEOGRAPH-53D8}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 24418 (\N{CJK UNIFIED IDEOGRAPH-5F62}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 37327 (\N{CJK UNIFIED IDEOGRAPH-91CF}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 32477 (\N{CJK UNIFIED IDEOGRAPH-7EDD}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 23545 (\N{CJK UNIFIED IDEOGRAPH-5BF9}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 20540 (\N{CJK UNIFIED IDEOGRAPH-503C}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 19981 (\N{CJK UNIFIED IDEOGRAPH-4E0D}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 21516 (\N{CJK UNIFIED IDEOGRAPH-540C}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 30340 (\N{CJK UNIFIED IDEOGRAPH-7684}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 24433 (\N{CJK UNIFIED IDEOGRAPH-5F71}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 21709 (\N{CJK UNIFIED IDEOGRAPH-54CD}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 21387 (\N{CJK UNIFIED IDEOGRAPH-538B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 21147 (\N{CJK UNIFIED IDEOGRAPH-529B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 336 plt.tight_layout() UserWarning: Glyph 21270 (\N{CJK UNIFIED IDEOGRAPH-5316}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 27668 (\N{CJK UNIFIED IDEOGRAPH-6C14}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 20307 (\N{CJK UNIFIED IDEOGRAPH-4F53}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 31867 (\N{CJK UNIFIED IDEOGRAPH-7C7B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 22411 (\N{CJK UNIFIED IDEOGRAPH-578B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 24179 (\N{CJK UNIFIED IDEOGRAPH-5E73}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 22343 (\N{CJK UNIFIED IDEOGRAPH-5747}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 21464 (\N{CJK UNIFIED IDEOGRAPH-53D8}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 24418 (\N{CJK UNIFIED IDEOGRAPH-5F62}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 37327 (\N{CJK UNIFIED IDEOGRAPH-91CF}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 32477 (\N{CJK UNIFIED IDEOGRAPH-7EDD}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 23545 (\N{CJK UNIFIED IDEOGRAPH-5BF9}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 20540 (\N{CJK UNIFIED IDEOGRAPH-503C}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 19981 (\N{CJK UNIFIED IDEOGRAPH-4E0D}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 21516 (\N{CJK UNIFIED IDEOGRAPH-540C}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 30340 (\N{CJK UNIFIED IDEOGRAPH-7684}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 24433 (\N{CJK UNIFIED IDEOGRAPH-5F71}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 21709 (\N{CJK UNIFIED IDEOGRAPH-54CD}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 21387 (\N{CJK UNIFIED IDEOGRAPH-538B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 21147 (\N{CJK UNIFIED IDEOGRAPH-529B}) missing from font(s) DejaVu Sans. Warning (from warnings module): File "C:\Users\RAPHAEL\Downloads\Glass Deformation Model.py", line 338 plt.savefig(plot_path) UserWarning: Glyph 21270 (\N{CJK UNIFIED IDEOGRAPH-5316}) missing from font(s) DejaVu Sans. 气体影响分析图已保存至: results\gas_impact_analysis.png 分析完成 分析为啥报警
最新发布
12-14
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值