Skip to content

Simplify internals by building useTrail atop useSprings #739

@aleclarson

Description

@aleclarson

@drcmda noticed that all of the useTrail-specific logic could be removed since useTrail is really just a more constrained useSprings.

Take this for example:

// Shorthand form (more constrained)
const props = useTrail(10, { x: 0, from: { x: 100 } })

// Identical behavior with useSprings
const props = useSprings(10, i => ({ x: 0, from: { x: 100 }, config: { mass: 1 + i } }))

// But useSprings is more flexible (because each spring has its own props)
const props = useSprings(10, i => ({ x: 0, y: i * 10, from: { x: 100, y: 0 }, config: { mass: 1 + i } }))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions