【发布时间】:2013-04-30 09:59:55
【问题描述】:
给定以下代码:
- 滤芯中的 x&y 参数实际上是什么?
- 过滤器元素中的 x&y 参数可以通过 javascript 保持不变吗?我可以根据 var h &var k 中变量的变化来定义 house() 中过滤器元素的变化 x&y 参数。
- 对代码进行必要的更改以满足需要。
<body style="background:black;margin:0px" onmousemove="house(event)">
<defs>
<filter id="f1" x="0" y="0" width="105%" height="105%">
<feOffset result="offOut" in="SourceGraphic" dx="20" dy="20" />
<feBlend in="SourceGraphic" in2="offOut" mode="normal" />
</filter>
</defs>
<circle r="25" id="circle" fill="yellow" filter="url(#f1)"></circle>
</svg>
<script>
function house(e)
{
var h=e.clientX;
var k=e.clientY;
var ball=document.getElementById("circle");
var r=ball.getAttribute("r");
ball.setAttribute("cx",h);
ball.setAttribute("cy",k);
}
</script>
【问题讨论】:
-
@pswg 编辑什么?
-
只是格式化。你可以点击我名字上方的链接来查看问题,看看编辑的确切内容。
标签: javascript html svg svg-filters