Learn how to interact and trigger the onClick behavior built into certain dynamic components.
- [Instructor] Some dynamic components support interaction, and this happens with a dedicated tool called the Interact Tool. And this is actually hinted at here. It says, to change the color of Sophie's shirt, use the Interact tool, or select a new color from the following dropdown list. And we've already seen how we can change the color from the dropdown list. But there's also a dedicated tool at the bottom of the Tools menu, both on the Mac and the Windows platforms, and this tool works like this.
You just click on the item, and it will trigger a behavior that's built into the dynamic component. And in this case, it is cycling through the different elements in the dropdown list. As I click here, you'll see that we're just cycling through blue, red, gray, blue, red, gray. And that behavior is built into the dynamic component through the onClick action. That's right here. So Interact is triggering onClick.
And that is setting the color to each one of these three different elements, Sophie_Shirt_Gray, Sophie_Shirt_Blue and Sophie_Shirt_Red. Those colors are defined in the material. So if I go to the material, I can go to colors in model, and then you're going to find in here, some are going to have Sophie_Shirt_Red, and we have different Sophie colors and Stacy colors in here. But these are cycling through the materials that have been defined here, Sophie_Shirt_Red, Sophie_Shirt_Blue and Sophie_Shirt_Gray.
And so the spelling and the capitalization is important that you match up the material name with what you've typed in here. And that's how we can interact in this particular case. Now, other components may allow you interaction in a different mode, or they might let you interact and do different things, like triggering animations, for example. Somewhere in this list you'll find a car. Here's the Car Sedan. I'll drag and drop that into the scene. And it uses Interaction in a different way. And it tells you about that over here.
See it says Click on the hood with the Interact tool to select a new paint job. So I'll go up to Tools, Interact, and then click on the hood. And this actually triggers an animation that scales up these little spheres, and then it says Click to choose color. And that's kind of a novel interface that we have here. So if you want to learn how that was accomplished, of course you can delve into it by looking into the Component Attributes and studying how this was done here.
It's setting a material and it's also making an animation happen. And there's more to it, but this is the entry point into, you know, figuring out how these things work. But don't worry, I don't expect you to reverse-engineer something from scratch. We're going to build a number of projects step-by-step and that will give you the knowledge you need to reverse-engineer dynamic components in the future.
- Using premade dynamic components
- Saving dynamic components to local libraries
- Creating dynamic components: fences, bookcases, cabinets, and furniture
- Adding position and size attributes
- Adding formulas
- Creating swatch components
- Nesting component parts
- Adding an interface for custom attributes
- Animating component properties
- Dynamically scaling materials