【发布时间】:2013-01-06 17:14:37
【问题描述】:
我正在创造一种“惊人”的效果来展示产品(客户“绝对需要它”!)。
我已经实现了http://jsfiddle.net/EMpQd/9/的效果(看比解释容易)。
我的问题是:在背景中设置一个矩形,然后在其上设置一个圆圈,我不仅需要在圆圈中获得透明度,还需要在矩形中,在圆圈覆盖的部分(又名路口)。
我怎样才能做到这一点?拉斐尔能做到吗?
效果代码(不透明):
var w = 800;
var h = 600;
var paper = Raphael(0, 0, w, h);
// I want to show this image through the effect (it's just an example)
paper.image("http://static.pourfemme.it/pfmoda/fotogallery/625X0/63617/borsa-alviero-martini-rodeo-drive.jpg", 0, 0, w, h);
// colored background
paper.rect(0, 0, w, h).attr("fill", "#999").attr("stroke-width", 0).attr("opacity", 1);
// the circle in which I'll show the product
var circle = paper.circle(400, 300, 1);
circle.attr({fill: "#FFF", stroke: "#FFF", "stroke-width": 0});
//expand the circle
circle.animate({r: w*2}, 10000);
【问题讨论】:
标签: javascript canvas svg raphael intersection