A WordPress plugin that adds scroll-driven animation capabilities to core blocks using CSS scroll timelines. This plugin extends supported WordPress core blocks (Paragraph, Image, Heading, Columns, Group) with a Scroll Animation panel in the block editor.
- π¨ 8 Animation Types: Fade In, Slide In (Left/Right/Up/Down), Scale Up, and Rotate In
- π― Core Block Support: Works with Paragraph, Image, Heading, Columns, and Group blocks
- π CSS-Powered: Uses native CSS scroll timelines for optimal performance
- β¨ No JavaScript Required: Pure CSS animations on the frontend
- π§ Easy to Use: Simple dropdown in the block editor settings panel
- βΏ Accessible: Respects
prefers-reduced-motionfor users who need reduced animations
- None: No animation (default)
- Fade In: Element fades in as you scroll
- Slide In Left: Element slides in from the left
- Slide In Right: Element slides in from the right
- Slide In Up: Element slides up from below
- Slide In Down: Element slides down from above
- Scale Up: Element scales up from smaller size
- Rotate In: Element rotates as it appears
- WordPress 6.8 or higher
- PHP 7.4 or higher
- Modern browser with CSS scroll timeline support
- Clone the repository:
git clone <repository-url>
cd my-scroll-block- Install dependencies:
npm install- Build the plugin:
npm run build- Start development mode (with live reload):
npm start- Build the plugin:
npm run build- Create a zip file:
npm run plugin-zip- Upload and activate the plugin in WordPress
npm start- Start development mode with live reloadnpm run build- Build for productionnpm run format- Format code with Prettiernpm run format:check- Check code formattingnpm run lint:css- Lint CSS filesnpm run lint:js- Lint JavaScript filesnpm test- Run Playwright testsnpm run test:headed- Run tests with visible browsernpm run test:debug- Run tests in debug modenpm run test:report- View test reportnpm run typecheck- Validate TypeScript typesnpm run plugin-zip- Create plugin zip file
This project uses Playwright with TypeScript for end-to-end testing with WordPress Playground.
- Install Playwright browsers:
npx playwright install --with-deps chromium- Run tests:
npm test- Check TypeScript types:
npm run typecheckFor more details, see tests/README.md
Tests are written in TypeScript for:
- β Type safety and error prevention
- β Better IDE autocomplete
- β Self-documenting code
- β Catch errors before runtime
See TYPESCRIPT_MIGRATION.md for migration details.
- Add or select a supported block (Paragraph, Image, Heading, etc.)
- Open the block settings panel on the right
- Find the "Scroll Animation" section
- Select your desired animation type from the dropdown
- A visual indicator appears on the block showing the animation is applied
When a block has a scroll animation:
- The plugin adds CSS classes:
scroll-anim-blockandscroll-anim-{type} - A data attribute
data-scroll-anim="1"is added - CSS scroll timeline rules trigger the animation as you scroll
- No JavaScript is executed on the frontend
my-scroll-block/
βββ build/ # Compiled assets (generated)
βββ src/ # Source files
β βββ index.js # Main editor script
β βββ editor.css # Editor styles
β βββ style.css # Frontend styles
βββ tests/ # Playwright tests
β βββ scroll-block.spec.js
β βββ global-setup.js
β βββ global-teardown.js
βββ my-scroll-block.php # Main plugin file
βββ playwright.config.js # Playwright configuration
βββ package.json # Node.js dependencies
βββ README.md # This file
This plugin uses modern CSS features including:
- CSS Scroll Timelines
- View Timeline
- Animation Timeline
Check Can I Use for current browser support.
This plugin respects the prefers-reduced-motion system preference. When a user has reduced motion enabled in their operating system settings, all scroll animations are automatically disabled.
For more details, see Reduced Motion Support Documentation.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
npm test - Format code:
npm run format - Submit a pull request
The project uses GitHub Actions for CI:
- Runs on every push and pull request
- Tests with Chromium only
- Uploads test reports on failure
GPL-2.0-or-later
Built with:
For issues and questions:
- Check the tests/README.md for testing documentation
- Review existing GitHub issues
- Create a new issue with detailed information
- Initial release
- Support for 8 animation types
- Block editor integration
- CSS scroll timeline animations
- Playwright test coverage