189 lines
9.6 KiB
Python
189 lines
9.6 KiB
Python
import numpy as np
|
|
|
|
class Lerp:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"num_Images": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"strength": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 10.0, "step": 0.01}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT",)
|
|
FUNCTION = "lerp"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def lerp(self, num_Images, strength, current_frame):
|
|
step = strength/num_Images
|
|
output = strength - (step * current_frame)
|
|
return (output, int(output),)
|
|
|
|
class SinWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"amplitude": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"y_translation": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT","INT",)
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, amplitude, x_translation, y_translation, current_frame):
|
|
output = (y_translation+(amplitude*(np.sin((2*np.pi*current_frame/phase-x_translation)))))
|
|
print(output)
|
|
return (output, int(output),)
|
|
|
|
class InvSinWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"amplitude": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"y_translation": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT")
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, amplitude, x_translation, y_translation, current_frame):
|
|
output = (y_translation+(amplitude*-(np.sin(-1*(2*np.pi*current_frame/phase-x_translation)))))
|
|
print(output)
|
|
return (output, int(output),)
|
|
|
|
class CosWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"amplitude": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"y_translation": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT", )
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, amplitude, x_translation, y_translation, current_frame):
|
|
output = (y_translation+(amplitude*(np.cos((2*np.pi*current_frame/phase-x_translation)))))
|
|
print(output)
|
|
return (output, int(output),)
|
|
|
|
class InvCosWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"amplitude": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"y_translation": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT", )
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, amplitude, x_translation, y_translation, current_frame):
|
|
output = (y_translation+(amplitude*-(np.cos(-1*(2*np.pi*current_frame/phase-x_translation)))))
|
|
print(output)
|
|
return (output, int(output),)
|
|
|
|
class SquareWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"amplitude": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"y_translation": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT",)
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, amplitude, x_translation, y_translation, current_frame):
|
|
output = (y_translation+(amplitude*0**0**(0-np.sin((np.pi*current_frame/phase-x_translation)))))
|
|
print(output)
|
|
return (output, int(output),)
|
|
|
|
class SawtoothWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"step_increment": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"start_value": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT", )
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, step_increment, x_translation, start_value, current_frame):
|
|
output = (start_value+(step_increment*(current_frame%phase)-x_translation))
|
|
print(output)
|
|
return (output, int(output),)
|
|
|
|
class TriangleWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"amplitude": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"y_translation": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT",)
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, amplitude, x_translation, y_translation, current_frame):
|
|
output = (y_translation+amplitude/np.pi*(np.arcsin(np.sin(2*np.pi/phase*current_frame-x_translation))))
|
|
print(output)
|
|
return (output, int(output),)
|
|
|
|
class AbsCosWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"amplitude": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"max_value": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT")
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, amplitude, x_translation, max_value, current_frame):
|
|
output = (max_value-(np.abs(np.cos(current_frame/phase))*amplitude))
|
|
print(output)
|
|
return (output, int(output),)
|
|
|
|
class AbsSinWave:
|
|
@classmethod
|
|
def INPUT_TYPES(s):
|
|
return {"required": {"phase": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"amplitude": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.1}),
|
|
"x_translation": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
"max_value": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 9999.0, "step": 0.05}),
|
|
"current_frame": ("INT", {"default": 1.0, "min": 0.0, "max": 9999.0, "step": 1.0}),
|
|
}}
|
|
RETURN_TYPES = ("FLOAT", "INT")
|
|
FUNCTION = "Wave"
|
|
|
|
CATEGORY = "FizzNodes 📅🅕🅝/WaveNodes"
|
|
|
|
def Wave(self, phase, amplitude, x_translation, max_value, current_frame):
|
|
output = (max_value-(np.abs(np.sin(current_frame/phase))*amplitude))
|
|
print(output)
|
|
return (output, int(output),) |