Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new(vx-react-spring): add AnimatedGridRows/Columns + animationTrajectory #787

Merged
merged 8 commits into from
Aug 21, 2020

Conversation

williaster
Copy link
Collaborator

@williaster williaster commented Aug 21, 2020

TODO::

🚀 Enhancements

Part of the XYChart project, this PR

[@vx/grid]

  • adds children prop to GridRows + GridColumns to support animated rendering

[@vx/react-spring]

  • adds AnimatedGridRows + AnimatedGridColumns
  • modularizes AnimatedTicks/useAnimatedTicksConfig to spring-configs/useAnimatedLineTransitionConfig so it can power both animated tick + grid lines
  • adds animationTrajectory=outside | inside | min | max to AnimatedAxis and AnimatedGridRows/Columns

[@vx/demo]

  • updates the /axis demo to include AnimatedGrid* and a animationTrajectory config

💥 Breaking Changes

[@vx/grid]

  • Renames GridColumnProps => GridColumnsProps (+s) to match GridRowsProps

@hshoff @kristw @techniq

: [new Date('2020-02-01'), new Date('2020-03-01')];
const logValues = dataToggle ? [1, 10, 100, 1000, 10000] : [0.0001, 0.001, 0.1, 1, 10, 100];
const axes: AxisDemoProps<AxisScale<number>>[] = useMemo(() => {
// toggle between two value ranges to demo animation
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all just indented to memoize


// In order to plot values on an axis, output of the scale must be number.
// Some scales return undefined.
export type GridScaleOutput = number | NumberLike | undefined;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated this to match AxisScaleOutput because it simplifies the types in this PR (and logically they should be the same)

}: TicksRendererProps<Scale> & Pick<TransitionConfig<Scale>, 'animationTrajectory'>) {
const animatedTicks = useTransition(ticks, tick => `${tick.value}-${horizontal}`, {
unique: true,
...useLineTransitionConfig({ scale, animateXOrY: horizontal ? 'x' : 'y', animationTrajectory }),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this + the <> wrapper below are the only updates in this file. AnimatedTicks was previously a directory and the indentation with <> made git think it's a new file

Base automatically changed from chris--animated-axis to master August 21, 2020 14:56
@williaster
Copy link
Collaborator Author

Coverage increased (+1.3%) to 48.289%

woot!

@hshoff hshoff linked an issue Aug 21, 2020 that may be closed by this pull request
@hshoff hshoff added this to the 0.0.199 milestone Aug 21, 2020
@williaster williaster merged commit 7d35015 into master Aug 21, 2020
@williaster williaster deleted the chris--animated-grid branch August 21, 2020 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GridColumn line styling based on the tick value
2 participants