Frontory

Open code, practice, and notes →

Download source with English comments · for reading

GSAP · 09 Connecting Native Scroll

Series contents · Technology map

Stage: Scrolling and lifecycle · Editable example · Storage ID: gsap-step-09

Goals and learning outcomes

Prerequisites

Prepare the exercise results on Context and Revert from Unit 8, “Context and Restoration”.

Key concepts and explanations

Progress

Divide scrollTop by the effective scroll length. A length of 0 needs separate handling.

Manual Connection

A scroll event can directly control a paused timeline. This path does not execute ScrollTrigger.

Practice setup

First check the execution scope guidance on the example screen. The following environment is for extending the assignment in a separate project. The existing gsap-01·02·03 are starting examples. Write new units in a separate local GSAP project. The gsap-02 preview uses native scroll events; install and register ScrollTrigger in an external project. Preserve CSP and iframe 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-9.js of a separate practice project, check the denominator, then update a paused timeline.progress in the scroll handler. Refer to the existing Unit 1·14·28 examples only as starting points.
  2. Input conditions: a long document and a short document. Baseline: two screens. Run under baseline conditions, then record observations and errors in notes/day-9.md.
  3. Variable: Document Length; changed value: half a screen. Run again using the same input path. Deliverable to save: progress at the top, middle, and bottom and the NaN count. Hypothesis to check: Progress remains valid even without scrolling. Compare with the actual results and record whether they agree and the causes of any differences.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
Document Lengthtwo screenshalf a screenProgress remains valid even without scrolling.

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 Progress affect in this exercise? Input case: a long document and a short document.
  2. Variable: Document Length. Hypothesis to check: Progress remains valid even without scrolling. Did the actual results match the hypothesis? Explain the evidence in terms of Manual Connection.

Official references

Linked example and execution scope

Example source · Runtime environments and limits

This is an experiment on Connecting Native Scroll. It supports direct interaction and cleans up the resources it uses.

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

Next learning

Previous: Context and Restoration · Next: Registering ScrollTrigger

Open code, practice, and notes →