File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,50 @@ $this | Set-OBSSceneItemTransform -SceneItemTransform @{
222222}
223223 </Script >
224224 </ScriptMethod >
225+ <ScriptMethod >
226+ <Name >Scale</Name >
227+ <Script >
228+ param(
229+ [double[]]
230+ $ScaleX = 1,
231+
232+ [double[]]
233+ $ScaleY = 1,
234+
235+ # The timespan the animation will take
236+ [TimeSpan]
237+ $TimeSpan = [timespan]::fromSeconds(1)
238+ )
239+
240+ if ($scaleX.Length -eq 1 -and $scaleY.Length -eq 1) {
241+ $this | Set-OBSSceneItemTransform -SceneItemTransform @{
242+ scaleX = $ScaleX[0]
243+ scaleY = $scaleY[0]
244+ }
245+ return
246+ }
247+
248+ $thisTransform = $this | Get-OBSSceneItemTransform
249+
250+ $fromValue = [Ordered]@{
251+ scaleX = $thisTransform.scaleX
252+ scaleY = $thisTransform.scaleY
253+ }
254+
255+ $durationPerStep = [TimeSpan]::FromMilliseconds($TimeSpan.TotalMilliseconds / $ScaleX.Length)
256+
257+ for ($stepNumber = 0; $stepNumber -lt $ScaleX.Length; $stepNumber++) {
258+ $toValue = [Ordered]@{
259+ scaleX = $ScaleX[$stepNumber]
260+ scaleY = $ScaleY[$stepNumber]
261+ }
262+ $this.Animate($fromValue, $toValue, $durationPerStep)
263+ $fromValue = $toValue
264+ }
265+
266+
267+ </Script >
268+ </ScriptMethod >
225269 <ScriptMethod >
226270 <Name >Unlock</Name >
227271 <Script >
You can’t perform that action at this time.
0 commit comments