Rename the 'Sample Gradient' node to 'Evaluate Gradient' (#4422)

* Rename the 'Sample Gradient' node to 'Evaluate Gradient'

* Let the Evaluate Gradient node's position reach the out-of-range values its spread modes handle
This commit is contained in:
Keavon Chambers
2026-08-08 01:20:55 -07:00
committed by GitHub
parent e68735f98e
commit b22158b022
3 changed files with 15 additions and 8 deletions

View File

@@ -1451,7 +1451,14 @@ fn gradient_midpoints(_: impl Ctx, gradient: Item<Gradient>, midpoints: List<f64
/// Evaluates the color at the specified position along the gradient, given a position from 0 (left) to 1 (right). Positions beyond that range follow the gradient's `gradient_spread` attribute: Pad (default), Reflect, Repeat, or Clear. Colors between stops interpolate in the gradient's `gradient_space` color space.
#[node_macro::node(category("Color"))]
fn sample_gradient(_: impl Ctx, _primary: (), #[default(Color::BLACK, Color::WHITE)] gradient: Item<Gradient>, position: Item<Fraction>) -> Item<Color> {
fn evaluate_gradient(
_: impl Ctx,
_primary: (),
#[default(Color::BLACK, Color::WHITE)] gradient: Item<Gradient>,
#[range]
#[soft(0..1)]
position: Item<f64>,
) -> Item<Color> {
let settings = vector_types::GradientSettings::from(&gradient);
let color = gradient.element().evaluate(*position.element(), settings);
Item::new_from_element(color)