0

Here you already find a plug in to add blur to raphael elements

I want to cover parts of my raphael svg with a transparent layer that blurs everything behind it. Is something like this possible with raphael?

Community
  • 1
  • 1
zbug
  • 1,043
  • 1
  • 8
  • 19

1 Answers1

5

No such thing exists in SVG (much less VML), sorry.

The only work around that occurs to me would be to loop through all your elements and apply the blur, fortunately it's only a couple of lines of javascript:

paper.forEach(function(el){
  el.blur();
});

http://jsfiddle.net/MS2AB/

You could also mix in some old fashioned dom manipulation: clone the stage various times in slightly offset positions, and apply a very low opacity to imitate a blur effect, for example...

  var paperhtml = document.getElementById('stage').innerHTML;
  var blurString = "";
  for (x=1; x<=10; x++) {
    for (y=1; y<=10; y++) {
      blurString += "<div style='left: "+(x-5)+"px; top: "+(y-5)+"px; opacity: 0.03'>"+paperhtml+"</div>"
  }
}    
blurcontainer.innerHTML = blurString;

You can view a demo here: http://jsfiddle.net/WTCXF/

methodofaction
  • 70,885
  • 21
  • 151
  • 164
  • sadly, i can not use blur for all raphael elements. i need a blured area - lets say the lower 50% of my raphael-svg - fully covered. and this area also only covers parts of my elements, depending where they are positioned. just like "50% of the raphael-svg are covered behind a blur" – zbug Jan 12 '12 at 09:15
  • thats a nice solution, if the background is fixed. thanks for the input – zbug Jan 13 '12 at 16:31