-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transitions.py
32 lines (27 loc) · 929 Bytes
/
Transitions.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
import math
class Transitions():
"""Library of transititons"""
@staticmethod
def FadeInLeft(x, desiredX, speed): # Handles fading from left or top down
if (x < desiredX):
x += speed
elif (x > desiredX):
x = desiredX
return x
@staticmethod
def FadeInRight(x, desiredX, speed): # Handles fading from right or bottom up
if (x > desiredX):
x -= speed
elif (x < desiredX):
x = desiredX
return x
@staticmethod
def FadeInColor(color, desiredColor, speed): # Handles fading colors from black to the desired color
colorList = list(color)
for i in range(len(colorList)):
if (colorList[i] < desiredColor[i]):
colorList[i] += speed
return tuple(colorList)
@staticmethod
def WaveIn(x, desiredX, speed):
return -100*math.sin(speed/100) + desiredX