-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
190 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
extends Node | ||
|
||
var count = 0 | ||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready() -> void: | ||
play_next() | ||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(_delta: float) -> void: | ||
pass | ||
|
||
|
||
func play_next(): | ||
print(count) | ||
get_next().start() | ||
count += 1 | ||
|
||
func prep_next(): | ||
get_next().prep() | ||
|
||
func get_next(): | ||
|
||
match count % 6: | ||
0: | ||
return $VideoStreamPlayer | ||
1: | ||
return $VideoStreamPlayer2 | ||
2: | ||
return $VideoStreamPlayer3 | ||
3: | ||
return $VideoStreamPlayer4 | ||
4: | ||
return $VideoStreamPlayer5 | ||
5: | ||
return $VideoStreamPlayer6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
extends Node2D | ||
|
||
var alpha = 0 | ||
|
||
# Function to set the alpha for the parent and its children | ||
func set_alpha(alpha_value: float) -> void: | ||
# Ensure alpha_value is between 0 and 1 | ||
alpha_value = clamp(alpha_value, 0.0, 1.0) | ||
|
||
# Set the parent's alpha if it has a Modulate property | ||
if has_method("set_modulate"): | ||
modulate = Color(modulate.r, modulate.g, modulate.b, alpha_value) | ||
|
||
# Loop through each child | ||
for child in get_children(): | ||
if child.has_method("set_modulate"): | ||
var child_modulate = child.modulate | ||
child.modulate = Color(child_modulate.r, child_modulate.g, child_modulate.b, alpha_value) | ||
|
||
# Example function to change alpha | ||
func _ready(): | ||
pass | ||
#set_alpha(0.5) # Change all children's alpha to 0.5 | ||
|
||
func _process(_delta): | ||
|
||
if alpha < 3.0: | ||
alpha += 0.006; | ||
set_alpha(alpha-2.0) # Change all children's alpha to 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
extends VideoStreamPlayer | ||
|
||
@export var fadeout: bool = true | ||
@export var fadein: bool = true | ||
@export var streamlength: float = 10. | ||
|
||
func _ready() -> void: | ||
self.connect("finished", Callable(self, "_on_video_finished")) | ||
self.play() | ||
self.paused=1 | ||
#if fadein: | ||
modulate.a = 0 | ||
|
||
func prep(): | ||
modulate.a = 1 | ||
|
||
func start(): | ||
self.paused=0 | ||
if fadein == false: | ||
modulate.a = 1 | ||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(_delta: float) -> void: | ||
if fadein && self.paused==false: | ||
if modulate.a < 1.0: | ||
modulate.a += 0.03 | ||
|
||
if fadeout == false && self.stream_position > streamlength/2: | ||
get_parent().prep_next() | ||
|
||
if fadeout && self.stream_position > streamlength/2: | ||
if self.stream_position > streamlength - 0.5: | ||
modulate.a -= 0.05 | ||
if modulate.a <= 0: | ||
stop() | ||
play() | ||
paused=1 | ||
get_parent().play_next() | ||
else: | ||
modulate.a=1 | ||
|
||
pass | ||
|
||
func _on_video_finished(): | ||
modulate.a = 0 | ||
self.stop() | ||
self.play() | ||
self.paused=1 | ||
self.get_parent().play_next() |