
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| camera_control_type | Select | ”simple” | Preset camera motion types. simple: Custom camera movement; down_back: Camera moves down and back; forward_up: Camera moves forward and up; right_turn_forward: Rotate right and move forward; left_turn_forward: Rotate left and move forward |
| horizontal_movement | Float | 0 | Controls camera movement on horizontal axis (x-axis). Negative values move left, positive values move right |
| vertical_movement | Float | 0 | Controls camera movement on vertical axis (y-axis). Negative values move down, positive values move up |
| pan | Float | 0.5 | Controls camera rotation in vertical plane (x-axis). Negative values rotate down, positive values rotate up |
| tilt | Float | 0 | Controls camera rotation in horizontal plane (y-axis). Negative values rotate left, positive values rotate right |
| roll | Float | 0 | Controls camera roll amount (z-axis). Negative values rotate counterclockwise, positive values rotate clockwise |
| zoom | Float | 0 | Controls camera focal length. Negative values narrow field of view, positive values widen it |
Output
| Output | Type | Description |
|---|---|---|
| camera_control | CAMERA_CONTROL | Configuration object with camera settings |
Source Code
[Node Source Code (Updated 2025-05-03)]
class KlingCameraControls(KlingNodeBase):
"""Kling Camera Controls Node"""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"camera_control_type": (
IO.COMBO,
{
"options": [
camera_control_type.value
for camera_control_type in CameraType
],
"default": "simple",
"tooltip": "Predefined camera movements type. simple: Customizable camera movement. down_back: Camera descends and moves backward. forward_up: Camera moves forward and tilts up. right_turn_forward: Rotate right and move forward. left_turn_forward: Rotate left and move forward.",
},
),
"horizontal_movement": get_camera_control_input_config(
"Controls camera's movement along horizontal axis (x-axis). Negative indicates left, positive indicates right"
),
"vertical_movement": get_camera_control_input_config(
"Controls camera's movement along vertical axis (y-axis). Negative indicates downward, positive indicates upward."
),
"pan": get_camera_control_input_config(
"Controls camera's rotation in vertical plane (x-axis). Negative indicates downward rotation, positive indicates upward rotation.",
default=0.5,
),
"tilt": get_camera_control_input_config(
"Controls camera's rotation in horizontal plane (y-axis). Negative indicates left rotation, positive indicates right rotation.",
),
"roll": get_camera_control_input_config(
"Controls camera's rolling amount (z-axis). Negative indicates counterclockwise, positive indicates clockwise.",
),
"zoom": get_camera_control_input_config(
"Controls change in camera's focal length. Negative indicates narrower field of view, positive indicates wider field of view.",
),
}
}
DESCRIPTION = "Kling Camera Controls Node. Not all model and mode combinations support camera control. Please refer to the Kling API documentation for more information."
RETURN_TYPES = ("CAMERA_CONTROL",)
RETURN_NAMES = ("camera_control",)
FUNCTION = "main"
@classmethod
def VALIDATE_INPUTS(
cls,
horizontal_movement: float,
vertical_movement: float,
pan: float,
tilt: float,
roll: float,
zoom: float,
) -> bool | str:
if not is_valid_camera_control_configs(
[
horizontal_movement,
vertical_movement,
pan,
tilt,
roll,
zoom,
]
):
return "Invalid camera control configs: at least one of the values must be non-zero"
return True
def main(
self,
camera_control_type: str,
horizontal_movement: float,
vertical_movement: float,
pan: float,
tilt: float,
roll: float,
zoom: float,
) -> tuple[CameraControl]:
return (
CameraControl(
type=CameraType(camera_control_type),
config=CameraConfig(
horizontal=horizontal_movement,
vertical=vertical_movement,
pan=pan,
roll=roll,
tilt=tilt,
zoom=zoom,
),
),
)