Given the code below:
- What are actually x&y parametes in filter element ?
- Can x&y parameters in filter element be kept on changing by javascript ? I can define the changing x&y parameters of filter element in house() as per the changes in variable in var h &var k.
- Make the necessary changes in code to meet the necessity.
<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>