2
私は100ノードのD3 v4 forceシミュレーションを持っています。各ノードはイメージであり、各イメージにドロップシャドウを追加したいと思いますが、ドロップシャドウをレンダリングする方法のために、これは縮尺が変わっていないと思います。ドロップシャドウのない100枚の画像では、60fpsで動作しますが、ドロップシャドウは8fpsに似ています。これを行うには、ハッキーな解決策か、それとももっと良い方法がありますか?ここで私は(画像の後ろの円上にレンダリング)今持っているものです。多くのD3強制シミュレーションノードにドロップシャドウを追加しますか?
var dropShadowFilter = this.d3Graph.append('svg:filter')
.attr('id', 'drop-shadow')
.attr('filterUnits', "userSpaceOnUse")
.attr('width', '250%')
.attr('height', '250%');
dropShadowFilter.append('svg:feGaussianBlur')
.attr('in', 'SourceGraphic')
.attr('stdDeviation', 2)
.attr('result', 'blur-out');
dropShadowFilter.append('svg:feColorMatrix')
.attr('in', 'blur-out')
.attr('type', 'hueRotate')
.attr('values', 180)
.attr('result', 'color-out');
dropShadowFilter.append('svg:feOffset')
.attr('in', 'color-out')
.attr('dx', 3)
.attr('dy', 3)
.attr('result', 'the-shadow');
dropShadowFilter.append('svg:feBlend')
.attr('in', 'SourceGraphic')
.attr('in2', 'the-shadow')
.attr('mode', 'normal');
this.node = this.d3Graph.selectAll(null)
.data(Nodes)
.enter()
.append("g")
.attr("class", "nodes");
this.node.append("circle")
.attr("r", 30)
.attr("fill", "red")
.style("filter", "url(#drop-shadow)")
各ノードはそれらに付加された画像を持っている場合、あなたが代わりにSVGフィルターに –
を使用するのでは、各画像の写真編集アプリケーションにドロップシャドウ効果を作成することができます。これは、私の心を交差させ、残念ながら、私はそうは思わない。影が互いに近くになると、他のノードと重なってしまい、正しく見えなくなります。 – PurplePanda