Described on GitHub as a "functional reactive library for animating layout," SamsaraJS is the brainchild of David Valdman, who left Famo.us -- now known as Famous -- in August 2014. The library, which recently released version 0.2.0, grew out of his work there.
"SamsaraJS gives Web developers a tool to create native-like app experiences," Valdman said in an email. The library was created to solve performance issues on the mobile Web.
SamsaraJS provides a language for positioning, orienting, and sizing DOM elements and animating these properties. Everything from the user input to the rendering pipeline is a stream, so building a user interface becomes the art of composing streams, according to Samsara's GitHub explanation.
Valdman said Web developers are held back primarily by two factors: performance on mobile, and expressiveness. "By expressiveness, I mean a way to think about interactivity in user interfaces that isn't watered down. With CSS3 we could finally have animation," he said. "But coordinating the animation of dozens of items, tying that to user gestures, incorporating physics and 3D space, that's well out of the reach of CSS3." SamsaraJS is trying to make this simple without compromising on performance, he said.
Asked how SamsaraJS compares with other JavaScript technologies including Famous, React, or Angular, Valdman said it was focused on one element: layout. "That means x, y, z positions; heights and widths; opacity. These are the kinds of things that change at 60fps when animation and responsive design are involved. These are also the greatest barriers to performance. Other MVC frameworks are concerned with content, and mostly leave layout to the developer."
Since content does not change at 60fps, these frameworks focus on very different problems: data-binding, routing, and so on, said Valdman. "SamsaraJS is meant to be used with one of these frameworks, where it controls the layout and the framework populates it with content. This harkens back to the original separation of concerns of the Web."