I want to place a clipping mask on a red box that I am going to animate as moving fluid.
The next drawing right below the mask is an "empty container".
I want the red box to move up and down the white cube as is it is filling the container.
Check video below. How can I do this?
You are using the right tools - just need to tweak how you are using them. The clipping mask clips the layer it is on by ALL of the following children under the same parent. So I tend to create a new group then put the red cube and the following clipping object in that group. That stops the following layers getting involved in the clipping. I think what you are seeing is it is being clipped by the white box AND the brown square. That is because the brown square is a sibling after the clipping layer.
So, create a group, put the red cube in it with clipping on, then put a while cube in there as well after it. (I think you can hide it if you want to but a copy there - even when hidden I think it still clips.) This mistake you are making is only that you assume the clipping command uses the next layer only, instead of all following layers under the same parent.
So I created a new layer with just the blank cube and the red cube.
The red cube is on top and the blank white cube is on the bottom.
The white cube is made of a group of pen lines of black stroke and no fill.
It seems like the mask is working only on the stroke but the no fill area doesn't show anything.
Maybe I need to create some transparent color to give an illustion of an empty container and make the mask work as it moves through the transparent color?
I think I am gonna have to draw a wihte background in which I can place the line drawings on top, then make the mask right on top of the white background.
Needed to add a white background for the mask to show.
Yes, you need a solid filled in shape to do the clipping. I personally would be tempted to create a group, put the red cube in it, duplicate the cube and make it the second child of the new group, and then hide that duplicate layer. I am pretty sure even hidden layers will clip, so you will have a shape the same size. You then move the first cube up and down.
- - Red Cube (with clipping enabled)
- - Clone of Red Cube (hidden)
- Black lines of cube
There are different ways you can do it, but the clipping mask needs to be solid (filled in) where you want it visible.