cnCalc计算器论坛

 找回密码
 注册
搜索
查看: 2082|回复: 3

[Nspire] 额,请教一下svg图像手工或自动化脚本对TI的转换

[复制链接]
发表于 2014-3-14 21:06:58 | 显示全部楼层 |阅读模式
本帖最后由 Arthur200000 于 2014-3-14 21:08 编辑

svg图像本质上是xml格式,粗浅的认识参见:http://zh.wikipedia.org/wiki/SVG
详细的文件格式请参阅这个w3c文档:http://www.w3.org/TR/SVG/

额,事情是这样的。
首先是学校要参赛,又是坑爹的TI画图。然后……我觉得可以在电脑上用一些工具画好svg,然后手工翻译(这个蛋疼)或者自动化转换到TI的图形进行实现。

然后就有这么一系列问题了:
  • 我表示没看懂svg的三次贝塞尔曲线的c和s应该怎么用…………更不清楚怎么展开了。
  • 0,0要从svg左上角移动到左下角,方程也要变形了……
  • 图形模式看上去不支持用几个曲线围起来的区域的颜色填充啊……用几何的话又不方便输入方程……
  • 然后是各种圆心之类的,留着个黑点什么的的确蛋疼……不过问题仅限手工输入,自动化的话大可以用参数方程。
  • 其实svg还有一个坑…………相对位置计算起来很烦诶!

就是这些疑问了。不知道有没有人曾经研究过这方面的东西。

发表于 2014-3-14 22:04:57 | 显示全部楼层
稍微看过一点,研究得也不深入,先贴两个例子:

1、静止图形

<svg xmlns="http://www.w3.org/2000/svg"> <circle cx="50"
cy="50"
r="50" style="fill:rgb(255,0,0);stroke:rgb(155,0,0)">
     </circle>
     <circle cx="100"
cy="100"
r="50" style="fill:rgb(0,0,255);stroke:rgb(0,0,155)">
     </circle>
   </svg>

2、动画形式

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<rect id="rec" x="300" y="100" width="600" height="300" style="fill:lime">
<animate attributeName="x" attributeType="XML" begin="0s" dur="12s" fill="freeze" from="300" to="0"/>
<animate attributeName="y" attributeType="XML" begin="0s" dur="12s" fill="freeze" from="100" to="0"/>
<animate attributeName="width" attributeType="XML" begin="0s" dur="12s" fill="freeze" from="300" to="800"/>
<animate attributeName="height" attributeType="XML" begin="0s" dur="12s" fill="freeze" from="100" to="300"/>
<animateColor attributeName="fill" attributeType="CSS" from="lime" to="red" begin="4s" dur="8s" fill="freeze"/>
</rect>

<g transform="translate(100,100)">
<text id="TextElement" x="0" y="0" style="font-family:Verdana;font-size:24; visibility:hidden"> 试试这个效果!
<set attributeName="visibility" attributeType="CSS" to="visible" begin="1s" dur="10s" fill="freeze"/>
<animateMotion path="M 0 0 L 100 100" begin="1s" dur="10s" fill="freeze"/>
<animateColor attributeName="fill" attributeType="CSS" from="red" to="blue" begin="1s" dur="10s" fill="freeze"/>
<animateTransform attributeName="transform" attributeType="XML" type="rotate" from="-30" to="0" begin="1s" dur="10s" fill="freeze"/>
<animateTransform attributeName="transform" attributeType="XML" type="scale" from="1" to="3" additive="sum" begin="1s" dur="10s" fill="freeze"/>
</text>

<text id="TextElement1" x="10" y="10" style="font-family:Verdana;font-size:24; visibility:hidden"> 熊猫!!!
<set attributeName="visibility" attributeType="CSS" to="visible" begin="1s" dur="10s" fill="freeze"/>
<animateMotion path="M 100 100 L 10 10" begin="1s" dur="10s" fill="freeze"/>
<animateColor attributeName="fill" attributeType="CSS" from="green" to="black" begin="1s" dur="10s" fill="freeze"/>
<animateTransform attributeName="transform" attributeType="XML" type="rotate" from="-30" to="0" begin="1s" dur="10s" fill="freeze"/>
<animateTransform attributeName="transform" attributeType="XML" type="scale" from="1" to="3" additive="sum" begin="1s" dur="10s" fill="freeze"/>
</text>
</g>



</svg>

使用方法,把上面两段保存为后缀是 svg 的文件,用浏览器打开就可以了。




 楼主| 发表于 2014-3-15 10:33:08 来自手机 | 显示全部楼层
FreeBlues 发表于 2014-3-14 22:04
稍微看过一点,研究得也不深入,先贴两个例子:

1、静止图形

不不不,我说的不是svg本身。。。
我是想问问能不能把静止svg的每个功能用TI可接受的方程式画出来。。。
主要是那几个曲线啦。。
发表于 2014-3-15 21:52:24 | 显示全部楼层
不清楚其他版本的Ti计算器如何,反正Ti-89T的绘图参数中没看到贝塞尔相关的,毕竟那么小的屏幕,光滑不光滑也看不出太大差别。

这篇教程里对贝塞尔曲线说得比较清楚,可以看看
http://1632004.blog.163.com/blog/static/2999149720103194132969/
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|cnCalc计算器论坛

GMT+8, 2024-5-23 16:59 , Processed in 0.049045 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表