1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//! Rust bindings for macOS Core Animation with ergonomic builder APIs.
//!
//! # Builders
//!
//! | Builder | Purpose |
//! |---------|---------|
//! | [`WindowBuilder`] | Layer-backed windows with background, border, transparency |
//! | [`CALayerBuilder`] | Base layers with bounds, position, sublayers |
//! | [`CAShapeLayerBuilder`] | Vector shapes with path, fill, stroke, shadows |
//! | [`CATextLayerBuilder`] | Text rendering layers |
//! | [`CAEmitterLayerBuilder`](particles::CAEmitterLayerBuilder) | Particle systems with closure-based cell configuration |
//! | [`PointBurstBuilder`](particles::PointBurstBuilder) | Convenience API for radial particle bursts |
//! | [`CABasicAnimationBuilder`](animation_builder::CABasicAnimationBuilder) | Standalone GPU-accelerated animations |
//!
//! # Quick Start
//!
//! ```ignore
//! use core_animation::prelude::*;
//!
//! let window = WindowBuilder::new()
//! .title("Demo")
//! .size(400.0, 400.0)
//! .centered()
//! .background_color(Color::rgb(0.1, 0.1, 0.15))
//! .build();
//!
//! let circle = CAShapeLayerBuilder::new()
//! .circle(80.0)
//! .position(CGPoint::new(200.0, 200.0))
//! .fill_color(Color::CYAN)
//! .animate("pulse", KeyPath::TransformScale, |a| {
//! a.values(0.85, 1.15)
//! .duration(1.seconds())
//! .easing(Easing::InOut)
//! .autoreverses()
//! .repeat(Repeat::Forever)
//! })
//! .build();
//!
//! window.container().add_sublayer(&circle);
//! window.show_for(10.seconds());
//! ```
//!
//! # Animations
//!
//! All layer builders support `.animate()` for GPU-accelerated animations:
//!
//! ```ignore
//! .animate("name", KeyPath::TransformScale, |a| {
//! a.values(0.8, 1.2) // from/to values
//! .duration(500.millis()) // timing
//! .easing(Easing::InOut) // curve
//! .autoreverses() // ping-pong
//! .repeat(Repeat::Forever) // loop
//! .phase_offset(0.5) // stagger multiple animations
//! })
//! ```
//!
//! **Animatable properties:** [`TransformScale`](animation_builder::KeyPath::TransformScale),
//! [`TransformRotation`](animation_builder::KeyPath::TransformRotation),
//! [`Opacity`](animation_builder::KeyPath::Opacity),
//! [`ShadowRadius`](animation_builder::KeyPath::ShadowRadius),
//! [`ShadowOpacity`](animation_builder::KeyPath::ShadowOpacity),
//! [`Custom`](animation_builder::KeyPath::Custom)
//!
//! **Easing curves:** [`Linear`](animation_builder::Easing::Linear),
//! [`In`](animation_builder::Easing::In),
//! [`Out`](animation_builder::Easing::Out),
//! [`InOut`](animation_builder::Easing::InOut)
//!
//! # Particle Systems
//!
//! ```ignore
//! use std::f64::consts::PI;
//!
//! let emitter = CAEmitterLayerBuilder::new()
//! .position(320.0, 240.0)
//! .shape(EmitterShape::Point)
//! .particle(|p| {
//! p.birth_rate(100.0)
//! .lifetime(5.0)
//! .velocity(80.0)
//! .emission_range(PI * 2.0)
//! .color(Color::CYAN)
//! .image(ParticleImage::soft_glow(64))
//! })
//! .build();
//! ```
//!
//! Or use the convenience builder:
//!
//! ```ignore
//! let burst = PointBurstBuilder::new(320.0, 240.0)
//! .velocity(100.0)
//! .color(Color::PINK)
//! .build();
//! ```
//!
//! **Particle images:** [`soft_glow`](particles::ParticleImage::soft_glow),
//! [`circle`](particles::ParticleImage::circle),
//! [`star`](particles::ParticleImage::star),
//! [`spark`](particles::ParticleImage::spark)
//!
//! # Examples
//!
//! See the [examples](https://github.com/sassman/core-animation-rs/tree/main/examples)
//! for runnable demos with screenshots.
//!
//! ```bash
//! cargo run --example window_builder
//! ```
//!
//! Use [`prelude`] to import common types.
compile_error!;
// Re-export Color type
pub use Color;
// Re-export the main types from objc2-quartz-core
pub use ;
// Re-export our builders
pub use CALayerBuilder;
pub use CAShapeLayerBuilder;
pub use ;
// Re-export window types
pub use ;
// Re-export duration extension
pub use DurationExt;
// Re-export layer extension
pub use CALayerExt;
// Re-export dependencies for convenience
pub use objc2_core_foundation;
pub use objc2_core_graphics;
pub use objc2_core_text;
pub use objc2_quartz_core;
/// Prelude module for convenient imports.