Fox Mahoney has published some excellent Motion tutorials here on FCP.co. This time, he really takes the tools in Motion to a new level with this experiment in building custom behaviors. We learnt a lot.

 

From Apple's Documentation:

The Custom behavior lets you make your own behaviors by creating a set of parameters, then keyframing them to create the type of animation you want to apply to an object. By saving custom behaviors you create in the Library, you can build your own collection of behaviors to suit your needs.

Here we have a clue as to its intended purpose, and absolutely no indication of the multifaceted gem this tool really is. I could go on (and on and on…) but I'll simply focus on one (undocumented) use for this introduction.

This project takes three shape objects (circles), animates two of them and uses the Custom behavior for the third shape to always be centered between the other two, no matter where they are. This requires some math in real time… not a problem for Motion as you will see.

We're going to do this project twice: the first method highlights a specific point about Custom. The second method will fix a complication that arises in the first method (through no fault of our own!)

Our Project

In Motion, start a new HD 1080 Motion Project. The 16:9 aspect ratio (and canvas size) is important to the first part of this project. If you're worried about file size of the project, it makes no difference if it's HD or 8K. The actual file is XML and not based on pixel sizes at all. This is an extremely simple project and shouldn't create any performance issues no matter what your Mac's specs are.

When we're done, your project should look something like:

 custombehavior

 Here is what the completed project (version 1) should look like:

custombehavior 01

Nice and short. Notice the Custom behavior has been renamed with the suffix "blender" since this will be its purpose.

Select the Circle tool and in the Canvas, hold down the Option and Shift keys and draw a circle about 30-40 pixels wide. Go into the Properties tab and Reset the Position parameter to center the circle in the canvas. Set the Blend Mode to Subtract. Type Command-D twice to create two more copies.

Select the bottom Circle and in the Shape > Style inspector, turn off the Outline and set the Fill Color to Magenta (rgb: 1.0, 0.0, 1.0) [drag the Green primary to 0]. This shape will be our "follower" or centered object.

Select the middle Circle and set the color to Cyan (rgb: 0.0, 1.0, 1.0) [drag the Red primary to 0].

Select the top Circle and set the Fill color to Yellow (rgb: 1.0, 1.0, 0.0) [drag the Blue primary to 0]. You should now see a pale pink/white outline circle like an eclipse.

You could use Red, Green, and Blue with Additive blending, that also looks nice, but Blue tends to be a little dark compared to the Red and Green. Using subtractive colors makes all three have relatively the same brightness. You also don't need to do anything with Blend Modes if you don't want to, it's up to you.

Select the bottom circle (magenta) and go to the Behaviors menu > Parameter and select the Custom behavior.

This is what Custom looks like:

custombehavior 08

Not much. Quite literally: *nothing*. That's right, you have to add every parameter you will be using and if you look this over, you will find that just about *every* parameter that can be keyframed is available to add to this behavior. You can make a copy of every parameter you're going to use in this one place.

And the absolute GREAT part about this is: WHATEVER VALUES YOU MAKE IN THIS BEHAVIOR WILL BE *ADDED* to the original parameter it is based on… not replace: ADD. [*There are some parameters, like Fill Color that do replace - it will depend on the parameter, but in general, any numerical value parameter is additive.]

This is so cool we're literally going to do it twice for this project.

Select the Add menu and add a Properties > Transform > Position > All. Then do the same thing again! Like so:

custombehavior 06

And here they are: not one, but two copies of the Position parameter. You can add as many "copies" of the same parameter as you need for the project (as long as they are additive, otherwise, the last one you add will have control).

custombehavior 07

So now our shape has not one, not two, but three position parameters! (counting the original Transform > Position parameter which is not used in this demo). From here on out, we will only be using these two position parameters. I hope you're realizing the implications here! This is HUGE!

If you try adding more than one Link behavior to a parameter, Motion will not let you. You only get the one behavior. There are other behaviors that you can keep adding, like Randomize, etc. but Link is a much bigger deal because of its Scaling/Mix feature that allows you to perform simple math in Motion.

Let us pause for just a moment to consider the implications and impact of this.

  1. We can have as many copies of a parameter as we want all in ONE behavior!
  2. We can animate all of those copies independently of each other.
  3. ALL of their (same parameter) values will be SUMMED together!
  4. The summed value can be used as a source for some other object's parameter(s).

These four points really only just scratch the surface. What you can do with this is only restricted by how far you want to take it. On top of everything else, you can have multiple Custom Behaviors, each one can be published as a Checkbox for Final Cut allowing the user to turn on or off certain aspects of whatever portion of animations/calculations you devise. Custom is very much like a Patchbay…. Something to think about!

customPatchbayIllus

Okay… back to our simple demonstration.

Any change in any of these values will be added to the Parameter > Transform > Position parameters in the Properties inspector. Technically, these Custom values represent "delta" X, Y and Z. (Sometimes you will need to specify which exact parameter, X, Y or Z as the custom parameter added… deal with it later. Keeping this simple.)

The next step is to bring in the positions of the other two circles. We'll do that by Linking their positions to each of these Position parameters we've created for our Custom behavior. However, before doing that, let's get our other circles moving about so you can move the playhead and see the changes over time.

For the second and third circles, go into the Properties tab and right click on the Position label and from the popup menu, select Add Parameter Behavior > Randomize. This will automatically set up the X and Y parameters to be randomized at the same time.

custombehavior 05

Set the Amount values to about 450–500 and set the Apply Modes to Add and Subtract. By default, the random motion is quite "noisy" so turn the Noisiness down to 0 to 0.2 (0 will be straight line segments; 0.2 will be somewhat more "curvy") and set the Frequency to near 1 (you can, of course, adjust this to suit your own tastes.)

custombehavior 04

We're going to set the Start Offset to 15 (frames) and the End offset to 30 because we'll use a start-off pause and a finish making this effect loop-compatible. To make the randomized circles return to canvas center, set the playhead at 30 frames from the end of the project and set a keyframe on the Amount. Move the Playhead to the end and set the Amounts to 0. Looping playback will start and end from canvas center for a nice finish.

Click the Random Seeds of each a few times for each to make their paths very different from each other. You can toggle Command-/ to see the paths of the selected objects.

 custombehavior 03(Cyan circle selected. Random Motion path shown.)

For the next step, we will actually link the position of each of the randomly moving circles to each of the Position parameters we added to the Custom behavior.

Right click on one of the Custom.Position parameters and Add Parameter Behavior > Link. Drag the Circle 1 (cyan) object into the Source Object drop well. You will have to manually set the Source Parameter, so click on Compatible Parameters and select Properties > Transform > Position > All. Repeat this procedure with the "other" Custom.Position parameter and use the Circle 2 (yellow) object into the Source Object and set it's Source Parameter as well.

Play the project. You will have three objects, two moving randomly and the original (magenta) circle moving in relation to the other two but not centered, which is what we want. Remembering the midpoint formula from high school math:

custombehavior 02

We can set the Scale parameter of each of the Link parameters to 0.5. Unfortunately, it's still a little off. This is one of those situations where what goes on behind the scenes in Motion gets in the way. Our project/coordinate system is 1080 pixels high and 1920 pixels wide. Our Math is "square".

To keep this short, all that's needed is to adjust the second Link Scale by the Aspect Ratio of the canvas: 1.77777…. that is: 0.5 * 1.777777… which is 0.8888888…. Double click on the Scale parameter value (for the yellow circle Link) and type in: 0.888889 and Play the project. The middle circle should follow the motion of the other two right in the middle. I can't explain why this works… it just does (and the alternative method outlined below will prove it).

I cannot find the math for this solution anywhere (we're dealing with "whole points" and performing math on an X and Y of one of the points where logic dictates we should only be operating on the X dimension only — if somebody can explain to me why this works, I would love to see it! PS—this only works on the "second" point, the process is not interchangeable.)

Herein lies the complication: if we are to adapt this project to other aspects, we would need to create snapshots for each screen aspect ratio. For example, for a 4:3 project, we would need to set the second Link Scale to 0.666667 or 0.5 * 1.3333333… and so on. Shouldn't be an option! And that leads us to method #2.

Alternative method:

Making Motion deal with the aspect ratio issue

As a shortcut, select the parent group of our Circle set and duplicate it (Command-D) and delete the Custom and Link Behaviors from the (magenta) shape they're attached to. Turn off the original Group's checkbox. We're starting over from here inside the same project.

As a shortcut, select the parent group of our Circle set and duplicate it (Command-D) and delete the Custom and Link Behaviors from the (magenta) shape they're attached to. Turn off the original Group's checkbox. We're starting over from here inside the same project.

The order of the steps that follow is important!

Step one: Select the Circle's Transform > Position property, right click and select: Add Parameter Behavior > Link. Drag the cyan circle into the Source Object well. The compatible parameter will automatically be set because these are "like" parameters.

Step two: Add the Custom Behavior. In the Custom behavior, Add Properties > Transform > Position > All.

Step three: Right click on the added Position parameter and Add Parameter Behavior > Link. To the Source Object well, add the other (yellow) circle shape. You will have to manually set the Compatible Parameter to Properties > Transform > Position > All.

Step four: For both Link behaviors, set the Scale to 0.5. All three circles will align without having to deal with the Aspect Ratio differences. This is the exact midpoint formula math we want!

If you turn the original group's visibility back on, and did not change the Randomize behavior settings, you will see how the two methods compare. If you followed all the instructions for both, you will see outlines of the shapes (their Subtracted colors cancel their copies) and both sets should match exactly.

 

If you only have a passing interest in this topic and would like to just look at this project, you can download the project file-  Motion Custom Behaviour Project.

As a bonus and a thank you for visiting us here at FCP.co and reading this article, here is a Title that uses the same technique (method #2 — aspect ratio indifferent):
Motion 3 Lines Aligned Project — you'll need to realize that the aligned points are the left edge baselines and that there are likely to be optical illusions particularly when scaling. I've tested it with measuring tools and grids and those positions are spot on regardless of how it looks.

Here's another Motion demo with an emitter's position controlled by five oscillators with a tiny bit of frequency modulation thrown in:

Afterthoughts

The point of this demo was to illustrate that an object's parameters could be… diversified, expanded.

Custom is adapted to its container, meaning different types of objects will have specific sets of parameters available to add. Like the Link behavior, many of those available parameters will extend to filter and behavior settings as well as the core parameters of the object. It's a whole universe of variation, recombination, possibilities.

Not mentioned until now is at the very base use of Custom is the ability to add a user controllable parameter for one already keyframed. If you've ever tried to publish a keyframed parameter in a template to FCPX, I'm sure you've discovered that the keyframed parameter will not work—you have to go to an alternate source, for example, the parent group's equivalent parameter. Custom gives you another method to add to your arsenal and you can always add one more copy of a parameter for publishing to FCPX.

Oh, and by the way: there are actually a few surprises in the parameters you can Add. For example, in an Emitter > Cell Controls > Angle and Angle Randomness, you only have access to Z rotation, but in Custom, you have access to X, Y & Z rotations—and they work!

 

fox-mahoney  —F•X

 Many more templates to download on  FCPXTemplates.com

 Take a look at  YouTube.com/fxmah for more templates & tutorials.

 

  ©2017 FCP.co