Frontory

Open code, practice, and notes →

Download source with English comments · for reading

Motion · 19 Reordering with Buttons

Series contents · Technology map

Stage: Gestures and Equivalent Interaction · Editable example · Storage ID: motion-step-19

Goals and learning outcomes

Prerequisites

Prepare the results of the Momentum and Elastic exercises from Unit 18, “Inertia and Elasticity”.

Key concepts and explanations

Explicit order

The data array defines the order. Drag results must update the same array.

Equivalent alternatives

Up and Down buttons enable reordering without a pointer. Announce the result of the change in text.

Practice setup

First check the execution scope guidance on the example screen. The following describes the environment needed to extend the assignment in a separate project. The existing motion-01·02·03 examples are limited examples based on Motion JS animate. For React layout, AnimatePresence, and hooks exercises, install motion in a separate local React project and import from motion/react. Do not assume JSX runs directly in the editor; preserve CSP and isolation.

The linked example is a starting point. It does not implement every task below. Complete work beyond its supported scope in a separate project.

Practice tasks

  1. In src/day-19.tsx of a separate exercise project, add Up and Down buttons and order status information to cards. Use the existing Unit 1·14·28 examples only as starting points.
  2. Input condition: Moving the middle card up by one position. Baseline: drag. Run under the baseline condition, then record observations and errors in notes/day-19.md.
  3. Variable to change: Interaction; new value: Up button. Run again with the same input path. Deliverable to save: The ID array for each input method. Hypothesis to test: Both methods produce the same order array. Compare it with the actual results and record whether they agree and the causes of any differences.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
InteractiondragUp buttonBoth methods produce the same order array.

Predictions in this table are not measured results. Change one condition at a time and record why the actual result differs.

Completion criteria

Self-check

  1. Which processing stage does Explicit order affect in this exercise? Input case: Moving the middle card up by one position.
  2. Variable to change: Interaction. Hypothesis to test: Both methods produce the same order array. Did the actual results agree with the hypothesis? Explain your evidence in terms of Equivalent alternatives.

Official references

Linked example and execution scope

Example source · Runtime environments and limits

Interactive Reordering with Buttons experiment with cleanup of the resources used.

Source code and records are not overwritten automatically. Resetting an existing example also preserves your notes.

Next learning

Previous: Inertia and Elasticity · Next: MotionValue

Open code, practice, and notes →