Module

Hylograph.Forces.Radial

Package
purescript-hylograph-forces
Repository
afcondon/purescript-hylograph-forces

The radial force: pull each node towards a circle.

Ported from d3-force 3.0.0, radial.js (ISC, Copyright 2010-2021 Mike Bostock); see LICENSE.

#Config Source

type Config :: Row Type -> Typetype Config row = { radius :: Node row -> Number, strength :: Node row -> Number, x :: Number, y :: Number }

d3's forceRadial settings. radius and strength are asked once per node when the force is initialized.

#defaultConfig Source

defaultConfig :: forall row. Config row

d3's defaults for everything but the radius, which d3 requires: here a circle of radius 100 about the origin, at strength 0.1.

#Radial Source

newtype Radial :: Row Type -> Typenewtype Radial row

An initialized radial force.

#initialize Source

initialize :: forall row. Config row -> Array (Node row) -> Radial row

d3's force.initialize(nodes). A node whose radius is NaN gets strength zero, as in d3.

#apply Source

apply :: forall row. Radial row -> Number -> Effect Unit

d3's force(alpha).