質問

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

役に立ちましたか?

解決

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();

jsfiddle

他のヒント

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)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top