objc2_scene_kit/generated/
SCNAnimation.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15extern_protocol!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationprotocol?language=objc)
17    #[doc(alias = "SCNAnimation")]
18    #[name = "SCNAnimation"]
19    pub unsafe trait SCNAnimationProtocol: NSObjectProtocol {}
20);
21
22/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationdidstartblock?language=objc)
23#[cfg(feature = "block2")]
24pub type SCNAnimationDidStartBlock = *mut block2::DynBlock<
25    dyn Fn(NonNull<SCNAnimation>, NonNull<ProtocolObject<dyn SCNAnimatable>>),
26>;
27
28/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationdidstopblock?language=objc)
29#[cfg(feature = "block2")]
30pub type SCNAnimationDidStopBlock = *mut block2::DynBlock<
31    dyn Fn(NonNull<SCNAnimation>, NonNull<ProtocolObject<dyn SCNAnimatable>>, Bool),
32>;
33
34extern_class!(
35    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scntimingfunction?language=objc)
36    #[unsafe(super(NSObject))]
37    #[derive(Debug, PartialEq, Eq, Hash)]
38    pub struct SCNTimingFunction;
39);
40
41extern_conformance!(
42    unsafe impl NSCoding for SCNTimingFunction {}
43);
44
45extern_conformance!(
46    unsafe impl NSObjectProtocol for SCNTimingFunction {}
47);
48
49extern_conformance!(
50    unsafe impl NSSecureCoding for SCNTimingFunction {}
51);
52
53impl SCNTimingFunction {
54    extern_methods!(
55        #[cfg(feature = "SceneKitTypes")]
56        #[unsafe(method(functionWithTimingMode:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn functionWithTimingMode(
59            timing_mode: SCNActionTimingMode,
60        ) -> Retained<SCNTimingFunction>;
61
62        #[cfg(feature = "objc2-quartz-core")]
63        #[cfg(not(target_os = "watchos"))]
64        #[unsafe(method(functionWithCAMediaTimingFunction:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn functionWithCAMediaTimingFunction(
67            ca_timing_function: &CAMediaTimingFunction,
68        ) -> Retained<SCNTimingFunction>;
69    );
70}
71
72/// Methods declared on superclass `NSObject`.
73impl SCNTimingFunction {
74    extern_methods!(
75        #[unsafe(method(init))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78
79        #[unsafe(method(new))]
80        #[unsafe(method_family = new)]
81        pub unsafe fn new() -> Retained<Self>;
82    );
83}
84
85extern_protocol!(
86    /// The SCNAnimatable protocol defines an animatable property. Objects that implement this protocol can be animated through these methods.
87    ///
88    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimatable?language=objc)
89    pub unsafe trait SCNAnimatable: NSObjectProtocol {
90        /// Adds and runs an animation
91        ///
92        /// Parameter `animation`: Added animation.
93        ///
94        /// Parameter `key`: May be any string such that only one animation per unique key is added per animatable object.
95        ///
96        /// Only SCNAnimation (preferred), CABasicAnimation, CAKeyframeAnimation and CAAnimationGroup are supported.
97        /// The animation starts playing right away. The animation is automatically removed on completion unless if removedOnCompletion is explicitly set to NO.
98        ///
99        /// See also: -[id
100        /// <SCNAnimation
101        /// > removedOnCompletion]
102        #[unsafe(method(addAnimation:forKey:))]
103        #[unsafe(method_family = none)]
104        unsafe fn addAnimation_forKey(
105            &self,
106            animation: &ProtocolObject<dyn SCNAnimationProtocol>,
107            key: Option<&NSString>,
108        );
109
110        /// Add an animation player.
111        ///
112        /// Parameter `player`: Added animation player.
113        ///
114        /// Parameter `key`: May be any string such that only one animation per unique key is added per animatable object.
115        ///
116        /// The animation player is not removed automatically on completion.
117        /// The animation doesn't start playing immediatelly. Call "play" on the player to start playing it.
118        ///
119        /// See also: -[SCNAnimationPlayer play]
120        #[unsafe(method(addAnimationPlayer:forKey:))]
121        #[unsafe(method_family = none)]
122        unsafe fn addAnimationPlayer_forKey(
123            &self,
124            player: &SCNAnimationPlayer,
125            key: Option<&NSString>,
126        );
127
128        /// Remove all animations.
129        #[unsafe(method(removeAllAnimations))]
130        #[unsafe(method_family = none)]
131        unsafe fn removeAllAnimations(&self);
132
133        #[cfg(feature = "objc2-core-foundation")]
134        /// Smoothly remove all animations.
135        ///
136        /// Parameter `duration`: The blend out duration used to remove the animation.
137        #[unsafe(method(removeAllAnimationsWithBlendOutDuration:))]
138        #[unsafe(method_family = none)]
139        unsafe fn removeAllAnimationsWithBlendOutDuration(&self, duration: CGFloat);
140
141        /// Remove the animation with the given identifier.
142        ///
143        /// Parameter `key`: The identifier for the animation to remove.
144        #[unsafe(method(removeAnimationForKey:))]
145        #[unsafe(method_family = none)]
146        unsafe fn removeAnimationForKey(&self, key: &NSString);
147
148        #[cfg(feature = "objc2-core-foundation")]
149        /// Smoothly remove the animation with the given identifier.
150        ///
151        /// Parameter `key`: The identifier for the animation to remove.
152        ///
153        /// Parameter `duration`: The blend out duration used to remove the animation.
154        #[unsafe(method(removeAnimationForKey:blendOutDuration:))]
155        #[unsafe(method_family = none)]
156        unsafe fn removeAnimationForKey_blendOutDuration(&self, key: &NSString, duration: CGFloat);
157
158        /// Returns an array containing the keys of all animations currently attached to the receiver.
159        #[unsafe(method(animationKeys))]
160        #[unsafe(method_family = none)]
161        unsafe fn animationKeys(&self) -> Retained<NSArray<NSString>>;
162
163        /// Returns the animation player with the given identifier
164        ///
165        /// Parameter `key`: The identifier for the animation player to retrieve.
166        ///
167        /// This will return nil if no such animation player exists.
168        #[unsafe(method(animationPlayerForKey:))]
169        #[unsafe(method_family = none)]
170        unsafe fn animationPlayerForKey(
171            &self,
172            key: &NSString,
173        ) -> Option<Retained<SCNAnimationPlayer>>;
174
175        #[cfg(feature = "objc2-core-foundation")]
176        /// Smoothly remove the animation with the given identifier.
177        ///
178        /// Parameter `key`: The identifier for the animation to remove.
179        ///
180        /// Parameter `duration`: The fade out duration used to remove the animation.
181        #[deprecated]
182        #[unsafe(method(removeAnimationForKey:fadeOutDuration:))]
183        #[unsafe(method_family = none)]
184        unsafe fn removeAnimationForKey_fadeOutDuration(&self, key: &NSString, duration: CGFloat);
185
186        #[cfg(feature = "objc2-quartz-core")]
187        #[cfg(not(target_os = "watchos"))]
188        /// Returns the animation with the given identifier
189        ///
190        /// Parameter `key`: The identifier for the animation to retrieve.
191        ///
192        /// This will return nil if no such animation exists.
193        /// Attempting to modify any properties of the returned object will result in undefined behavior.
194        #[deprecated]
195        #[unsafe(method(animationForKey:))]
196        #[unsafe(method_family = none)]
197        unsafe fn animationForKey(&self, key: &NSString) -> Option<Retained<CAAnimation>>;
198
199        /// Pause the animation with the given identifier.
200        ///
201        /// Parameter `key`: The identifier for the animation to pause.
202        #[deprecated = "Use -[SCNAnimationPlayer setPaused:] instead"]
203        #[unsafe(method(pauseAnimationForKey:))]
204        #[unsafe(method_family = none)]
205        unsafe fn pauseAnimationForKey(&self, key: &NSString);
206
207        /// Resume the animation with the given identifier.
208        ///
209        /// Parameter `key`: The identifier for the animation to resume.
210        #[deprecated = "Use -[SCNAnimationPlayer setPaused:] instead"]
211        #[unsafe(method(resumeAnimationForKey:))]
212        #[unsafe(method_family = none)]
213        unsafe fn resumeAnimationForKey(&self, key: &NSString);
214
215        #[cfg(feature = "objc2-core-foundation")]
216        /// Update the animation speed of the animation with the given identifier.
217        ///
218        /// Parameter `speed`: The new speed of the animation.
219        ///
220        /// Parameter `key`: The identifier for the animation to update.
221        #[deprecated = "Use -[SCNAnimationPlayer setSpeed:] instead"]
222        #[unsafe(method(setSpeed:forAnimationKey:))]
223        #[unsafe(method_family = none)]
224        unsafe fn setSpeed_forAnimationKey(&self, speed: CGFloat, key: &NSString);
225
226        /// Returns whether the animation for the specified identifier is paused.
227        ///
228        /// Parameter `key`: The identifier for the animation to query.
229        #[deprecated = "Use -[SCNAnimationPlayer paused] instead"]
230        #[unsafe(method(isAnimationForKeyPaused:))]
231        #[unsafe(method_family = none)]
232        unsafe fn isAnimationForKeyPaused(&self, key: &NSString) -> bool;
233    }
234);
235
236extern_class!(
237    /// SCNAnimation represents an animation that targets a specific key path.
238    ///
239    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimation?language=objc)
240    #[unsafe(super(NSObject))]
241    #[derive(Debug, PartialEq, Eq, Hash)]
242    pub struct SCNAnimation;
243);
244
245extern_conformance!(
246    unsafe impl NSCoding for SCNAnimation {}
247);
248
249extern_conformance!(
250    unsafe impl NSCopying for SCNAnimation {}
251);
252
253unsafe impl CopyingHelper for SCNAnimation {
254    type Result = Self;
255}
256
257extern_conformance!(
258    unsafe impl NSObjectProtocol for SCNAnimation {}
259);
260
261extern_conformance!(
262    unsafe impl NSSecureCoding for SCNAnimation {}
263);
264
265extern_conformance!(
266    unsafe impl SCNAnimationProtocol for SCNAnimation {}
267);
268
269impl SCNAnimation {
270    extern_methods!(
271        /// Loads and returns an animation loaded from the specified URL.
272        ///
273        ///
274        /// Parameter `animationUrl`: The url to load.
275        #[unsafe(method(animationWithContentsOfURL:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn animationWithContentsOfURL(animation_url: &NSURL) -> Retained<SCNAnimation>;
278
279        /// Loads and returns the animation with the specified name in the current application bundle.
280        ///
281        ///
282        /// Parameter `animationName`: The name of the animation to load.
283        #[unsafe(method(animationNamed:))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn animationNamed(animation_name: &NSString) -> Retained<SCNAnimation>;
286
287        #[cfg(feature = "objc2-quartz-core")]
288        #[cfg(not(target_os = "watchos"))]
289        /// Returns a SCNAnimation initialized from a CAAnimation.
290        ///
291        ///
292        /// Parameter `caAnimation`: The CAAnimation to initialize from.
293        ///
294        /// Only CABasicAnimation, CAKeyframeAnimation and CAAnimationGroup are currently supported.
295        #[unsafe(method(animationWithCAAnimation:))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn animationWithCAAnimation(
298            ca_animation: &CAAnimation,
299        ) -> Retained<SCNAnimation>;
300
301        /// The duration of the animation in seconds. Defaults to 0.
302        #[unsafe(method(duration))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn duration(&self) -> NSTimeInterval;
305
306        /// Setter for [`duration`][Self::duration].
307        #[unsafe(method(setDuration:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
310
311        /// The key-path describing the property to be animated for single-property animations, nil for animations targetting multiple nodes. defaults to nil.
312        /// The key-path uses the KVC syntax. It's also possible to target a specific sub-node with the following syntax:
313        /// /
314        /// <node
315        /// -name>.property1.property2.field    (field is optional,
316        /// <node
317        /// -name> is the name of the targeted node).
318        #[unsafe(method(keyPath))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn keyPath(&self) -> Option<Retained<NSString>>;
321
322        /// Setter for [`keyPath`][Self::keyPath].
323        #[unsafe(method(setKeyPath:))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn setKeyPath(&self, key_path: Option<&NSString>);
326
327        /// A timing function defining the pacing of the animation. Defaults to nil indicating linear pacing.
328        #[unsafe(method(timingFunction))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn timingFunction(&self) -> Retained<SCNTimingFunction>;
331
332        /// Setter for [`timingFunction`][Self::timingFunction].
333        #[unsafe(method(setTimingFunction:))]
334        #[unsafe(method_family = none)]
335        pub unsafe fn setTimingFunction(&self, timing_function: &SCNTimingFunction);
336
337        /// Determines the receiver's blend-in duration.
338        ///
339        /// When the blendInDuration is greater than zero, the effect of the animation progressively increase from 0% to 100% during the specified duration.
340        #[unsafe(method(blendInDuration))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn blendInDuration(&self) -> NSTimeInterval;
343
344        /// Setter for [`blendInDuration`][Self::blendInDuration].
345        #[unsafe(method(setBlendInDuration:))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn setBlendInDuration(&self, blend_in_duration: NSTimeInterval);
348
349        /// Determines the receiver's blend-out duration.
350        ///
351        /// When the blendOutDuration is greater than zero, the effect of the animation progressively decrease from 100% to 0% at the end of the animation duration.
352        #[unsafe(method(blendOutDuration))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn blendOutDuration(&self) -> NSTimeInterval;
355
356        /// Setter for [`blendOutDuration`][Self::blendOutDuration].
357        #[unsafe(method(setBlendOutDuration:))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn setBlendOutDuration(&self, blend_out_duration: NSTimeInterval);
360
361        /// When true, the animation is removed from the render tree once its active duration has passed. Defaults to YES.
362        #[unsafe(method(isRemovedOnCompletion))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn isRemovedOnCompletion(&self) -> bool;
365
366        /// Setter for [`isRemovedOnCompletion`][Self::isRemovedOnCompletion].
367        #[unsafe(method(setRemovedOnCompletion:))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn setRemovedOnCompletion(&self, removed_on_completion: bool);
370
371        /// When true, the animation is applied to the model tree once its active duration has passed. Defaults to NO.
372        #[unsafe(method(isAppliedOnCompletion))]
373        #[unsafe(method_family = none)]
374        pub unsafe fn isAppliedOnCompletion(&self) -> bool;
375
376        /// Setter for [`isAppliedOnCompletion`][Self::isAppliedOnCompletion].
377        #[unsafe(method(setAppliedOnCompletion:))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn setAppliedOnCompletion(&self, applied_on_completion: bool);
380
381        #[cfg(feature = "objc2-core-foundation")]
382        /// The repeat count of the object. May be fractional. Defaults to 0.
383        #[unsafe(method(repeatCount))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn repeatCount(&self) -> CGFloat;
386
387        #[cfg(feature = "objc2-core-foundation")]
388        /// Setter for [`repeatCount`][Self::repeatCount].
389        #[unsafe(method(setRepeatCount:))]
390        #[unsafe(method_family = none)]
391        pub unsafe fn setRepeatCount(&self, repeat_count: CGFloat);
392
393        /// When true, the object plays backwards after playing forwards. Defaults to NO.
394        #[unsafe(method(autoreverses))]
395        #[unsafe(method_family = none)]
396        pub unsafe fn autoreverses(&self) -> bool;
397
398        /// Setter for [`autoreverses`][Self::autoreverses].
399        #[unsafe(method(setAutoreverses:))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn setAutoreverses(&self, autoreverses: bool);
402
403        /// The relative delay to start the animation, in relation to its parent animation if applicable. Defaults to 0.
404        ///
405        /// This property is bridged with CoreAnimations's beginTime. However, for top level animations, startDelay is relative to the current time (unlike CAAnimation's beginTime that is absolute). So if a CAAnimation has a non-zero beginTime, startDelay is initialized as caAnimation.beginTime - CACurrentMediaTime().
406        #[unsafe(method(startDelay))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn startDelay(&self) -> NSTimeInterval;
409
410        /// Setter for [`startDelay`][Self::startDelay].
411        #[unsafe(method(setStartDelay:))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn setStartDelay(&self, start_delay: NSTimeInterval);
414
415        /// Additional offset in active local time. i.e. to convert from parent
416        /// time tp to active local time t: t = (tp - begin) * speed + offset.
417        /// Defaults to 0.
418        #[unsafe(method(timeOffset))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn timeOffset(&self) -> NSTimeInterval;
421
422        /// Setter for [`timeOffset`][Self::timeOffset].
423        #[unsafe(method(setTimeOffset:))]
424        #[unsafe(method_family = none)]
425        pub unsafe fn setTimeOffset(&self, time_offset: NSTimeInterval);
426
427        /// When true, the animation remains active after its active duration and evaluates to its end value. Defaults to NO.
428        #[unsafe(method(fillsForward))]
429        #[unsafe(method_family = none)]
430        pub unsafe fn fillsForward(&self) -> bool;
431
432        /// Setter for [`fillsForward`][Self::fillsForward].
433        #[unsafe(method(setFillsForward:))]
434        #[unsafe(method_family = none)]
435        pub unsafe fn setFillsForward(&self, fills_forward: bool);
436
437        /// When true, the animation is active before its active duration and evaluates to its start value. Defaults to NO.
438        #[unsafe(method(fillsBackward))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn fillsBackward(&self) -> bool;
441
442        /// Setter for [`fillsBackward`][Self::fillsBackward].
443        #[unsafe(method(setFillsBackward:))]
444        #[unsafe(method_family = none)]
445        pub unsafe fn setFillsBackward(&self, fills_backward: bool);
446
447        /// Determines whether the receiver is evaluated using the scene time or the system time. Defaults to NO.
448        ///
449        /// A scene-time based animation is evaluated using the "sceneTime" value of the renderer that renders the scene.
450        /// The "sceneTime" base is typically used by players or editors that need to preview, edit and being able to change the evaluation time.
451        ///
452        /// See: SCNSceneSourceAnimationImportPolicyKey
453        #[unsafe(method(usesSceneTimeBase))]
454        #[unsafe(method_family = none)]
455        pub unsafe fn usesSceneTimeBase(&self) -> bool;
456
457        /// Setter for [`usesSceneTimeBase`][Self::usesSceneTimeBase].
458        #[unsafe(method(setUsesSceneTimeBase:))]
459        #[unsafe(method_family = none)]
460        pub unsafe fn setUsesSceneTimeBase(&self, uses_scene_time_base: bool);
461
462        #[cfg(feature = "block2")]
463        /// Called when the animation starts.
464        #[unsafe(method(animationDidStart))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn animationDidStart(&self) -> SCNAnimationDidStartBlock;
467
468        #[cfg(feature = "block2")]
469        /// Setter for [`animationDidStart`][Self::animationDidStart].
470        #[unsafe(method(setAnimationDidStart:))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn setAnimationDidStart(&self, animation_did_start: SCNAnimationDidStartBlock);
473
474        #[cfg(feature = "block2")]
475        /// Called when the animation either completes its active duration or
476        /// is removed from the object it is attached to (i.e. the layer). The 'completed' argument of SCNAnimationDidStopBlock
477        /// is true if the animation reached the end of its active duration without being removed.
478        #[unsafe(method(animationDidStop))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn animationDidStop(&self) -> SCNAnimationDidStopBlock;
481
482        #[cfg(feature = "block2")]
483        /// Setter for [`animationDidStop`][Self::animationDidStop].
484        #[unsafe(method(setAnimationDidStop:))]
485        #[unsafe(method_family = none)]
486        pub unsafe fn setAnimationDidStop(&self, animation_did_stop: SCNAnimationDidStopBlock);
487
488        /// Specifies the animation events attached to the receiver.
489        ///
490        /// See: SCNAnimationEvent
491        #[unsafe(method(animationEvents))]
492        #[unsafe(method_family = none)]
493        pub unsafe fn animationEvents(&self) -> Option<Retained<NSArray<SCNAnimationEvent>>>;
494
495        /// Setter for [`animationEvents`][Self::animationEvents].
496        #[unsafe(method(setAnimationEvents:))]
497        #[unsafe(method_family = none)]
498        pub unsafe fn setAnimationEvents(
499            &self,
500            animation_events: Option<&NSArray<SCNAnimationEvent>>,
501        );
502
503        /// When true the value specified by the animation will be "added" to
504        /// the current presentation value of the property to produce the new
505        /// presentation value. The addition function is type-dependent, e.g.
506        /// for affine transforms the two matrices are concatenated. Defaults to
507        /// NO.
508        #[unsafe(method(isAdditive))]
509        #[unsafe(method_family = none)]
510        pub unsafe fn isAdditive(&self) -> bool;
511
512        /// Setter for [`isAdditive`][Self::isAdditive].
513        #[unsafe(method(setAdditive:))]
514        #[unsafe(method_family = none)]
515        pub unsafe fn setAdditive(&self, additive: bool);
516
517        /// The `cumulative' property affects how repeating animations produce
518        /// their result. If true then the current value of the animation is the
519        /// value at the end of the previous repeat cycle, plus the value of the
520        /// current repeat cycle. If false, the value is simply the value
521        /// calculated for the current repeat cycle. Defaults to NO.
522        #[unsafe(method(isCumulative))]
523        #[unsafe(method_family = none)]
524        pub unsafe fn isCumulative(&self) -> bool;
525
526        /// Setter for [`isCumulative`][Self::isCumulative].
527        #[unsafe(method(setCumulative:))]
528        #[unsafe(method_family = none)]
529        pub unsafe fn setCumulative(&self, cumulative: bool);
530    );
531}
532
533/// Methods declared on superclass `NSObject`.
534impl SCNAnimation {
535    extern_methods!(
536        #[unsafe(method(init))]
537        #[unsafe(method_family = init)]
538        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
539
540        #[unsafe(method(new))]
541        #[unsafe(method_family = new)]
542        pub unsafe fn new() -> Retained<Self>;
543    );
544}
545
546extern_class!(
547    /// SCNAnimationPlayer let you control when and how to play and blend an animation
548    ///
549    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationplayer?language=objc)
550    #[unsafe(super(NSObject))]
551    #[derive(Debug, PartialEq, Eq, Hash)]
552    pub struct SCNAnimationPlayer;
553);
554
555extern_conformance!(
556    unsafe impl NSCoding for SCNAnimationPlayer {}
557);
558
559extern_conformance!(
560    unsafe impl NSCopying for SCNAnimationPlayer {}
561);
562
563unsafe impl CopyingHelper for SCNAnimationPlayer {
564    type Result = Self;
565}
566
567extern_conformance!(
568    unsafe impl NSObjectProtocol for SCNAnimationPlayer {}
569);
570
571extern_conformance!(
572    unsafe impl NSSecureCoding for SCNAnimationPlayer {}
573);
574
575extern_conformance!(
576    unsafe impl SCNAnimatable for SCNAnimationPlayer {}
577);
578
579impl SCNAnimationPlayer {
580    extern_methods!(
581        /// Initialize an animation player with an animation
582        ///
583        /// Parameter `animation`: The animation to play
584        #[unsafe(method(animationPlayerWithAnimation:))]
585        #[unsafe(method_family = none)]
586        pub unsafe fn animationPlayerWithAnimation(
587            animation: &SCNAnimation,
588        ) -> Retained<SCNAnimationPlayer>;
589
590        /// The played animation
591        #[unsafe(method(animation))]
592        #[unsafe(method_family = none)]
593        pub unsafe fn animation(&self) -> Retained<SCNAnimation>;
594
595        #[cfg(feature = "objc2-core-foundation")]
596        /// The speed to play the animation at. Defaults to 1.0. Animatable
597        #[unsafe(method(speed))]
598        #[unsafe(method_family = none)]
599        pub unsafe fn speed(&self) -> CGFloat;
600
601        #[cfg(feature = "objc2-core-foundation")]
602        /// Setter for [`speed`][Self::speed].
603        #[unsafe(method(setSpeed:))]
604        #[unsafe(method_family = none)]
605        pub unsafe fn setSpeed(&self, speed: CGFloat);
606
607        #[cfg(feature = "objc2-core-foundation")]
608        /// Controls the influence of the played animation. When set to 1 the animation is applied without any blending. When set to less than 1, the animation value is blent with the current presentation value of the animated property. Defaults to 1.0. Animatable.
609        #[unsafe(method(blendFactor))]
610        #[unsafe(method_family = none)]
611        pub unsafe fn blendFactor(&self) -> CGFloat;
612
613        #[cfg(feature = "objc2-core-foundation")]
614        /// Setter for [`blendFactor`][Self::blendFactor].
615        #[unsafe(method(setBlendFactor:))]
616        #[unsafe(method_family = none)]
617        pub unsafe fn setBlendFactor(&self, blend_factor: CGFloat);
618
619        /// Specifies if the animation is paused. Defaults to NO.
620        #[unsafe(method(paused))]
621        #[unsafe(method_family = none)]
622        pub unsafe fn paused(&self) -> bool;
623
624        /// Setter for [`paused`][Self::paused].
625        #[unsafe(method(setPaused:))]
626        #[unsafe(method_family = none)]
627        pub unsafe fn setPaused(&self, paused: bool);
628
629        /// Set paused to NO and restart playing from the beginning of the animation.
630        #[unsafe(method(play))]
631        #[unsafe(method_family = none)]
632        pub unsafe fn play(&self);
633
634        /// Stop the animation.
635        #[unsafe(method(stop))]
636        #[unsafe(method_family = none)]
637        pub unsafe fn stop(&self);
638
639        /// Stop the animation and smoothly blend out the animation over the specified duration.
640        #[unsafe(method(stopWithBlendOutDuration:))]
641        #[unsafe(method_family = none)]
642        pub unsafe fn stopWithBlendOutDuration(&self, duration: NSTimeInterval);
643    );
644}
645
646/// Methods declared on superclass `NSObject`.
647impl SCNAnimationPlayer {
648    extern_methods!(
649        #[unsafe(method(init))]
650        #[unsafe(method_family = init)]
651        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
652
653        #[unsafe(method(new))]
654        #[unsafe(method_family = new)]
655        pub unsafe fn new() -> Retained<Self>;
656    );
657}
658
659/// Signature for the block executed when the animation event is triggered.
660///
661/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationeventblock?language=objc)
662#[cfg(feature = "block2")]
663pub type SCNAnimationEventBlock = *mut block2::DynBlock<
664    dyn Fn(NonNull<ProtocolObject<dyn SCNAnimationProtocol>>, NonNull<AnyObject>, Bool),
665>;
666
667extern_class!(
668    /// SCNAnimationEvent encapsulates a block to trigger at a specific time.
669    ///
670    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationevent?language=objc)
671    #[unsafe(super(NSObject))]
672    #[derive(Debug, PartialEq, Eq, Hash)]
673    pub struct SCNAnimationEvent;
674);
675
676extern_conformance!(
677    unsafe impl NSObjectProtocol for SCNAnimationEvent {}
678);
679
680impl SCNAnimationEvent {
681    extern_methods!(
682        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
683        /// Returns an animation event instance
684        ///
685        /// Parameter `time`: The relative time to trigger the event.
686        ///
687        /// Parameter `eventBlock`: The block to call when the event is triggered.
688        ///
689        /// "time" is relative to animation duration and therefor it has to be a value in the range [0,1].
690        #[unsafe(method(animationEventWithKeyTime:block:))]
691        #[unsafe(method_family = none)]
692        pub unsafe fn animationEventWithKeyTime_block(
693            time: CGFloat,
694            event_block: SCNAnimationEventBlock,
695        ) -> Retained<Self>;
696    );
697}
698
699/// Methods declared on superclass `NSObject`.
700impl SCNAnimationEvent {
701    extern_methods!(
702        #[unsafe(method(init))]
703        #[unsafe(method_family = init)]
704        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
705
706        #[unsafe(method(new))]
707        #[unsafe(method_family = new)]
708        pub unsafe fn new() -> Retained<Self>;
709    );
710}