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        ///
324        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
325        #[unsafe(method(setKeyPath:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn setKeyPath(&self, key_path: Option<&NSString>);
328
329        /// A timing function defining the pacing of the animation. Defaults to nil indicating linear pacing.
330        #[unsafe(method(timingFunction))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn timingFunction(&self) -> Retained<SCNTimingFunction>;
333
334        /// Setter for [`timingFunction`][Self::timingFunction].
335        #[unsafe(method(setTimingFunction:))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn setTimingFunction(&self, timing_function: &SCNTimingFunction);
338
339        /// Determines the receiver's blend-in duration.
340        ///
341        /// When the blendInDuration is greater than zero, the effect of the animation progressively increase from 0% to 100% during the specified duration.
342        #[unsafe(method(blendInDuration))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn blendInDuration(&self) -> NSTimeInterval;
345
346        /// Setter for [`blendInDuration`][Self::blendInDuration].
347        #[unsafe(method(setBlendInDuration:))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn setBlendInDuration(&self, blend_in_duration: NSTimeInterval);
350
351        /// Determines the receiver's blend-out duration.
352        ///
353        /// 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.
354        #[unsafe(method(blendOutDuration))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn blendOutDuration(&self) -> NSTimeInterval;
357
358        /// Setter for [`blendOutDuration`][Self::blendOutDuration].
359        #[unsafe(method(setBlendOutDuration:))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn setBlendOutDuration(&self, blend_out_duration: NSTimeInterval);
362
363        /// When true, the animation is removed from the render tree once its active duration has passed. Defaults to YES.
364        #[unsafe(method(isRemovedOnCompletion))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn isRemovedOnCompletion(&self) -> bool;
367
368        /// Setter for [`isRemovedOnCompletion`][Self::isRemovedOnCompletion].
369        #[unsafe(method(setRemovedOnCompletion:))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn setRemovedOnCompletion(&self, removed_on_completion: bool);
372
373        /// When true, the animation is applied to the model tree once its active duration has passed. Defaults to NO.
374        #[unsafe(method(isAppliedOnCompletion))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn isAppliedOnCompletion(&self) -> bool;
377
378        /// Setter for [`isAppliedOnCompletion`][Self::isAppliedOnCompletion].
379        #[unsafe(method(setAppliedOnCompletion:))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn setAppliedOnCompletion(&self, applied_on_completion: bool);
382
383        #[cfg(feature = "objc2-core-foundation")]
384        /// The repeat count of the object. May be fractional. Defaults to 0.
385        #[unsafe(method(repeatCount))]
386        #[unsafe(method_family = none)]
387        pub unsafe fn repeatCount(&self) -> CGFloat;
388
389        #[cfg(feature = "objc2-core-foundation")]
390        /// Setter for [`repeatCount`][Self::repeatCount].
391        #[unsafe(method(setRepeatCount:))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn setRepeatCount(&self, repeat_count: CGFloat);
394
395        /// When true, the object plays backwards after playing forwards. Defaults to NO.
396        #[unsafe(method(autoreverses))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn autoreverses(&self) -> bool;
399
400        /// Setter for [`autoreverses`][Self::autoreverses].
401        #[unsafe(method(setAutoreverses:))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn setAutoreverses(&self, autoreverses: bool);
404
405        /// The relative delay to start the animation, in relation to its parent animation if applicable. Defaults to 0.
406        ///
407        /// 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().
408        #[unsafe(method(startDelay))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn startDelay(&self) -> NSTimeInterval;
411
412        /// Setter for [`startDelay`][Self::startDelay].
413        #[unsafe(method(setStartDelay:))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn setStartDelay(&self, start_delay: NSTimeInterval);
416
417        /// Additional offset in active local time. i.e. to convert from parent
418        /// time tp to active local time t: t = (tp - begin) * speed + offset.
419        /// Defaults to 0.
420        #[unsafe(method(timeOffset))]
421        #[unsafe(method_family = none)]
422        pub unsafe fn timeOffset(&self) -> NSTimeInterval;
423
424        /// Setter for [`timeOffset`][Self::timeOffset].
425        #[unsafe(method(setTimeOffset:))]
426        #[unsafe(method_family = none)]
427        pub unsafe fn setTimeOffset(&self, time_offset: NSTimeInterval);
428
429        /// When true, the animation remains active after its active duration and evaluates to its end value. Defaults to NO.
430        #[unsafe(method(fillsForward))]
431        #[unsafe(method_family = none)]
432        pub unsafe fn fillsForward(&self) -> bool;
433
434        /// Setter for [`fillsForward`][Self::fillsForward].
435        #[unsafe(method(setFillsForward:))]
436        #[unsafe(method_family = none)]
437        pub unsafe fn setFillsForward(&self, fills_forward: bool);
438
439        /// When true, the animation is active before its active duration and evaluates to its start value. Defaults to NO.
440        #[unsafe(method(fillsBackward))]
441        #[unsafe(method_family = none)]
442        pub unsafe fn fillsBackward(&self) -> bool;
443
444        /// Setter for [`fillsBackward`][Self::fillsBackward].
445        #[unsafe(method(setFillsBackward:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn setFillsBackward(&self, fills_backward: bool);
448
449        /// Determines whether the receiver is evaluated using the scene time or the system time. Defaults to NO.
450        ///
451        /// A scene-time based animation is evaluated using the "sceneTime" value of the renderer that renders the scene.
452        /// The "sceneTime" base is typically used by players or editors that need to preview, edit and being able to change the evaluation time.
453        ///
454        /// See: SCNSceneSourceAnimationImportPolicyKey
455        #[unsafe(method(usesSceneTimeBase))]
456        #[unsafe(method_family = none)]
457        pub unsafe fn usesSceneTimeBase(&self) -> bool;
458
459        /// Setter for [`usesSceneTimeBase`][Self::usesSceneTimeBase].
460        #[unsafe(method(setUsesSceneTimeBase:))]
461        #[unsafe(method_family = none)]
462        pub unsafe fn setUsesSceneTimeBase(&self, uses_scene_time_base: bool);
463
464        #[cfg(feature = "block2")]
465        /// Called when the animation starts.
466        ///
467        /// # Safety
468        ///
469        /// - The returned block's argument 1 must be a valid pointer.
470        /// - The returned block's argument 2 must be a valid pointer.
471        #[unsafe(method(animationDidStart))]
472        #[unsafe(method_family = none)]
473        pub unsafe fn animationDidStart(&self) -> SCNAnimationDidStartBlock;
474
475        #[cfg(feature = "block2")]
476        /// Setter for [`animationDidStart`][Self::animationDidStart].
477        ///
478        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
479        ///
480        /// # Safety
481        ///
482        /// `animation_did_start` must be a valid pointer or null.
483        #[unsafe(method(setAnimationDidStart:))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn setAnimationDidStart(&self, animation_did_start: SCNAnimationDidStartBlock);
486
487        #[cfg(feature = "block2")]
488        /// Called when the animation either completes its active duration or
489        /// is removed from the object it is attached to (i.e. the layer). The 'completed' argument of SCNAnimationDidStopBlock
490        /// is true if the animation reached the end of its active duration without being removed.
491        ///
492        /// # Safety
493        ///
494        /// - The returned block's argument 1 must be a valid pointer.
495        /// - The returned block's argument 2 must be a valid pointer.
496        #[unsafe(method(animationDidStop))]
497        #[unsafe(method_family = none)]
498        pub unsafe fn animationDidStop(&self) -> SCNAnimationDidStopBlock;
499
500        #[cfg(feature = "block2")]
501        /// Setter for [`animationDidStop`][Self::animationDidStop].
502        ///
503        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
504        ///
505        /// # Safety
506        ///
507        /// `animation_did_stop` must be a valid pointer or null.
508        #[unsafe(method(setAnimationDidStop:))]
509        #[unsafe(method_family = none)]
510        pub unsafe fn setAnimationDidStop(&self, animation_did_stop: SCNAnimationDidStopBlock);
511
512        /// Specifies the animation events attached to the receiver.
513        ///
514        /// See: SCNAnimationEvent
515        #[unsafe(method(animationEvents))]
516        #[unsafe(method_family = none)]
517        pub unsafe fn animationEvents(&self) -> Option<Retained<NSArray<SCNAnimationEvent>>>;
518
519        /// Setter for [`animationEvents`][Self::animationEvents].
520        ///
521        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
522        #[unsafe(method(setAnimationEvents:))]
523        #[unsafe(method_family = none)]
524        pub unsafe fn setAnimationEvents(
525            &self,
526            animation_events: Option<&NSArray<SCNAnimationEvent>>,
527        );
528
529        /// When true the value specified by the animation will be "added" to
530        /// the current presentation value of the property to produce the new
531        /// presentation value. The addition function is type-dependent, e.g.
532        /// for affine transforms the two matrices are concatenated. Defaults to
533        /// NO.
534        #[unsafe(method(isAdditive))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn isAdditive(&self) -> bool;
537
538        /// Setter for [`isAdditive`][Self::isAdditive].
539        #[unsafe(method(setAdditive:))]
540        #[unsafe(method_family = none)]
541        pub unsafe fn setAdditive(&self, additive: bool);
542
543        /// The `cumulative' property affects how repeating animations produce
544        /// their result. If true then the current value of the animation is the
545        /// value at the end of the previous repeat cycle, plus the value of the
546        /// current repeat cycle. If false, the value is simply the value
547        /// calculated for the current repeat cycle. Defaults to NO.
548        #[unsafe(method(isCumulative))]
549        #[unsafe(method_family = none)]
550        pub unsafe fn isCumulative(&self) -> bool;
551
552        /// Setter for [`isCumulative`][Self::isCumulative].
553        #[unsafe(method(setCumulative:))]
554        #[unsafe(method_family = none)]
555        pub unsafe fn setCumulative(&self, cumulative: bool);
556    );
557}
558
559/// Methods declared on superclass `NSObject`.
560impl SCNAnimation {
561    extern_methods!(
562        #[unsafe(method(init))]
563        #[unsafe(method_family = init)]
564        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
565
566        #[unsafe(method(new))]
567        #[unsafe(method_family = new)]
568        pub unsafe fn new() -> Retained<Self>;
569    );
570}
571
572extern_class!(
573    /// SCNAnimationPlayer let you control when and how to play and blend an animation
574    ///
575    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationplayer?language=objc)
576    #[unsafe(super(NSObject))]
577    #[derive(Debug, PartialEq, Eq, Hash)]
578    pub struct SCNAnimationPlayer;
579);
580
581extern_conformance!(
582    unsafe impl NSCoding for SCNAnimationPlayer {}
583);
584
585extern_conformance!(
586    unsafe impl NSCopying for SCNAnimationPlayer {}
587);
588
589unsafe impl CopyingHelper for SCNAnimationPlayer {
590    type Result = Self;
591}
592
593extern_conformance!(
594    unsafe impl NSObjectProtocol for SCNAnimationPlayer {}
595);
596
597extern_conformance!(
598    unsafe impl NSSecureCoding for SCNAnimationPlayer {}
599);
600
601extern_conformance!(
602    unsafe impl SCNAnimatable for SCNAnimationPlayer {}
603);
604
605impl SCNAnimationPlayer {
606    extern_methods!(
607        /// Initialize an animation player with an animation
608        ///
609        /// Parameter `animation`: The animation to play
610        #[unsafe(method(animationPlayerWithAnimation:))]
611        #[unsafe(method_family = none)]
612        pub unsafe fn animationPlayerWithAnimation(
613            animation: &SCNAnimation,
614        ) -> Retained<SCNAnimationPlayer>;
615
616        /// The played animation
617        #[unsafe(method(animation))]
618        #[unsafe(method_family = none)]
619        pub unsafe fn animation(&self) -> Retained<SCNAnimation>;
620
621        #[cfg(feature = "objc2-core-foundation")]
622        /// The speed to play the animation at. Defaults to 1.0. Animatable
623        #[unsafe(method(speed))]
624        #[unsafe(method_family = none)]
625        pub unsafe fn speed(&self) -> CGFloat;
626
627        #[cfg(feature = "objc2-core-foundation")]
628        /// Setter for [`speed`][Self::speed].
629        #[unsafe(method(setSpeed:))]
630        #[unsafe(method_family = none)]
631        pub unsafe fn setSpeed(&self, speed: CGFloat);
632
633        #[cfg(feature = "objc2-core-foundation")]
634        /// 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.
635        #[unsafe(method(blendFactor))]
636        #[unsafe(method_family = none)]
637        pub unsafe fn blendFactor(&self) -> CGFloat;
638
639        #[cfg(feature = "objc2-core-foundation")]
640        /// Setter for [`blendFactor`][Self::blendFactor].
641        #[unsafe(method(setBlendFactor:))]
642        #[unsafe(method_family = none)]
643        pub unsafe fn setBlendFactor(&self, blend_factor: CGFloat);
644
645        /// Specifies if the animation is paused. Defaults to NO.
646        #[unsafe(method(paused))]
647        #[unsafe(method_family = none)]
648        pub unsafe fn paused(&self) -> bool;
649
650        /// Setter for [`paused`][Self::paused].
651        #[unsafe(method(setPaused:))]
652        #[unsafe(method_family = none)]
653        pub unsafe fn setPaused(&self, paused: bool);
654
655        /// Set paused to NO and restart playing from the beginning of the animation.
656        #[unsafe(method(play))]
657        #[unsafe(method_family = none)]
658        pub unsafe fn play(&self);
659
660        /// Stop the animation.
661        #[unsafe(method(stop))]
662        #[unsafe(method_family = none)]
663        pub unsafe fn stop(&self);
664
665        /// Stop the animation and smoothly blend out the animation over the specified duration.
666        #[unsafe(method(stopWithBlendOutDuration:))]
667        #[unsafe(method_family = none)]
668        pub unsafe fn stopWithBlendOutDuration(&self, duration: NSTimeInterval);
669    );
670}
671
672/// Methods declared on superclass `NSObject`.
673impl SCNAnimationPlayer {
674    extern_methods!(
675        #[unsafe(method(init))]
676        #[unsafe(method_family = init)]
677        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
678
679        #[unsafe(method(new))]
680        #[unsafe(method_family = new)]
681        pub unsafe fn new() -> Retained<Self>;
682    );
683}
684
685/// Signature for the block executed when the animation event is triggered.
686///
687/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationeventblock?language=objc)
688#[cfg(feature = "block2")]
689pub type SCNAnimationEventBlock = *mut block2::DynBlock<
690    dyn Fn(NonNull<ProtocolObject<dyn SCNAnimationProtocol>>, NonNull<AnyObject>, Bool),
691>;
692
693extern_class!(
694    /// SCNAnimationEvent encapsulates a block to trigger at a specific time.
695    ///
696    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnanimationevent?language=objc)
697    #[unsafe(super(NSObject))]
698    #[derive(Debug, PartialEq, Eq, Hash)]
699    pub struct SCNAnimationEvent;
700);
701
702extern_conformance!(
703    unsafe impl NSObjectProtocol for SCNAnimationEvent {}
704);
705
706impl SCNAnimationEvent {
707    extern_methods!(
708        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
709        /// Returns an animation event instance
710        ///
711        /// Parameter `time`: The relative time to trigger the event.
712        ///
713        /// Parameter `eventBlock`: The block to call when the event is triggered.
714        ///
715        /// "time" is relative to animation duration and therefor it has to be a value in the range [0,1].
716        ///
717        /// # Safety
718        ///
719        /// `event_block` must be a valid pointer.
720        #[unsafe(method(animationEventWithKeyTime:block:))]
721        #[unsafe(method_family = none)]
722        pub unsafe fn animationEventWithKeyTime_block(
723            time: CGFloat,
724            event_block: SCNAnimationEventBlock,
725        ) -> Retained<Self>;
726    );
727}
728
729/// Methods declared on superclass `NSObject`.
730impl SCNAnimationEvent {
731    extern_methods!(
732        #[unsafe(method(init))]
733        #[unsafe(method_family = init)]
734        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
735
736        #[unsafe(method(new))]
737        #[unsafe(method_family = new)]
738        pub unsafe fn new() -> Retained<Self>;
739    );
740}