Spaces:
Running
Running
import numpy as np | |
class Lerp: | |
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: | |
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: | |
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: | |
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: | |
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: | |
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: | |
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: | |
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: | |
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: | |
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),) |