Skip to content

ChapterActionSchema

const ChapterActionSchema: ZodObject<{ action: ZodEnum<["setFilter", "setPaintProperty", "setLayoutProperty", "flyTo", "easeTo", "fitBounds", "custom"]>; bounds: ZodOptional<ZodUnion<[ZodUnion<[ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>, ZodTuple<[ZodTuple<[…, …], null>, ZodTuple<[…, …], null>], null>]>, ZodArray<ZodNumber, "many">]>>; filter: ZodOptional<ZodNullable<ZodType<any[], ZodTypeDef, any[]>>>; layer: ZodOptional<ZodString>; options: ZodOptional<ZodRecord<ZodString, ZodAny>>; property: ZodOptional<ZodString>; value: ZodOptional<ZodAny>; }, "strip", ZodTypeAny, { action: "custom" | "flyTo" | "setFilter" | "setPaintProperty" | "setLayoutProperty" | "easeTo" | "fitBounds"; bounds?: number[] | [number, number, number, number] | [[number, number], [number, number]]; filter?: any[] | null; layer?: string; options?: Record<string, any>; property?: string; value?: any; }, { action: "custom" | "flyTo" | "setFilter" | "setPaintProperty" | "setLayoutProperty" | "easeTo" | "fitBounds"; bounds?: number[] | [number, number, number, number] | [[number, number], [number, number]]; filter?: any[] | null; layer?: string; options?: Record<string, any>; property?: string; value?: any; }>

Defined in: packages/core/src/schemas/scrollytelling.schema.ts:101

Chapter action for map state changes.

Actions are triggered when entering or exiting a chapter. They can modify layer properties, filters, or trigger animations.

Action Types:

  • setFilter - Update layer filter
  • setPaintProperty - Update layer paint property
  • setLayoutProperty - Update layer layout property
  • flyTo - Fly to location (handled by chapter config)
  • easeTo - Ease to location (handled by chapter config)
  • fitBounds - Fit to bounds
  • custom - Custom action (handled by application)

Set Filter

onChapterEnter:
- action: setFilter
layer: earthquakes
filter: [">=", ["get", "magnitude"], 5]

Set Paint Property

onChapterEnter:
- action: setPaintProperty
layer: buildings
property: fill-extrusion-height
value: ["get", "height"]

Fit Bounds

onChapterEnter:
- action: fitBounds
bounds: [-74.3, 40.5, -73.7, 40.9]
options:
padding: 50
duration: 1000