mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-10 13:24:44 +08:00
Add start/end levels
This commit is contained in:
parent
488b444b2d
commit
e74c2b034a
9
nodes.py
9
nodes.py
@ -136,13 +136,12 @@ class CreateFadeMask:
|
|||||||
"width": ("INT", {"default": 256,"min": 16, "max": 4096, "step": 1}),
|
"width": ("INT", {"default": 256,"min": 16, "max": 4096, "step": 1}),
|
||||||
"height": ("INT", {"default": 256,"min": 16, "max": 4096, "step": 1}),
|
"height": ("INT", {"default": 256,"min": 16, "max": 4096, "step": 1}),
|
||||||
"interpolation": (["linear", "ease_in", "ease_out", "ease_in_out"],),
|
"interpolation": (["linear", "ease_in", "ease_out", "ease_in_out"],),
|
||||||
|
"start_level": ("FLOAT", {"default": 1.0,"min": 0.0, "max": 1.0, "step": 0.01}),
|
||||||
|
"end_level": ("FLOAT", {"default": 0.0,"min": 0.0, "max": 1.0, "step": 0.01}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def createfademask(self, frames, width, height, invert, interpolation, start_level, end_level):
|
||||||
|
|
||||||
|
|
||||||
def createfademask(self, frames, width, height, invert, interpolation):
|
|
||||||
def ease_in(t):
|
def ease_in(t):
|
||||||
return t * t
|
return t * t
|
||||||
|
|
||||||
@ -166,7 +165,7 @@ class CreateFadeMask:
|
|||||||
elif interpolation == "ease_in_out":
|
elif interpolation == "ease_in_out":
|
||||||
t = ease_in_out(t)
|
t = ease_in_out(t)
|
||||||
|
|
||||||
color = 1.0 - t
|
color = start_level - t * (start_level - end_level)
|
||||||
image = np.full((height, width), color, dtype=np.float32)
|
image = np.full((height, width), color, dtype=np.float32)
|
||||||
image_batch[i] = image
|
image_batch[i] = image
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user