Module

Hylograph.Flow.Render.Transition

Package
purescript-hylograph-flow-render
Repository
afcondon/purescript-hylograph-flow-render

A watched change between two cuts: the stages of it, as layouts to be blended, and a transition of them by the ecosystem's own machinery (0.6).

When the layouts of two cuts differ, the reader keeps their place by seeing what moves move. A change is shown in stages, so that two kinds of motion are not on the page at once. Opening a group:

  1. make room: the closed picture, with every node the change does not touch going to where the open picture has it, and the group's bar going, whole, to where its parts will stand across the flow (nowhere, where they will stand within the span it has);
  2. unfold: the open picture, with the group's parts starting inside the bar (each where it will be across the flow, all where the bar is along it) and going out along the flow to their tiers.

Closing is the same two, backwards: fold, then close up. A stage in which nothing moves is left out. So a pair that is Held has no stage that makes room; and where the group's parts are in one tier it has no stages at all: the parts take the bar's place at once, and there is nothing to watch.

Every stage is two layouts of one projection and of one shape (Reshape.sameShape), made with Reshape.reshaped, so every picture part of the way through is Reshape.blend of the two, and conserves what the two conserve: a ribbon is as broad as it was and stands where it stood on its node's side all the way. What a picture part of the way through does not keep is apartness: in the second stage the parts start on top of one another, inside the bar.

Between the two stages the picture changes from the closed projection to the open one. Every untouched node is then in one place in both; the bar is replaced by its parts, within the span it had; and the ribbons that met the bar meet the parts, which is the one thing that is seen to jump (by less than the bar's breadth).

A change that opens some groups and closes others has no stages here: take it one group at a time. A change with no group opened or closed, between two layouts of one shape, is one stage.

THE MACHINERY is hylograph-transitions: watched gives a TransitionSpec of layouts (its engine's, with its easings), whose tick is pure. Nothing here keeps time, and nothing here runs: a page runs the spec with that library's own consumer of a transition, Hylograph.Transition.Consumers.transitionConsumer (in hylograph-transitions since 0.1.1), on its Coordinator. Until 0.7 this module had a runner of its own, watch, because that consumer lived in hylograph-simulation; it is gone, and this package depends on no simulation.

#Stage Source

type Stage wire = { from :: Layout wire, name :: String, to :: Layout wire }

One stage of a change: two layouts of one shape, and what the stage is called ("make room", "unfold", "fold", "close up", "move").

#stages Source

stages :: forall wire. Layout wire -> Layout wire -> Array (Stage wire)

The stages of the change from one layout to another; none where there is nothing to watch. See the module's header.

#frame Source

frame :: forall wire. EasingType -> Array (Stage wire) -> Number -> Maybe (Layout wire)

The picture a part of the way through the stages, from 0 (the first stage's start) to 1 (the last stage's end), each stage taking an equal share and eased within itself. Nothing where there are no stages.

#watched Source

watched :: forall wire. TransitionConfig -> Array (Stage wire) -> Maybe (TransitionSpec (Layout wire))

The stages as one transition for hylograph-transitions' engine: its duration and easing are each stage's, its delay the whole's. Nothing where there are no stages (the change is then made at once).