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