class

Opal::UI::CurveEditor

Inherits Opal::UI::Control < Opal::UI::InputHookable < Opal::UI::Element < Opal::UI::Themable < Reference < Object

Interactive Bézier Curve & Easing Editor. Features 2x4 sub-pixel Unicode Braille plotting, draggable P1/P2 control handles, CSS cubic-bezier output, standard presets, and real-time physics easing preview.

Constants

PRESETS = {"linear" => {0.0, 0.0, 1.0, 1.0}, "ease" => {0.25, 0.1, 0.25, 1.0}, "ease_in" => {0.42, 0.0, 1.0, 1.0}, "ease_out" => {0.0, 0.0, 0.58, 1.0}, "ease_in_out" => {0.42, 0.0, 0.58, 1.0}, "ease_in_back" => {0.36, 0.0, 0.66, -0.56}, "ease_out_back" => {0.34, 1.56, 0.64, 1.0}}

Presets

Constructors

new(p1_x : Float64 = 0.42, p1_y : Float64 = 0.0, p2_x : Float64 = 0.58, p2_y : Float64 = 1.0, width : Int32 = 36, height : Int32 = 16)
Source

Instance methods

active_handle

Active handle being manipulated: 1 for P1, 2 for P2

Source
active_handle=(active_handle : Int32)

Active handle being manipulated: 1 for P1, 2 for P2

Source
anim_progress
Source
anim_progress=(anim_progress : Float64)
Source
border_color
Source
border_color=(border_color : Color)
Source
curve_color

Visual styling

Source
curve_color=(curve_color : Color)

Visual styling

Source
evaluate_easing(x : Float64) : Float64

Solves for y given x in [0.0..1.0] using bisection (approximate inversion for animation easing)

Source
grid_color
Source
grid_color=(grid_color : Color)
Source
handle_key(key : Terminal::KeyEvent) : Bool

Default key event handler. Override in subclasses if not using @default_input_proc.

Source
handle_mouse(event : Terminal::MouseEvent) : Bool

Default mouse event handler. Override in subclasses if not using @default_input_proc.

Source
handle_p1_color
Source
handle_p1_color=(handle_p1_color : Color)
Source
handle_p2_color
Source
handle_p2_color=(handle_p2_color : Color)
Source
height
Source
height=(height : Int32)
Source
last_h
Source
last_h=(last_h : Int32)
Source
last_w
Source
last_w=(last_w : Int32)
Source
last_x
Source
last_x=(last_x : Int32)
Source
last_y
Source
last_y=(last_y : Int32)
Source
on_change

Callbacks

Source
on_change=(on_change : Proc(Float64, Float64, Float64, Float64, Nil) | Nil)

Callbacks

Source
p1_x
Source
p1_x=(p1_x : Float64)
Source
p1_y
Source
p1_y=(p1_y : Float64)
Source
p2_x
Source
p2_x=(p2_x : Float64)
Source
p2_y
Source
p2_y=(p2_y : Float64)
Source
preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32)
Source
preset(name : String) : Nil

Applies a named preset (e.g. "ease_in_out", "ease", "linear")

Source
render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil
Source
render(buffer : Buffer) : Nil
Source
sample_bezier(t : Float64) : Tuple(Float64, Float64)

Evaluates cubic Bézier parametric coordinate (bx, by) at parameter t in [0.0..1.0]

Source
show_ball_track
Source
show_ball_track=(show_ball_track : Bool)
Source
tick_anim(delta : Float64 = 0.05) : Nil

Increments animation preview progress

Source
to_css

Generates CSS cubic-bezier string

Source
width
Source
width=(width : Int32)
Source