Introduction: Modern SharePoint Pages, But Static
Modern SharePoint pages have become the standard for internal communication, dashboards, and enterprise landing pages. Yet they often suffer from a common visual flaw: all content appears simultaneously on load, giving the impression of a flat and static page.
This is precisely the problem addressed by Anim Page Motion, an open-source SPFx web part presented by Diab, a Microsoft 365 and SharePoint developer based in France. The central idea: bring configurable motion effects to modern SharePoint pages, without touching existing web parts.
Fundamental Principle
The purpose of animation is not decorative. Motion should guide user attention, create a reading rhythm, and reinforce the perception of modernity — without ever competing with content.
The UX Problem of Static SharePoint Pages
In most SharePoint deployments, page authors have few tools to improve visual experience without involving a development team. Standard web parts do not expose animation properties, and creating custom page templates represents significant effort.
The consequences are visible:
- Critical content is not visually emphasized
- Scroll experience lacks dynamism
- Important pages (HR, communication, onboarding) struggle to capture attention
Anim Page Motion addresses this need by adding a lightweight and optional animation layer on top of existing web parts.
Technical Architecture of Anim Page Motion
Technology Stack
The solution relies on the modern SPFx stack with the following components:
| Component | Technology | Role |
|---|---|---|
| SPFx Framework | SPFx 1.21 + Node 22 | Web part foundation |
| UI | React 17 + TypeScript | Property pane interface |
| Page Access | PnPjs 4 (ClientSidePage) | Scan existing web parts |
| Animation | CSS presets + Intersection Observer | Effect triggering |
| Build | Gulp (SPFx toolchain) | Compilation and packaging |
Execution Flow
Anim Page Motion's operation follows a four-step workflow:
SharePoint Page Scan
When the web part loads, the PageScannerService uses ClientSidePage from PnPjs to load the complete model of the modern page. It traverses sections, columns, and controls to extract a simplified list of present web parts, including their identifier, title, and position.
1// Simplified example of using PnPjs to read a modern page2import { spfi } from "@pnp/sp";3import { ClientsidePageFromFile } from "@pnp/sp/clientside-pages";4 5const page = await ClientsidePageFromFile(sp.web.getFileByServerRelativePath("/sites/mysite/SitePages/home.aspx"));6const controls = page.sections7 .flatMap(s => s.columns)8 .flatMap(c => c.controls);Dynamic Property Pane Generation
Based on the list of detected web parts, the property pane is dynamically generated. Each web part becomes an independently configurable element. The page author can interact with this configuration without leaving SharePoint's edit interface.
DOM Element Targeting
At runtime, for each web part with animation enabled, the system locates the corresponding HTML element in the DOM using the SharePoint web part instance identifier (data-sp-webpart-id). This mechanism guarantees precise targeting without dependence on CSS classes or the internal DOM structure of the component.
Viewport Observation and Animation Application
The RevealOnScrollService takes over. It uses the native Intersection Observer API to detect when a targeted element enters the viewport. At that moment, a CSS class corresponding to the selected animation preset is dynamically applied to the element.
1// Principle of RevealOnScrollService2const observer = new IntersectionObserver((entries) => {3 entries.forEach(entry => {4 if (entry.isIntersecting) {5 entry.target.classList.add(`anim-${animationType}`);6 if (playOnce) observer.unobserve(entry.target);7 } else if (!playOnce) {8 entry.target.classList.remove(`anim-${animationType}`);9 }10 });11}, { threshold: 0.1 });12 13observer.observe(targetElement);Configuration Options for Page Authors
All the power of Anim Page Motion lies in its configurability from the property pane, without any code. For each web part detected on the page, the author has the following options:
- Enable/disable: animation is opt-in per web part
- Animation type: fade, slide, fade-up, fade-up-strong (CSS presets)
- Delay: allows progressive appearance by offsetting animations between web parts
- Playback mode: once on first scroll, or replayed each time it enters the viewport
- Assisted navigation: clicking a web part name in the property pane scrolls the page to it and highlights it
Tip for Page Authors
Use the delay + fade-up combination for sections that appear progressively on scroll. Start with a 100ms delay for the first element, then increment by 150ms for each subsequent web part in the same section.
Design Principles: Security and Maintainability
Independence of Targeted Web Parts
One of the most important architectural choices is that animated web parts do not need to be modified. No code changes, no special configuration, no dedicated page template. This means Anim Page Motion works with:
- Microsoft standard web parts (news, quick links, documents...)
- Third-party web parts deployed via the app catalog
- Custom web parts developed by other teams
Lightweight CSS Layer
The animation layer is intentionally CSS-based rather than JavaScript-based. This approach offers several advantages:
- Optimal performance (GPU-accelerated animations via
transformandopacity) - No interference with web part business logic
- Easy customization via additional presets
- Graceful degradation if JavaScript is disabled
Accessibility and Readability
Accessibility
In an enterprise SharePoint context, animations must respect the user preference prefers-reduced-motion. Responsible implementations disable or reduce animations for users who have enabled this setting in their operating system.
Technical Lessons from Development
Development of Anim Page Motion highlighted several critical points for any SPFx developer working on page manipulations:
-
SharePoint DOM is dynamic: the page model and rendered elements are not immediately available at the web part's
onInit()moment. It is necessary to wait until the page is fully rendered before scanning web parts and attaching observers. -
UX impact can be significant without complete overhaul: a lightweight and targeted improvement layer can transform the perception of a page without requiring replacement of existing components.
-
Optionality is a feature: making animations entirely optional and controllable by the author ensures the solution remains viable in varied enterprise contexts.
PowerShell Script: Deploy the Web Part via PnP PowerShell
To deploy Anim Page Motion in your SharePoint tenant, you can use PnP PowerShell to automate adding the package to the app catalog:
1# Connection to the app catalog site2$AdminUrl = "https://yourtenant-admin.sharepoint.com"3$AppCatalogUrl = "https://yourtenant.sharepoint.com/sites/appcatalog"4 5Connect-PnPOnline -Url $AppCatalogUrl -Interactive6 7# SPFx package deployment8$app = Add-PnPApp -Path ".\anim-page-motion.sppkg" -Overwrite9Publish-PnPApp -Identity $app.Id -SkipFeatureDeployment10 11Write-Host "Anim Page Motion deployed successfully. ID: $($app.Id)" -ForegroundColor Green12 13# Status verification14Get-PnPApp -Identity $app.Id | Select-Object Title, Deployed, AppCatalogVersionPackage Availability
The source code and .sppkg package are available in the official SP-Dev-FX-WebParts repository from Microsoft on GitHub, in the community samples section. Search for anim-page-motion to access the complete implementation.
References and Resources
- SharePoint Framework Samples Repository - sp-dev-fx-webparts
- PnPjs Documentation - ClientSidePage
- MDN Web Docs - Intersection Observer API
- SharePoint Framework Overview - Microsoft Learn
- PnP PowerShell - Add-PnPApp
- CSS prefers-reduced-motion - MDN
Conclusion
Anim Page Motion perfectly illustrates how SPFx remains a powerful lever for filling real UX gaps in SharePoint, aligning with the platform's model rather than circumventing it. By combining PnPjs for page scanning, Intersection Observer for viewport detection, and lightweight CSS presets for animations, this solution brings tangible value to page authors without imposing technical burden on development teams.
The approach — an optional, non-intrusive, and fully configurable improvement layer — constitutes a reusable pattern for other modern SharePoint page enhancement scenarios.



