-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDVDLogo.py
59 lines (54 loc) · 1.49 KB
/
DVDLogo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import time
from globals import getOBSWebsocketsManager
import pygame
pygame.mixer.init()
cornersound = pygame.mixer.Sound("sounds/Corner.mp3")
def dvdLogo():
obswebsockets_manager = getOBSWebsocketsManager()
SOURCE_SCENE_NAME = "Game/Desktop"
SOURCE_NAME = "Webcam stuff"
transform = obswebsockets_manager.get_source_transform(
SOURCE_SCENE_NAME, SOURCE_NAME
)
eleHeight = transform["height"]
eleWidth = transform["width"]
OBS_CANVAS_WIDTH = 1920
OBS_CANVAS_HEIGHT = 1080
max_x = OBS_CANVAS_WIDTH - eleWidth
max_y = OBS_CANVAS_HEIGHT - eleHeight
x = 0
y = 0
dx = 1
dy = 1
speed = 1000 # pixels per second
timeRate = 0.005
while True:
obswebsockets_manager.set_source_transform(
SOURCE_SCENE_NAME,
SOURCE_NAME,
{
"positionX": x,
"positionY": y,
},
)
time.sleep(timeRate)
x = x + dx * speed * timeRate
y = y + dy * speed * timeRate
changex = False
changey = False
if x <= 0:
dx = 1
changex = True
elif x > max_x:
dx = -1
changex = True
if y <= 0:
dy = 1
changey = True
if y > max_y:
dy = -1
changey = True
# if changex and changey:
# cornersound.play()
if __name__ == "__main__":
dvdLogo()