Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raphael drop shadow effect

Does anyone know if Raphael supports the use of a drop shadow. I am trying to create a drop shadow for an object I have created. Here is the code I have, but I can't figure out how I would add a drop shadow. Please help me if you can my manager is becoming VERY frustrated with me.

<html>
<head><title></title>
<script src="raphael-min.js"></script>
<script src="jquery-1.7.2.js"></script>
</head>

<body>

<div id="draw-here-raphael" style="height: 200px; width: 400px;">
</div>

<script type="text/javascript">
//all your javascript goes here

var r = new Raphael("draw-here-raphael"),

    // Store where the box is
    position = 'left',

    // Make our pink rectangle
    rect = r.rect(20, 20, 50, 50).attr({"fill": "#fbb"});

</script>

</body>
</html>
like image 526
John Doe Avatar asked Jun 29 '12 13:06

John Doe


People also ask

What is the effect of drop shadow?

The drop shadow (sometimes called a “box shadow”) is an effect often found in catalog photographs, advertising images, and Web pages. It is created by separating the subject object from the background and adding a custom shadow. Sometimes the background is deleted, other times it is substituted out or modified.

What is drop shadow function?

A drop shadow is effectively a blurred, offset version of the input image's alpha mask, drawn in a specific color and composited below the image. Note: This function is somewhat similar to the box-shadow property.

Can I add a drop shadow in after Effects?

Open the Effects & Presets panel using either Command+5 on a Mac or Ctrl+5 on a PC. Type “Drop Shadow” in the search field. Drag the Drop Shadow effect onto your timeline layer or directly onto the composition scene. Alternatively, you can navigate to the Effect tab and choose Perspective > Drop Shadow.


1 Answers

The .glow()-method can be used to some extent:

var circle = paper.circle(100,100,50);
var path = paper.path('m200,50 l100,0 l100,100 l0,100 z');

circle.glow();

path.attr({
    fill: 'blue'
});
path.glow({
    color: '#444',
    offsety: 20 
});​

See it in action here: http://jsfiddle.net/sveinatle/gkayG/7/

It seems to only work for the lines though, it doesn't actually fill the shadow.

like image 123
Supr Avatar answered Sep 23 '22 10:09

Supr