mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
23 lines
302 B
Rust
23 lines
302 B
Rust
trait Attr {
|
|
fn name() -> &'static str
|
|
}
|
|
|
|
impl Attr for bool {
|
|
fn name() {"condition"}
|
|
}
|
|
|
|
struct Opacity(f64);
|
|
|
|
impl Attr for Opacity {
|
|
fn name() {"opacity"}
|
|
}
|
|
|
|
|
|
#[node]
|
|
fn opacity<T>(_: impl Ctx, input: T, x: ReadAttr<bool>, opacity: WriteAttr<Opacity>) -> T {
|
|
if x {
|
|
*opacity = 1.;
|
|
}
|
|
input
|
|
}
|