February 20, 2021

EA Sports NHL 21 Expressions – Extended.

This is a closer look at some of the extra controls that were implemented inside of the EA NHL 21 toolkit. The image above displays one of the lower third deliverables that contained a bounding box which would expand or contract based on the length of the type. In addition, I also needed to figure out a way to constrain each of the scripted elements to only animate within a certain region. This was necessary in order to keep these elements from animating all over the place, obscuring the type.

The purple guides represent the min, max, boundingmin, and boundingmax for the X and Y Transform properties. After updating type layers, the user selects each guide and fits it to the outside bounds of the bounding box and the type respectively. They could then right click on each guide to get its value to apply to each corresponding effect.

Code:

min = thisComp.layer("Controls").effect("Min X")("Slider");
max = thisComp.layer("Controls").effect("Max X")("Slider");
boundingmin = thisComp.layer("Controls").effect("Bounding Min X")("Slider");
boundingmax = thisComp.layer("Controls").effect("Bounding Max X")("Slider");
posterizeTime(max/1920+1);
seedRandom(index);
if (random(1) >= 0.5) {
random(min, boundingmin);
} else {
random(boundingmax, max);
}

Code Breakdown:

min = thisComp.layer("Controls").effect("Min X")("Slider");
Find the layer named Controls inside this composition, and on that layer, grab the value from the effect called Min X, which is a Slider Control.

max = thisComp.layer("Controls").effect("Max X")("Slider");
Find the layer named Controls inside this composition, and on that layer, grab the value from the effect called Max X, which is a Slider Control.

boundingmin = thisComp.layer("Controls").effect("Bounding Min X")("Slider");
Find the layer named Controls inside this composition, and on that layer, grab the value from the effect called Bounding Min X, which is a Slider Control.

boundingmax = thisComp.layer("Controls").effect("Bounding Max X")("Slider");
Find the layer named Controls inside this composition, and on that layer, grab the value from the effect called Bounding Max X, which is a Slider Control.

posterizeTime(max/1920+1);
Posterize the time by dividing the max (3840) by 1920 and then add "1". We are forcing this layers animation to be posterized by the predefined max value, dividing it by half the comp size, giving us a value of "2" and then adding "1" to it. Since there were multiple layers using this expression, I either added a value from 1-5 or subtracted a value from 1-5 to give each layer an extra step of randomness.

seedRandom(index);
Generate a random seed value based on a layers index. What is great about this line is that if a change the layer order, add more layers, or remove layers, this will always generate a different value which worked great for my purposes.

if (random(1) >= 0.5) {
random(min, boundingmin);

If the value created randomly by random(1) (which will either be a 0 or a 1) is greater than or equal to 0.5, then generate a random value between the min and boundingmin values.

} else {
random(boundingmax, max);
}

If the value generated is less than 0.5 , then generate a random value between the boundingmax and max values.

December 23, 2020

Simulation Therapy.

December 23, 2020

EA Sports NHL 21 Expressions.

I wanted to share a couple tips and tricks I learned throughout this project. What I wanted to figure out was a way to automatically animate some simple elements all over the screen without having to keyframe everything, knowing I would need more control of them later on. For this to work properly, you need to Separate Dimensions on the Transform property of your layer first.

Code:

min = 0;
max = 3840;
posterizeTime(max/1920+1);
seedRandom(index);
random(min,max);

Code Breakdown:

min = 0;
Set the minimum amount of units (pixels) this layer can move.

max = 3840;
Set the maximum amount of units (pixels) this layer can move.

posterizeTime(max/1920+1);
Posterize the time by dividing the max (3840) by 1920 and then add "1". We are forcing this layers animation to be posterized by the predefined max value, dividing it by half the comp size, giving us a value of "2" and then adding "1" to it. Since there were multiple layers using this expression, I either added a value from 1-5 or subtracted a value from 1-5 to give each layer an extra step of randomness.

seedRandom(index);
Generate a random seed value based on a layers index. What is great about this line is that if a change the layer order, add more layers, or remove layers, this will always generate a different value which worked great for my purposes.

random(min,max);
Generate a random value in between the min (0) and max (3840) on every frame.

© 2021 Faelism