example delayed fadein - norihiro/obs-command-source GitHub Wiki

Delayed Fade-in of a Source

This example is a delayed fade-in of a source. When a scene transited to the program, a scene is fade-in a little later.

Settings

The scene has a command-source with pointing this sci

Property Value
Shown
Hidden
Activated ~/delayed-fadein.sh scene-item-name
Deactivated
Shown in preview
Hidden from preview

File ~/delayed-fadein.sh:

#! /bin/bash
w=~/obs-command-source/tools/request-websocket.py

sourceName="$1"
duration=4000

d=$($w GetCurrentTransition | awk '/duration/{print int($2)}')

# Make the item visible
$w \
	SetPreviewScene "{\"scene-name\": \"$OBS_CURRENT_SCENE\"}" \
	SetSceneItemProperties "{\"scene-name\": \"$OBS_CURRENT_SCENE\", \"item\": \"$sourceName\", \"visible\": true}" \
	Sleep $OBS_TRANSITION_DURATION

# Transition again
for ((i=0; i<3; i++)); do
	$w \
		TransitionToProgram "{\"with-transition\": {\"name\": \"Fade\", \"duration\": $duration}}" \
		sleep 0.5 \
		SetTransitionDuration "{\"duration\": $OBS_TRANSITION_DURATION}"
done

# Make the item unvisible for the next time
$w \
	sleep 1 \
	SetSceneItemProperties "{\"scene-name\": \"$OBS_CURRENT_SCENE\", \"item\": \"$sourceName\", \"visible\": false}"

Note: Please replace ~ with your preferred location of the files.

Expected Settings

These settings in the Profile are expected for this example.

Property Value
Duplicate Scene true
Scene Transition Fade