2017-12-13 15 views
0

私は、マウスを動かすと.SVGsを明らかにする小さなマップを作りました。それは即座にイメージを明らかにし、マウスの上に残します。私はフェードインとフェードアウトするために '.animate'属性を追加しようとしましたが、私が試したあらゆる方法が失敗しましたか?簡単な説明が大好きです!Raphaelで不透明度をアニメーション化する

var rsr = Raphael( 'map'、 '900'、 '900');

var regions = [];

var circle_a = rsr.circle(584、556、88);データ({'id': 'circle_a'、 'region': 'サークルA'}); regions.push(circle_a); {

regions[i].mouseover(function(e){ 
    this.node.style.opacity = 1; 
}); 

regions[i].mouseout(function(e){ 
    this.node.style.opacity = 0; 
}); 

}

+0

.animateどの属性すなわち?(; I < regions.length iがVAR ++ I = 0)ため

それで[mcve]を作成できますか? –

答えて

0
regions[i].mouseover(function(e){ 
    circle_a.animate({ "fill-opacity": "1" }, 2000); 
    document.getElementById('region-name').innerHTML = this.data('region'); 
}); 

regions[i].mouseout(function(e){ 
circle_a.animate({ "fill-opacity": "0" }, 2000); 
}); 
+0

私は何度も「不透明」を試みていました。しかし、私はsvgの塗り不透明度を0に設定しました(不透明度の代わりに)。次に、塗りの不透明度をアニメーション化します。すべてが動作します! Woooo。 – Rob