Reputation: 4095
I have an arrow with gradient:
var g = field.gradient("l(0, 1, 2, 1)#fff-#5C5C5C");
var arrow = field.path(Snap.format("M390 385 L335 335 L410 355 Q375 355 390 385")).attr({fill: g, opacity: 0.5, cursor: 'pointer'});
I want to make an effect that the gradient is changing/moving like waves or something..
Here's flash page with what I want: http://www.888poker.com/poker-client/euromania_popup.htm?isftd=1&origcid=123456
Upvotes: 1
Views: 2263
Reputation: 46
Ian's link was on the right track. You can access an array of the color stop positions as percentages along the gradient and animate them individually with code like this:
// 1st color stop moves to 25% from the end over 1000ms
g.selectAll("*")[0].animate({offset: 0.25}, 1000)
// 2nd color stop moves to the 50% point over 500ms
g.selectAll("*")[0].animate({offset: 0.50}, 500)
// 3rd color stop moves to 75% from the end over 300ms
g.selectAll("*")[0].animate({offset: 0.75}, 300)
Upvotes: 0
Reputation: 13852
You could try animating the gradient, something like..
s = Snap(400, 620);
var g = s.gradient("l(0, 1, 2, 1)#5C5C5C-#fff-#5C5C5C");
var arrow = s.path(Snap.format("M390 385 L335 335 L410 355 Q375 355 390 385")).attr({fill: g, opacity: 0.5, cursor: 'pointer'});
function anim () {
g.attr({ x1: 0, y1: 1, x2: 2, y2: 1 });
g.animate({ x1: 0, y1: 100, x2: 0, y2: 100 }, 2000, mina.linear, anim);
};
anim();
Upvotes: 7