Skip to content

Commit 7f1f903

Browse files
author
James Brundage
committed
Adding ColorLoop Effect (Fixes #113)
1 parent 1d5d9da commit 7f1f903

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Effects/ColorLoop.OBS.Effect.ps1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<#
2+
.SYNOPSIS
3+
Loops Colors
4+
.DESCRIPTION
5+
Loops thru potential hue adjustment for an input.
6+
#>
7+
param(
8+
[string]
9+
$InputName,
10+
11+
[timespan]
12+
$Duration = "00:00:02"
13+
)
14+
15+
if (-not $InputName -and $this -and $this.InputName) {
16+
$InputName = $this.InputName
17+
}
18+
19+
if (-not $InputName -and $this -and $this.SourceName) {
20+
$InputName = $this.SourceName
21+
}
22+
23+
if (-not $InputName) { return }
24+
25+
Add-OBSColorFilter -FilterName "ColorLoop" -SourceName $InputName -ErrorAction SilentlyContinue | Out-Null
26+
27+
$StepCount = [Math]::Ceiling($Duration.TotalMilliseconds / ([timespan]::fromSeconds(1/30).TotalMilliseconds)) * 2
28+
29+
$stepSleep = $Duration.TotalMilliseconds / $StepCount
30+
31+
$hue = 0
32+
$hueIncrement = 360 / $StepCount
33+
@(foreach ($stepNum in 1..$StepCount) {
34+
$hue += $hueIncrement
35+
Set-OBSColorFilter -FilterName "ColorLoop" -SourceName $InputName -Hue $hue -PassThru
36+
Send-OBSSleep -SleepMillis $stepSleep -PassThru
37+
})

0 commit comments

Comments
 (0)