This project using scrollama.js and d3.js to create a scrollytelling experiencing about hurricanes.
- Smooth Transition: Animated morphing between the two chart types
- Scroll-Triggered Animation: The transition is controlled by the user's scroll position
- Interactive Visualization: Number of recorded hurricanes per month for the top five global activity regions are plotted when a specific year button is clicked
-
Clone the repository:
git clone <repository-url> cd chart-transition -
Install dependencies:
npm install # or yarn install -
Start the development server:
npm start # or yarn start -
Open your browser and navigate to
http://localhost:3000
imagesfolder- Linked images for sitechart.html- Interactive visualization showing historical seasonality of hurricanesd3.v4.min.js- Necessary D3.js codeindex.html- Primary html file to run in browserscript.js- Primary javascript file where steps for the scollytelling are declaredscrollama.js- Code to get the scrolling feature to workstyles.css- Stylestropical_cyclones_filtered.csv- Filtered data for chart.html to draw visualization
-
Data Preparation: The
chart.htmlloads and parses the data,tropical_cyclones_filtered.csvto be able to draw the visualization. -
Scrollama Integration:
index.htmlcomponent uses the Scrollama library to track scroll position and update the step images on the right of the screen. -
Swap Function: The function
swapImagesin thescript.jsuses two images declared in theindex.htmlto display a set a default image (A) so the images to be changed on the right-side of the site will be swapped out (B) as they are declared in thescript.jsfile. -
image-c: iframe visualization:
chart.htmlis added as id="image-c" within theindex.htmlso it may be swapped in thescript.jsas step 18. -
sticky text: In the
script.js, style: position "sticky" is added onto steps where the text should stick when the page is scrolled. Style: position "relative" is used when the text should no longer be sticky.
The includes one standalone chart component that can be used independently:
- chart.html: The main component that draws the interactive visulaizations of hurricane seasonality from the data file
The project includes a simplified version of the default Scrollama example. To use this demo:
- Open
src/App.jsx - Uncomment the
Democomponent in the return statement - Comment out the other chart components
This provides a simpler starting point for understanding how Scrollama works with basic animations.
- D3.js
- Scrollama.js
- D3.js for data visualization
- React Scrollama for scroll-based interactions