<p>I'd suggest animate the 'Opacity' property of the <em>outer glow</em>:</p>

<p><a href="https://i.sstatic.net/ERB3i.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ERB3i.jpg" alt="enter image description here"></a>
<em>Click to enlarge</em></p>

<ol>
<li>Create a keyframe by clicking on the <em>stopwatch of outer glow</em> 'opacity' and set its value to <code>0%</code></li>
<li>Create a second keyframe and set its value to <code>100%</code></li>
<li><kbd>Alt</kbd><em>-Click</em> the stopwatch to create an expression and insert <code>loopOut(type = "pingpong")</code> to get an endless loop of <em>both</em> values</li>
</ol>

<p><a href="https://i.sstatic.net/pi9NM.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pi9NM.gif" alt="enter image description here"></a><br>
<em>Composition length: 49 Frames, <br>
2 Keyframes: frame <code>0</code> > opacity <code>0%</code>, frame <code>25</code> > opacity <code>100%</code></em></p>

<p><strong>Note:</strong> In order to create a less generic animation, you can also create 3 or more keyframes by using <code>loopOut(type="cycle")</code> expression instead.</p>

<hr>

<p>To start the animation at a predefined time as well as stop the animation as you like, you can either <em>duplicate the layer twice</em> and <em>remove the layer styles of both duplicates</em> in order to concatenate all 3 layers by hand or write a <em>simple condition</em> like this:</p>

<pre class="lang-js prettyprint-override"><code>// get the current frame of the composition
currentFrame = timeToFrames(time, 1 / thisComp.frameDuration, false);

// check if the current frame is in the predetermined range
if (currentFrame &gt;= 20 &amp;&amp; currentFrame &lt;= 60) {
  // loop all keyframes
  loopOut(type = "cycle");
}
else{
  // if the current frame is not in predetermined range set glow opacity to 0
  thisLayer.layerStyle.outerGlow.opacity = 0;
}
</code></pre>

<p><a href="https://i.sstatic.net/Sa4Lx.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Sa4Lx.gif" alt="enter image description here"></a><br></p>

<p><em>Composition length: 80 Frames, <br>
Loop animation range: Frame 20 - 60, <br>
3 Keyframes: frame <code>0</code> > opacity <code>0%</code> , frame <code>10</code> > opacity <code>100%</code>, frame <code>20</code>> opacity <code>0%</code></em></p>

<p>Official <a href="https://helpx.adobe.com/after-effects/using/expression-language-reference.html" rel="nofollow noreferrer">expression language reference</a></p>

CC BY-SA 3.0
2017-07-23T04:01:38.583Z
`timeToFrames(time, 1 / thisComp.frameDuration, false)` is the same as `time / thisComp.frameDuration` is it not? Simpler, and one fewer function call.
stib
CC BY-SA 3.0
2017-07-24T11:16:25.870Z
Yeah, good idea @stib. Feel free to edit my answer.
p2or
CC BY-SA 3.0
2016-10-10T13:07:49.083Z
2016-10-25T09:10:36.153Z
2016-10-25T09:10:36.153Z
p2or
<p>I have a layer in After Effects to which I have applied an outer glow as a layer style. Ideally I would like the glow to turn off and on, in a loop, starting at a point in time and then stopping. Is this possible—perhaps with a script?</p>

<after-effects><after-effects-expressions><after-effects-scripting>
How to loop outer glow layer style in After Effects?
Flobin
# How to loop outer glow layer style in After Effects?

(Asked by: username_0 on 2016-10-09)

I have a layer in After Effects to which I have applied an outer glow as a layer style. Ideally I would like the glow to turn off and on, in a loop, starting at a point in time and then stopping. Is this possible—perhaps with a script?

**Tags:** after-effects, after-effects-expressions, after-effects-scripting


---

## 1 answers

### Answer by username_1 on 2016-10-10. Score: 1 | Accepted answer

I'd suggest animate the 'Opacity' property of the outer glow:

Click to enlarge

Create a keyframe by clicking on the stopwatch of outer glow 'opacity' and set its value to 0%
Create a second keyframe and set its value to 100%
Alt-Click the stopwatch to create an expression and insert loopOut(type = "pingpong") to get an endless loop of both values


Composition length: 49 Frames, 
2 Keyframes: frame 0 > opacity 0%, frame 25 > opacity 100%
Note: In order to create a less generic animation, you can also create 3 or more keyframes by using loopOut(type="cycle") expression instead.

To start the animation at a predefined time as well as stop the animation as you like, you can either duplicate the layer twice and remove the layer styles of both duplicates in order to concatenate all 3 layers by hand or write a simple condition like this:
// get the current frame of the composition
currentFrame = timeToFrames(time, 1 / thisComp.frameDuration, false);

// check if the current frame is in the predetermined range
if (currentFrame >= 20 && currentFrame <= 60) {
  // loop all keyframes
  loopOut(type = "cycle");
}
else{
  // if the current frame is not in predetermined range set glow opacity to 0
  thisLayer.layerStyle.outerGlow.opacity = 0;
}


Composition length: 80 Frames, 
Loop animation range: Frame 20 - 60, 
3 Keyframes: frame 0 > opacity 0% , frame 10 > opacity 100%, frame 20> opacity 0%
Official expression language reference

> **Comments:**
> **username_2**: `timeToFrames(time, 1 / thisComp.frameDuration, false)` is the same as `time / thisComp.frameDuration` is it not? Simpler, and one fewer function call.  
> **username_1**: Yeah, good idea @username_2. Feel free to edit my answer.  

---

