Toon Flare

Toon Flare is an After Effects script that generates randomized, stylized lens flares built from a single shape layer.

Installation

Toon Flare runs as a ScriptUI Panel with a button if you install it like this:
Quit After Effects if it is running. Move the file "Toon Flare.jsxbin" to your “ScriptUI Panels” folder, which is located here:
Windows: Program Files\Adobe\Adobe After Effects <version>\Support Files\Scripts\ScriptUI Panels
Mac OS: Applications/Adobe After Effects <version>/Scripts/ScriptUI Panels
Launch After Effects and click Window > Toon Flare.
You can also run Toon Flare straight from the Scripts folder, or from a launcher utility like KBar, and it’ll just do it’s stuff with no panel.

Usage

Run the script and it will generate a new Toon Flare and null controller layer. Move the controller layer around to see how the flare looks in motion. Keep the controller layer selected, run the script again and instead of making a second flare, it will replace the existing one. Keep clicking, and you can cycle through several randomized flares until you get one you like.
The flare layer has an effect on it called Toon Flare, with the following controls:
Control Layer
You can select a layer in the dropdown to tell the flare to use a different layer as it's origin point. Don't select the flare layer itself in this dropdown.
To randomize a flare, the Control Layer dropdown in the Toon Flare effect must be assigned to a layer, and you must have this assigned layer selected in the timeline.
Scale
Each flare layer contains several elements. The Scale control will scale every element up or down.
Brightness
The Brightness settings are modifiers that affect the Opacity of each element as it moves towards or away from the center of the comp. Max Brightness is reached at the center of the comp, and Min Brightness is reached at 1.5x the distance from the centre of the comp to a corner. Brightness settings modify the underlying value of each element's Opacity. So with the default settings of Min 50% and Max 100%, an element with an Opacity of 60, will be 60 when at comp center, and 30 when outside the comp edges.
Aperture Blades
The number of sides that Iris elements have.

Elements

You can customize the elements within a flare by delving in to the shape layer contents. Each element is contained in a single Shape Group with a name like Soft Glow or Flat Iris 1 . You can move them along the flare's axis with the Offset > Amount inside each element group.
When you select the Toon Flare layer, you will probably see a lot of shape outlines in the comp. It's useful to turn these wireframes off and on again by hitting Cmd/Ctrl+Shift+H or clicking on View > Show Layer Controls.
Offset
The Offset property inside each element shape group is actually a Pucker & Bloat operator, but it's visibility is turned off so that it has no effect on the shape. The Amount is used as a dummy property to determine where the element lies along the flare axis. A value of 100 will place the element precisely over the origin - where the control layer is. A value of -100 will place the element precisely opposite that point, on the other side of the comp. There is no limit to the Offset value.
Since the Offset is a dummy property, if you turn on it's visibilty eyeball, it will Pucker or Bloat the element. So don't do that.
Scale
Each element group has an expression on it's Transform > Scale property so that it gets bigger or smaller with the main Scale control described above, but you can still alter the underlying value yourself. This is the best way to make elements bigger or smaller.
Colors
Most elements have their Opacity (Brightness) automatically modified by expressions on the Fill or Gradient Fill Opacity property. The underlying value can still be changed to make the element brighter or dimmer.
You can also change the Fill or Gradient Fill colors. Most colors are randomly assigned within a warm range of hues. If you want to shift all the colors in the flare together…
Toon Flare looks significantly different, and more realistic, if you set your project to 32bpc (go to File > Project Settings > Color > Depth). Do be aware that this setting is project-wide and can affect how other compositions appear.

Customizing further

Try changing the blending mode of the flare layer. Add, Screen, Soft Light and Hard Light can all look good.
To change all the colors of a Toon Flare at once, try using an effect on the layer:
Hue/Saturation - Change the Master Hue property to quickly shift the warm hue to a cooler one.
Curves - For full creative control over colors.
Colorama - Go crazy with extreme stylized colors. We suggest you twirl down the Modify group and uncheck Modify Alpha.
Toon Flare works great with a lot of other native effects. Try using Optics Compensation or Spherize for a distorted, bulging look. CC Radial Fast Blur or Compound Blur can work well to blur some elements more than others. Glow and even Minimax can get some unusual bloom / glowing results.

Randomizing

When you randomize a flare, it actually just makes a totally new layer and deletes the old one. Your settings for Control Layer, Scale, Brightness and Aperture Blades will be preserved, but any effects or other changes you've made to the flare layer will be lost.
If you hold the Option key when clicking the panel button, or pass the argument basic to K Bar the flare will be a consistent, basic flare with one of every possible element. You can use this as a base to consciously design your own flare by duplicating and modifying the elements in the shape layer.

Tips + FAQ

Aperture Blades?
In the real world, lens flare iris elements are reflections of the camera's own open aperture which closes with a number of blades and so has a shape like a polygon.

Version History

1.0.1 - December 14th 2022

Updated compatibility with After Effects 2020+

1.0 - December 12th 2022

Initial release