Raphael knockback effect

Does anyone know if Raphael supports the use of shadow. I am trying to create a shadow for an object that I created. Here is the code that I have, but I can’t figure out how to add shadows. Please help me if you let my manager VERY upset 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>
+5
source share
5 answers

.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 here: http://jsfiddle.net/sveinatle/gkayG/7/

It seems to work only for strings, but in fact it does not fill the shadow.

+7
source

Raphaeljs , . , , , , ( ), .

+1

, , , 3D-.

Raphael.el.depth = function(z, shade) {
    z = (typeof z !== "undefined") ? z : 5;
    shade = (typeof shade !== "undefined") ? shade : '#999';
    for (var c = 0; c < z; c += 1) {
        var s = this.clone().attr({ 'fill': shade }).transform("t" + (c + 1) + "," + (c + 1));
    }
    this.toFront();
}; 
+1

. :

circle.shadow();

, . , SVG ( glow() ), ..

: http://chrismichaelscott.imtqy.com/fraphael/.

0

- clone(). , paths. .

DEMO:

var r = new Raphael(10,10, 500, 500);
var p = r.path("M100,300 L100,100 C100,100 250,100 250,300z");
p.attr({fill: 'yellow'});

p2 = p.clone();
p2.attr({fill:'gray', stroke:'none'}).transform('t7,5');

p.toFront();
0
source

All Articles