Imagine watching two triangles and a circle move around a screen. They dart, pause, and chase each other. Without any words, you instantly perceive a story: one shape is bullying another, or two are playing. This is the magic of a Heider-Simmel animation, a classic psychology tool that shows how humans see social intent in simple geometric motion. But creating these animations by hand is tedious and limited. Now, a new approach called fog is changing that by using layered function composition of code to generate rich, expressive motion automatically. This breakthrough has big implications for AI, animation, and how we build interactive characters.
In the 1940s, psychologists Fritz Heider and Marianne Simmel created a short film of moving shapes. They found that people couldn't help but describe the motion in human terms, "the big triangle is chasing the small one," "the circle is trying to escape." This revealed that our brains are wired to see intentions and emotions even in abstract movement. Today, Heider-Simmel animations are used in research on social cognition, autism, and artificial intelligence. They're also a benchmark for testing whether machines can understand social behavior.
But here's the problem: crafting these animations to be truly expressive is hard. You need to control speed, direction, timing, and interaction between shapes. Doing that manually frame-by-frame is slow and doesn't scale. That's where fog comes in.
The fog system takes a radically different approach. Instead of drawing shapes directly, it builds motion by composing simple functions of code in layers. Think of it like building a complex machine out of Lego bricks. Each brick is a small piece of code that does one thing, move a shape in a curve, make it pause, or change its speed. By stacking these bricks in clever ways, you can create surprisingly rich and lifelike behaviors.
For example, a "chase" behavior might be built from a function that points one shape toward another, plus a function that adjusts speed based on distance, plus a function that adds a little jitter to make it feel organic. The fog system lets you combine these functions in layers, so you can tweak one layer without breaking the others. This is a huge step up from traditional animation tools, which often force you to choose between simplicity and control.
Why code? Because code is modular, reusable, and parameterized. You can write a function once and use it in many animations. You can change a single number to make a shape faster or slower. You can even write higher-level functions that combine lower-level ones into new behaviors. This makes the whole process more efficient and expressive.
At first glance, fog might seem like a niche tool for animators. But it's actually a powerful example of a broader trend: using code as a medium for AI-driven generation. Large language models (LLMs) are getting very good at writing code. They can generate functions, combine them, and even debug them. If you can describe a motion in plain English, "make the big triangle bully the small one", an AI could potentially write the layered functions needed to bring that to life.
This opens up exciting possibilities. Imagine a future where you can type a scene description and an AI automatically generates a Heider-Simmel animation that captures the right social dynamics. Researchers could rapidly prototype experiments. Game designers could create more believable non-player characters. Educators could build interactive lessons about social cues. The fog approach provides a structured, composable foundation that makes this kind of AI generation much more feasible.
Moreover, the layered nature of fog is a natural fit for program synthesis, a subfield of AI that automatically generates programs from specifications. An AI could learn to compose functions from a library to match a desired motion profile. Because the functions are small and well-defined, the search space is manageable. This could lead to AI systems that not only generate animations but also explain their choices, a big step toward trustworthy AI.
So how will this be used in the real world?
Studios spend millions on animating crowd scenes or character interactions. Fog-style composition could automate the generation of background motion, making it cheaper and faster. Directors could tweak parameters to get the exact emotional tone they want, more aggressive, more playful, more hesitant. This doesn't replace human animators; it gives them a powerful new tool.
As virtual assistants and social robots become more common, they need to express intent through movement. A robot that moves in a way that feels "friendly" or "cautious" can build trust with humans. The fog system provides a way to design and generate these expressive motions systematically. Instead of hand-coding every gesture, developers can compose functions to create a library of social behaviors.
Heider-Simmel animations are a staple of social cognition research. With fog, researchers can generate hundreds of variations automatically, testing how subtle changes in motion affect perception. This could accelerate our understanding of how people interpret social cues, and how that differs across cultures or in conditions like autism.
Imagine a training simulation for conflict resolution. The characters' movements could be generated on the fly to reflect different emotional states. Fog makes it easy to adjust the intensity of a confrontation or the warmth of an interaction. This kind of dynamic, responsive animation could make training more engaging and effective.
Of course, no approach is perfect. Generating truly expressive motion is still hard. The fog system relies on a library of functions, and designing those functions requires expertise. There's also the challenge of evaluation: how do you measure whether an animation is "expressive" or "lifelike"? Human judgment is subjective and varies. Researchers will need to develop better metrics and user studies.
Also, while code composition is powerful, it can become complex. Layering many functions might lead to unpredictable interactions. The system needs good tools for debugging and visualization. And for AI integration, we need models that can understand the semantics of functions, not just their syntax, to compose them meaningfully.
Despite these hurdles, the direction is clear. The fog system shows that treating motion as composable code is a fruitful path. It bridges the gap between low-level control and high-level expressiveness. And as AI gets better at code generation, the loop between human intent and machine execution will tighten.
The bigger lesson here is that code is becoming a universal interface for creation. Just as natural language lets us communicate with AI, code lets us specify complex behaviors precisely. The fog approach demonstrates that even something as nuanced as social motion can be broken down into programmable pieces. This is a template for other domains: music generation, procedural design, even storytelling.
In the near future, we can expect AI systems that don't just generate a final artifact, but generate the code that generates the artifact. This is more transparent, more editable, and more reusable. A business could own a library of motion functions and have an AI compose them on demand for different products. A researcher could share a set of functions that others can remix. This ecosystem of composable code could accelerate innovation across industries.
For AI researchers, fog highlights the importance of neuro-symbolic approaches, combining neural networks (which excel at perception and language) with symbolic programs (which excel at reasoning and composition). The layered functions are a form of symbolic representation that an AI can manipulate. This hybrid approach is likely to be key to building AI that is both creative and controllable.
The fog system is a clever solution to a specific problem, generating expressive Heider-Simmel animations, but its implications ripple far beyond. It shows how code composition can make motion generation more modular, scalable, and accessible. As AI becomes more adept at writing and combining code, we'll see a new wave of tools that turn natural language descriptions into rich, dynamic behaviors. Whether you're a game developer, a psychologist, or a business leader, this trend is worth watching. The future of animation, and of AI itself, may be written in layers of code.