Is Within
Intro
Switch properties based on whether a Shape's position falls within another. Is Within will output a value of 0
when a Shape is outside
the Within Shape and 1
when it is inside
.
UI
Within Shape - Connect a shape to be used as the boundary for other shapes to fall within.
Lines containing 2 points can be used as the Within Shape. The left side of the line is considered the inside — imagine walking along the line in its path direction and looking left. Path direction can be viewed in the Viewport by selecting a Shape with the Edit Shape tool.
If using a Basic Line then remember to reduce Divisions to 0.
Invert - Switch the result so that 0
is output when a Shape is inside the Within Shape and 1
when it's outside.
- Create 2 Polygons.
- Name them Poly and Zone.
- Create an Is Within Behaviour.
- Connect zone.id→isWithin.withinShape.
- Create a Color Array.
- Add a second index to the array and set a color.
- Connect isWithin.id→colorArray.index.
- Connect colorArray.id→poly.fillColor.
As Poly is moved, when its pivot is within the Zone Shape, its color will change to the second index of the Color Array.