Files
piglet/src/color/gradient.rs
Sebastian Krüger b1ad87fc26 Complete piglet implementation with animations and effects
- Implement complete animation system with 20+ motion effects
- Add 18+ easing functions (quad, cubic, elastic, back, bounce)
- Implement color system with palette and gradient support
- Add parser for durations, colors, and CSS gradients
- Create comprehensive test suite (14 tests passing)
- Add linting and formatting with clippy/rustfmt
- Support for figlet integration with custom fonts
- Terminal rendering with crossterm
- Fix all clippy warnings and lint issues

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 03:00:20 +01:00

28 lines
613 B
Rust

use crate::parser::color::Color;
use crate::parser::gradient::Gradient;
use anyhow::Result;
#[derive(Debug, Clone)]
pub struct GradientEngine {
gradient: Gradient,
}
impl GradientEngine {
pub fn new(gradient: Gradient) -> Self {
Self { gradient }
}
pub fn from_string(gradient_str: &str) -> Result<Self> {
let gradient = Gradient::parse(gradient_str)?;
Ok(Self::new(gradient))
}
pub fn color_at(&self, t: f64) -> Color {
self.gradient.color_at(t)
}
pub fn colors(&self, steps: usize) -> Vec<Color> {
self.gradient.colors(steps)
}
}