Use+as 只要实现不要特型

#[allow(unused_imports)]
pub mod prelude {
      pub use super::{
        interaction::InteractionPalette,
        palette as ui_palette,
        widgets::{Containers as _, Widgets as _},
    };
}

这个Containers是一个特型.

淡入淡出的时间控制

#[derive(Component, Reflect)]
#[reflect(Component)]
struct ImageNodeFadeInOut {
      /// Total duration in seconds.
    total_duration: f32,
      /// Fade duration in seconds.
    fade_duration: f32,
      /// Current progress in seconds, between 0 and [`Self::total_duration`].
    t: f32,
}

impl ImageNodeFadeInOut {
      fn alpha(&self) -> f32 {
        // Normalize by duration.
        let t = (self.t / self.total_duration).clamp(0.0, 1.0);
        let fade = self.fade_duration / self.total_duration;

        // Regular trapezoid-shaped graph, flat at the top with alpha = 1.0.
        ((1.0 - (2.0 * t - 1.0).abs()) / fade).min(1.0)
      }
}

注释里说明了数据表达式是一个梯形,两个斜边就是淡入淡出的时长和淡化效果.