SamsaraJS is a functional reactive library for animating layout. It provides a language for positioning, orienting and sizing DOM elements, and animating these properties over time. According to its GitHub page, “Everything in SamsaraJS—from the user input to the rendering pipeline—is a stream, [and] building a user interface becomes the art of composing streams.”
Recently, Valdman tweeted that “It’s time we think of layout on the Web in a whole new way—3D, fluid, coordinated, reactive.” He was quoted in JavaWorld saying that Web developers are held back by two factors: performance on mobile, and expressiveness. By expressiveness, he meant that Web developers need to think about interactivity in user interfaces that isn’t “watered down.”
SamsaraJS was also created to solve performance issues on the mobile Web. Under the hood, “Animations are hardware-accelerated and batched by a single request animation frame loop,” said Valdman’s GitHub page. Developers can build responsive user interfaces with physics-based transitions, support for gestures, and a stream architecture that makes coordinating complex animations “simple.”
Some features that come with SamsaraJS include:
- Full 3D space that can allow for depth and perspective in apps.
- SamsaraJS exports CSS3 hardware to avoid DOM reflow and keep applications running at 60 frames per second. Developers can skew, scale, rotate without impacting performance.
- Responsive design can be used to distribute content or adapt a layout to resizing elements.