JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q59125F
  • License MIT

React Component for transitioning JavaScript data structures.

Package Exports

  • join-transition

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (join-transition) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JoinTransition

React Component wrapping d3.transition().tween(...) with a data join mechanism inspired by d3-selection, operating on generic data structures.

Install

npm install join-transition

Documentation

Sample element:

<JoinTransition
  values={[value1, value2, etc]}  // *Required*

  interpolate={(a, b, interpolate) => interpolate(a, b)}  // Default. Passes [d3.interpolate](https://github.com/d3/d3-interpolate#interpolate) as final argument
  shouldTransition={(a, b) => a !== b}  // Default. Required for mutable values

  identify={d => d.id}  // Default. Keys values for constancy (c.f. key argument to [d3-selection data method](https://github.com/d3/d3-selection#selection_data))

  enter={d => { ...d, etc }}
  exit={d => { ...d, etc }}
  // or: enterOrExit={d => { ...d, etc }}

  duration={250}  // Defaults to d3-transition default [duration](https://github.com/d3/d3-transition#transition_duration). Length of all values' transition (not each!)
  ease={d3.easeCubic}  // Defaults to d3-transition default [easing](https://github.com/d3/d3-transition#transition_ease)

  stagger={0}  // Default. Longest delay time. Must be smaller than duration
  orderBy={(d, i) => i}  // Default. Determines stagger delay time, relative to other values
>{
  // The child must be a function that renders the array of transitioning values (including those entering, updating, and exiting), e.g.:
  transitioningValues =>
    <g>{values.map(value => <circle {...value} />)}</g>
  // *Required*
}</JoinTransition>