objc2_sprite_kit/generated/
SKAction.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-app-kit")]
9#[cfg(target_os = "macos")]
10use objc2_app_kit::*;
11#[cfg(feature = "objc2-core-foundation")]
12use objc2_core_foundation::*;
13#[cfg(feature = "objc2-core-graphics")]
14use objc2_core_graphics::*;
15use objc2_foundation::*;
16
17use crate::*;
18
19/// Adjust the timing of an action
20///
21///
22/// animation to occur evenly over its duration.
23///
24/// animation to begin slowly, and then speed up as it progresses.
25///
26/// the animation to begin quickly, and then slow as it completes.
27///
28/// ease-in ease-out animation begins slowly, accelerates through the middle
29/// of its duration, and then slows again before completing.
30///
31/// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skactiontimingmode?language=objc)
32// NS_ENUM
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct SKActionTimingMode(pub NSInteger);
36impl SKActionTimingMode {
37    #[doc(alias = "SKActionTimingLinear")]
38    pub const Linear: Self = Self(0);
39    #[doc(alias = "SKActionTimingEaseIn")]
40    pub const EaseIn: Self = Self(1);
41    #[doc(alias = "SKActionTimingEaseOut")]
42    pub const EaseOut: Self = Self(2);
43    #[doc(alias = "SKActionTimingEaseInEaseOut")]
44    pub const EaseInEaseOut: Self = Self(3);
45}
46
47unsafe impl Encode for SKActionTimingMode {
48    const ENCODING: Encoding = NSInteger::ENCODING;
49}
50
51unsafe impl RefEncode for SKActionTimingMode {
52    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
53}
54
55/// A custom timing function for SKActions. Input time will be linear 0.0-1.0
56/// over the duration of the action. Return values must be 0.0-1.0 and increasing
57/// and the function must return 1.0 when the input time reaches 1.0.
58///
59/// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skactiontimingfunction?language=objc)
60#[cfg(feature = "block2")]
61pub type SKActionTimingFunction = *mut block2::DynBlock<dyn Fn(c_float) -> c_float>;
62
63extern_class!(
64    /// An SKAction object is an action that is executed by a node in the scene.
65    /// Actions are most often used to change the structure and content of the node to
66    /// which they are attached, but can also make other changes to the scene. When
67    /// the scene processes its nodes, actions associated with those nodes are evaluated.
68    ///
69    /// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skaction?language=objc)
70    #[unsafe(super(NSObject))]
71    #[derive(Debug, PartialEq, Eq, Hash)]
72    pub struct SKAction;
73);
74
75extern_conformance!(
76    unsafe impl NSCoding for SKAction {}
77);
78
79extern_conformance!(
80    unsafe impl NSCopying for SKAction {}
81);
82
83unsafe impl CopyingHelper for SKAction {
84    type Result = Self;
85}
86
87extern_conformance!(
88    unsafe impl NSObjectProtocol for SKAction {}
89);
90
91extern_conformance!(
92    unsafe impl NSSecureCoding for SKAction {}
93);
94
95impl SKAction {
96    extern_methods!(
97        /// The duration required to complete an action, in seconds.
98        #[unsafe(method(duration))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn duration(&self) -> NSTimeInterval;
101
102        /// Setter for [`duration`][Self::duration].
103        #[unsafe(method(setDuration:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
106
107        /// The timing mode used to execute an action
108        ///
109        /// See: SKActionTimingMode
110        #[unsafe(method(timingMode))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn timingMode(&self) -> SKActionTimingMode;
113
114        /// Setter for [`timingMode`][Self::timingMode].
115        #[unsafe(method(setTimingMode:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setTimingMode(&self, timing_mode: SKActionTimingMode);
118
119        #[cfg(feature = "block2")]
120        /// When set, prodives a custom timing via a block. Applies after
121        /// the 'timingMode' property is taken into account, defaults to nil
122        ///
123        /// See: SKActionTimingFunction
124        #[unsafe(method(timingFunction))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn timingFunction(&self) -> SKActionTimingFunction;
127
128        #[cfg(feature = "block2")]
129        /// Setter for [`timingFunction`][Self::timingFunction].
130        ///
131        /// # Safety
132        ///
133        /// `timing_function` must be a valid pointer.
134        #[unsafe(method(setTimingFunction:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setTimingFunction(&self, timing_function: SKActionTimingFunction);
137
138        #[cfg(feature = "objc2-core-foundation")]
139        /// A speed factor that modifies how fast an action runs. Default value is 1.0
140        #[unsafe(method(speed))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn speed(&self) -> CGFloat;
143
144        #[cfg(feature = "objc2-core-foundation")]
145        /// Setter for [`speed`][Self::speed].
146        #[unsafe(method(setSpeed:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setSpeed(&self, speed: CGFloat);
149
150        /// Creates an action that reverses the behavior of another action
151        ///
152        ///
153        /// Returns: This method always returns an action object; however, not all actions
154        /// are reversible
155        #[unsafe(method(reversedAction))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn reversedAction(&self) -> Retained<SKAction>;
158    );
159}
160
161/// Methods declared on superclass `NSObject`.
162impl SKAction {
163    extern_methods!(
164        #[unsafe(method(init))]
165        #[unsafe(method_family = init)]
166        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
167
168        #[unsafe(method(new))]
169        #[unsafe(method_family = new)]
170        pub unsafe fn new() -> Retained<Self>;
171    );
172}
173
174/// SKActions.
175impl SKAction {
176    extern_methods!(
177        #[cfg(feature = "objc2-core-foundation")]
178        /// Creates an action that moves a node relative to its current position
179        ///
180        /// Parameter `delta`: A vector that describes the change to apply to the node’s position
181        ///
182        /// Parameter `duration`: The duration of the animation, in seconds
183        #[unsafe(method(moveBy:duration:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn moveBy_duration(
186            delta: CGVector,
187            duration: NSTimeInterval,
188        ) -> Retained<SKAction>;
189
190        #[cfg(feature = "objc2-core-foundation")]
191        #[unsafe(method(moveByX:y:duration:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn moveByX_y_duration(
194            delta_x: CGFloat,
195            delta_y: CGFloat,
196            duration: NSTimeInterval,
197        ) -> Retained<SKAction>;
198
199        #[cfg(feature = "objc2-core-foundation")]
200        /// Creates an action that moves a node to a new position
201        ///
202        /// Parameter `location`: The coordinates for the node’s new position
203        ///
204        /// Parameter `duration`: The duration of the animation, in seconds
205        #[unsafe(method(moveTo:duration:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn moveTo_duration(
208            location: CGPoint,
209            duration: NSTimeInterval,
210        ) -> Retained<SKAction>;
211
212        #[cfg(feature = "objc2-core-foundation")]
213        #[unsafe(method(moveToX:duration:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn moveToX_duration(x: CGFloat, duration: NSTimeInterval) -> Retained<SKAction>;
216
217        #[cfg(feature = "objc2-core-foundation")]
218        #[unsafe(method(moveToY:duration:))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn moveToY_duration(y: CGFloat, duration: NSTimeInterval) -> Retained<SKAction>;
221
222        #[cfg(feature = "objc2-core-foundation")]
223        /// Creates an action that rotates the node by a relative value
224        ///
225        /// Parameter `radians`: The amount to rotate the node, in radians
226        ///
227        /// Parameter `duration`: The duration of the animation, in seconds
228        #[unsafe(method(rotateByAngle:duration:))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn rotateByAngle_duration(
231            radians: CGFloat,
232            duration: NSTimeInterval,
233        ) -> Retained<SKAction>;
234
235        #[cfg(feature = "objc2-core-foundation")]
236        /// Creates an action that rotates the node counterclockwise to an absolute angle
237        ///
238        /// Parameter `radians`: The angle to rotate the node to, in radians
239        ///
240        /// Parameter `duration`: The duration of the animation
241        #[unsafe(method(rotateToAngle:duration:))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn rotateToAngle_duration(
244            radians: CGFloat,
245            duration: NSTimeInterval,
246        ) -> Retained<SKAction>;
247
248        #[cfg(feature = "objc2-core-foundation")]
249        /// Creates an action that rotates the node to an absolute value
250        ///
251        /// Parameter `radians`: The angle to rotate the node to, in radians
252        ///
253        /// Parameter `duration`: The duration of the animation, in seconds
254        ///
255        /// Parameter `shortestUnitArc`: If YES, then the rotation is performed in whichever
256        /// direction results in the smallest rotation. If NO, then the rotation
257        /// is interpolated
258        #[unsafe(method(rotateToAngle:duration:shortestUnitArc:))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn rotateToAngle_duration_shortestUnitArc(
261            radians: CGFloat,
262            duration: NSTimeInterval,
263            shortest_unit_arc: bool,
264        ) -> Retained<SKAction>;
265
266        #[cfg(feature = "objc2-core-foundation")]
267        /// Creates an action that adjusts the size of a sprite
268        ///
269        /// Parameter `width`: The amount to add to the sprite’s width
270        ///
271        /// Parameter `height`: The amount to add to the sprite’s height
272        ///
273        /// Parameter `duration`: The duration of the animation, in seconds
274        #[unsafe(method(resizeByWidth:height:duration:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn resizeByWidth_height_duration(
277            width: CGFloat,
278            height: CGFloat,
279            duration: NSTimeInterval,
280        ) -> Retained<SKAction>;
281
282        #[cfg(feature = "objc2-core-foundation")]
283        /// Creates an action that changes the width and height of a sprite to a new absolute value
284        ///
285        /// Parameter `width`: The new width of the sprite
286        ///
287        /// Parameter `height`: The new height of the sprite
288        ///
289        /// Parameter `duration`: The duration of the animation, in seconds
290        #[unsafe(method(resizeToWidth:height:duration:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn resizeToWidth_height_duration(
293            width: CGFloat,
294            height: CGFloat,
295            duration: NSTimeInterval,
296        ) -> Retained<SKAction>;
297
298        #[cfg(feature = "objc2-core-foundation")]
299        #[unsafe(method(resizeToWidth:duration:))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn resizeToWidth_duration(
302            width: CGFloat,
303            duration: NSTimeInterval,
304        ) -> Retained<SKAction>;
305
306        #[cfg(feature = "objc2-core-foundation")]
307        #[unsafe(method(resizeToHeight:duration:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn resizeToHeight_duration(
310            height: CGFloat,
311            duration: NSTimeInterval,
312        ) -> Retained<SKAction>;
313
314        #[cfg(feature = "objc2-core-foundation")]
315        /// Creates an action that changes the x and y scale values of a node by a relative value
316        ///
317        /// Parameter `scale`: The amount to modify to the node’s x and y scale values
318        ///
319        /// Parameter `duration`: The duration of the animation, in seconds
320        #[unsafe(method(scaleBy:duration:))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn scaleBy_duration(
323            scale: CGFloat,
324            duration: NSTimeInterval,
325        ) -> Retained<SKAction>;
326
327        #[cfg(feature = "objc2-core-foundation")]
328        #[unsafe(method(scaleXBy:y:duration:))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn scaleXBy_y_duration(
331            x_scale: CGFloat,
332            y_scale: CGFloat,
333            duration: NSTimeInterval,
334        ) -> Retained<SKAction>;
335
336        #[cfg(feature = "objc2-core-foundation")]
337        /// Creates an action that changes the x and y scale values of a node by a relative value
338        ///
339        /// Parameter `scale`: The new value for the node’s x and y scale values
340        ///
341        /// Parameter `duration`: The duration of the animation, in seconds
342        #[unsafe(method(scaleTo:duration:))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn scaleTo_duration(
345            scale: CGFloat,
346            duration: NSTimeInterval,
347        ) -> Retained<SKAction>;
348
349        #[cfg(feature = "objc2-core-foundation")]
350        #[unsafe(method(scaleXTo:y:duration:))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn scaleXTo_y_duration(
353            x_scale: CGFloat,
354            y_scale: CGFloat,
355            duration: NSTimeInterval,
356        ) -> Retained<SKAction>;
357
358        #[cfg(feature = "objc2-core-foundation")]
359        #[unsafe(method(scaleXTo:duration:))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn scaleXTo_duration(
362            scale: CGFloat,
363            duration: NSTimeInterval,
364        ) -> Retained<SKAction>;
365
366        #[cfg(feature = "objc2-core-foundation")]
367        #[unsafe(method(scaleYTo:duration:))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn scaleYTo_duration(
370            scale: CGFloat,
371            duration: NSTimeInterval,
372        ) -> Retained<SKAction>;
373
374        #[cfg(feature = "objc2-core-foundation")]
375        /// Adjust the sprite's xScale
376        /// &
377        /// yScale to achieve the desired size (in parent's coordinate space)
378        ///
379        /// Parameter `duration`: The duration of the animation, in seconds
380        #[unsafe(method(scaleToSize:duration:))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn scaleToSize_duration(
383            size: CGSize,
384            duration: NSTimeInterval,
385        ) -> Retained<SKAction>;
386
387        /// Creates an action that runs a collection of actions sequentially
388        ///
389        /// Parameter `actions`: An array of SKAction objects
390        ///
391        ///
392        /// When the action executes, the first action in the sequence starts
393        /// and runs to completion. Subsequent actions in the sequence run in a
394        /// similar fashion until all of the actions in the sequence have executed.
395        /// The duration of the sequence action is the sum of the durations of the
396        /// actions in the sequence.
397        ///
398        /// This action is reversible; it creates a new sequence action that reverses
399        /// the order of the actions. Each action in the reversed sequence is itself
400        /// reversed. For example, if an action sequence is {1,2,3}, the reversed
401        /// sequence would be {3R,2R,1R}.
402        #[unsafe(method(sequence:))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn sequence(actions: &NSArray<SKAction>) -> Retained<SKAction>;
405
406        /// Creates an action that runs a collection of actions concurrently
407        ///
408        /// Parameter `actions`: An array of SKAction objects
409        ///
410        ///
411        /// When the action executes, the actions that comprise the group
412        /// all start immediately and run in parallel. The duration of the group
413        /// action is the longest duration among the collection of actions. If an
414        /// action in the group has a duration less than the group’s duration, the
415        /// action completes, then idles until the group completes the remaining
416        /// actions. This matters most when creating a repeating action that repeats
417        /// a group.
418        #[unsafe(method(group:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn group(actions: &NSArray<SKAction>) -> Retained<SKAction>;
421
422        /// Creates an action that repeats another action a specified number of times
423        ///
424        /// Parameter `action`: The action to execute
425        ///
426        /// Parameter `count`: The number of times to execute the action
427        #[unsafe(method(repeatAction:count:))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn repeatAction_count(
430            action: &SKAction,
431            count: NSUInteger,
432        ) -> Retained<SKAction>;
433
434        /// Creates an action that repeats forever
435        ///
436        /// Parameter `action`: The action to execute
437        #[unsafe(method(repeatActionForever:))]
438        #[unsafe(method_family = none)]
439        pub unsafe fn repeatActionForever(action: &SKAction) -> Retained<SKAction>;
440
441        /// Creates an action that changes the alpha value of the node to 1.0
442        ///
443        /// Parameter `duration`: The duration of the animation, in seconds
444        #[unsafe(method(fadeInWithDuration:))]
445        #[unsafe(method_family = none)]
446        pub unsafe fn fadeInWithDuration(duration: NSTimeInterval) -> Retained<SKAction>;
447
448        /// Creates an action that changes the alpha value of the node to 0.0
449        ///
450        /// Parameter `duration`: The duration of the animation, in seconds
451        #[unsafe(method(fadeOutWithDuration:))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn fadeOutWithDuration(duration: NSTimeInterval) -> Retained<SKAction>;
454
455        #[cfg(feature = "objc2-core-foundation")]
456        /// Creates an action that adjusts the alpha value of a node by a relative value
457        ///
458        /// Parameter `factor`: The amount to modify the node’s alpha value
459        ///
460        /// Parameter `duration`: The duration of the animation, in seconds
461        #[unsafe(method(fadeAlphaBy:duration:))]
462        #[unsafe(method_family = none)]
463        pub unsafe fn fadeAlphaBy_duration(
464            factor: CGFloat,
465            duration: NSTimeInterval,
466        ) -> Retained<SKAction>;
467
468        #[cfg(feature = "objc2-core-foundation")]
469        /// Creates an action that adjusts the alpha value of a node to a new value
470        ///
471        /// Parameter `alpha`: The new value of the node’s alpha
472        ///
473        /// Parameter `duration`: The duration of the animation, in seconds
474        #[unsafe(method(fadeAlphaTo:duration:))]
475        #[unsafe(method_family = none)]
476        pub unsafe fn fadeAlphaTo_duration(
477            alpha: CGFloat,
478            duration: NSTimeInterval,
479        ) -> Retained<SKAction>;
480
481        /// Creates an action that hides a node
482        #[unsafe(method(hide))]
483        #[unsafe(method_family = none)]
484        pub unsafe fn hide() -> Retained<SKAction>;
485
486        /// Creates an action that unhides a node
487        #[unsafe(method(unhide))]
488        #[unsafe(method_family = none)]
489        pub unsafe fn unhide() -> Retained<SKAction>;
490
491        #[cfg(feature = "SKTexture")]
492        /// Creates an action that changes a sprite’s texture
493        ///
494        /// Parameter `texture`: The new texture to use on the sprite
495        #[unsafe(method(setTexture:))]
496        #[unsafe(method_family = none)]
497        pub unsafe fn setTexture(texture: &SKTexture) -> Retained<SKAction>;
498
499        #[cfg(feature = "SKTexture")]
500        #[unsafe(method(setNormalTexture:))]
501        #[unsafe(method_family = none)]
502        pub unsafe fn setNormalTexture(texture: &SKTexture) -> Retained<SKAction>;
503
504        #[cfg(feature = "SKTexture")]
505        /// Creates an action that changes a sprite’s texture, possibly resizing the sprite
506        ///
507        /// Parameter `texture`: The new texture to use on the sprite
508        ///
509        /// Parameter `resize`: If YES, the sprite is resized to match the new texture.
510        /// If NO, the size of the sprite is unchanged.
511        #[unsafe(method(setTexture:resize:))]
512        #[unsafe(method_family = none)]
513        pub unsafe fn setTexture_resize(texture: &SKTexture, resize: bool) -> Retained<SKAction>;
514
515        #[cfg(feature = "SKTexture")]
516        #[unsafe(method(setNormalTexture:resize:))]
517        #[unsafe(method_family = none)]
518        pub unsafe fn setNormalTexture_resize(
519            texture: &SKTexture,
520            resize: bool,
521        ) -> Retained<SKAction>;
522
523        #[cfg(feature = "SKTexture")]
524        /// Creates an action that animates changes to a sprite’s texture
525        ///
526        /// Parameter `textures`: An array of textures to use when animating a sprite
527        ///
528        /// Parameter `sec`: The amount of time that each texture is displayed
529        #[unsafe(method(animateWithTextures:timePerFrame:))]
530        #[unsafe(method_family = none)]
531        pub unsafe fn animateWithTextures_timePerFrame(
532            textures: &NSArray<SKTexture>,
533            sec: NSTimeInterval,
534        ) -> Retained<SKAction>;
535
536        #[cfg(feature = "SKTexture")]
537        #[unsafe(method(animateWithNormalTextures:timePerFrame:))]
538        #[unsafe(method_family = none)]
539        pub unsafe fn animateWithNormalTextures_timePerFrame(
540            textures: &NSArray<SKTexture>,
541            sec: NSTimeInterval,
542        ) -> Retained<SKAction>;
543
544        #[cfg(feature = "SKTexture")]
545        /// Creates an action that animates changes to a sprite’s texture
546        ///
547        /// Parameter `textures`: An array of textures to use when animating a sprite
548        ///
549        /// Parameter `sec`: The amount of time that each texture is displayed
550        ///
551        /// Parameter `resize`: If YES, the sprite is resized to match each new texture.
552        /// If NO, the size of the sprite remains at a constant size.
553        ///
554        /// Parameter `restore`: If YES, When the action completes, the sprite’s texture is restored
555        /// to the texture it had before the action completed. (If the
556        /// resize parameter is YES, the sprite is resized to match the
557        /// size of the original texture.
558        /// If NO, when the action completes the sprite’s texture remains
559        /// set to the final texture in the array.
560        #[unsafe(method(animateWithTextures:timePerFrame:resize:restore:))]
561        #[unsafe(method_family = none)]
562        pub unsafe fn animateWithTextures_timePerFrame_resize_restore(
563            textures: &NSArray<SKTexture>,
564            sec: NSTimeInterval,
565            resize: bool,
566            restore: bool,
567        ) -> Retained<SKAction>;
568
569        #[cfg(feature = "SKTexture")]
570        #[unsafe(method(animateWithNormalTextures:timePerFrame:resize:restore:))]
571        #[unsafe(method_family = none)]
572        pub unsafe fn animateWithNormalTextures_timePerFrame_resize_restore(
573            textures: &NSArray<SKTexture>,
574            sec: NSTimeInterval,
575            resize: bool,
576            restore: bool,
577        ) -> Retained<SKAction>;
578
579        /// Creates an action that plays a sound
580        ///
581        /// Parameter `soundFile`: The name of a sound file in the app’s bundle
582        ///
583        /// Parameter `wait`: If YES, then the duration of this action is the same
584        /// as the length of the audio playback. If NO, the action is considered
585        /// to have completed immediately.
586        ///
587        ///
588        /// The file name must be the name or path of a file of a platform
589        /// supported audio file format. Use a LinearPCM format audio file with 8 or 16 bits
590        /// per channel for best performance
591        #[unsafe(method(playSoundFileNamed:waitForCompletion:))]
592        #[unsafe(method_family = none)]
593        pub unsafe fn playSoundFileNamed_waitForCompletion(
594            sound_file: &NSString,
595            wait: bool,
596        ) -> Retained<SKAction>;
597
598        #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
599        #[cfg(target_os = "macos")]
600        /// Creates an animation that animates a sprite’s color and blend factor
601        ///
602        /// Parameter `color`: The new color for the sprite
603        ///
604        /// Parameter `colorBlendFactor`: The new blend factor for the sprite
605        ///
606        /// Parameter `duration`: The duration of the animation, in seconds
607        #[unsafe(method(colorizeWithColor:colorBlendFactor:duration:))]
608        #[unsafe(method_family = none)]
609        pub unsafe fn colorizeWithColor_colorBlendFactor_duration(
610            color: &NSColor,
611            color_blend_factor: CGFloat,
612            duration: NSTimeInterval,
613        ) -> Retained<SKAction>;
614
615        #[cfg(feature = "objc2-core-foundation")]
616        #[unsafe(method(colorizeWithColorBlendFactor:duration:))]
617        #[unsafe(method_family = none)]
618        pub unsafe fn colorizeWithColorBlendFactor_duration(
619            color_blend_factor: CGFloat,
620            sec: NSTimeInterval,
621        ) -> Retained<SKAction>;
622
623        /// Creates an action that sets the falloff of a field
624        ///
625        /// Parameter `falloff`: The new value for falloff
626        ///
627        /// Parameter `duration`: The duration of the animation, in seconds
628        ///
629        /// See: SKFieldNode
630        #[unsafe(method(falloffTo:duration:))]
631        #[unsafe(method_family = none)]
632        pub unsafe fn falloffTo_duration(
633            falloff: c_float,
634            duration: NSTimeInterval,
635        ) -> Retained<SKAction>;
636
637        /// Creates an action that sets the falloff of a field
638        ///
639        /// Parameter `falloff`: The value to modify falloff by
640        ///
641        /// Parameter `duration`: The duration of the animation, in seconds
642        ///
643        /// See: SKFieldNode
644        #[unsafe(method(falloffBy:duration:))]
645        #[unsafe(method_family = none)]
646        pub unsafe fn falloffBy_duration(
647            falloff: c_float,
648            duration: NSTimeInterval,
649        ) -> Retained<SKAction>;
650
651        #[cfg(feature = "objc2-core-graphics")]
652        /// Creates an action that moves the node along a relative path, orienting the
653        /// node to the path
654        ///
655        ///
656        /// Parameter `path`: A Core Graphics path whose coordinates are relative to the node’s
657        /// current position
658        ///
659        /// Parameter `duration`: The duration of the animation, in seconds
660        #[unsafe(method(followPath:duration:))]
661        #[unsafe(method_family = none)]
662        pub unsafe fn followPath_duration(
663            path: &CGPath,
664            duration: NSTimeInterval,
665        ) -> Retained<SKAction>;
666
667        #[cfg(feature = "objc2-core-graphics")]
668        /// Creates an action that moves the node along a path
669        ///
670        ///
671        /// Parameter `path`: A Core Graphics path whose coordinates are relative to the node’s
672        /// current position
673        ///
674        /// Parameter `offset`: If YES, the points in the path are relative offsets to the
675        /// node’s starting position. If NO, the points in the node are absolute
676        /// coordinate values.
677        ///
678        /// Parameter `orient`: If YES, the node’s zRotation property animates so that
679        /// the node turns to follow the path. If NO, the zRotation property of
680        /// the node is unchanged.
681        ///
682        /// Parameter `duration`: The duration of the animation
683        #[unsafe(method(followPath:asOffset:orientToPath:duration:))]
684        #[unsafe(method_family = none)]
685        pub unsafe fn followPath_asOffset_orientToPath_duration(
686            path: &CGPath,
687            offset: bool,
688            orient: bool,
689            duration: NSTimeInterval,
690        ) -> Retained<SKAction>;
691
692        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
693        /// Creates an action that moves the node along a relative path, orienting the
694        /// node to the path
695        ///
696        ///
697        /// Parameter `path`: A Core Graphics path whose coordinates are relative to the node’s
698        /// current position
699        ///
700        /// Parameter `speed`: The speed in pixels per second to move along the path
701        #[unsafe(method(followPath:speed:))]
702        #[unsafe(method_family = none)]
703        pub unsafe fn followPath_speed(path: &CGPath, speed: CGFloat) -> Retained<SKAction>;
704
705        #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
706        #[unsafe(method(followPath:asOffset:orientToPath:speed:))]
707        #[unsafe(method_family = none)]
708        pub unsafe fn followPath_asOffset_orientToPath_speed(
709            path: &CGPath,
710            offset: bool,
711            orient: bool,
712            speed: CGFloat,
713        ) -> Retained<SKAction>;
714
715        #[cfg(feature = "objc2-core-foundation")]
716        /// Creates an action that changes how fast the node executes actions by a
717        /// relative value
718        ///
719        /// Parameter `speed`: amount to modify the speed by
720        ///
721        /// Parameter `duration`: The duration of the animation, in seconds
722        #[unsafe(method(speedBy:duration:))]
723        #[unsafe(method_family = none)]
724        pub unsafe fn speedBy_duration(
725            speed: CGFloat,
726            duration: NSTimeInterval,
727        ) -> Retained<SKAction>;
728
729        #[cfg(feature = "objc2-core-foundation")]
730        /// Creates an action that changes how fast the node executes actions
731        ///
732        /// Parameter `speed`: The new value for the node’s speed
733        ///
734        /// Parameter `duration`: The duration of the animation, in seconds
735        #[unsafe(method(speedTo:duration:))]
736        #[unsafe(method_family = none)]
737        pub unsafe fn speedTo_duration(
738            speed: CGFloat,
739            duration: NSTimeInterval,
740        ) -> Retained<SKAction>;
741
742        #[cfg(all(
743            feature = "SKNode",
744            feature = "objc2-app-kit",
745            feature = "objc2-core-foundation"
746        ))]
747        #[cfg(target_os = "macos")]
748        /// Creates an action that performs an inverse kinematic reach.
749        /// This action must be run on a descendent of the rootNode for animation to occur.
750        /// Running this action on the rootNode itself will not cause any animation to occur.
751        ///
752        /// Parameter `position`: The position (in screen space) to reach for
753        ///
754        /// Parameter `root`: Where to start the inverse kinematic operation from
755        ///
756        /// Parameter `duration`: The duration of the animation, in seconds
757        #[unsafe(method(reachTo:rootNode:duration:))]
758        #[unsafe(method_family = none)]
759        pub unsafe fn reachTo_rootNode_duration(
760            position: CGPoint,
761            root: &SKNode,
762            duration: NSTimeInterval,
763        ) -> Retained<SKAction>;
764
765        #[cfg(all(
766            feature = "SKNode",
767            feature = "objc2-app-kit",
768            feature = "objc2-core-foundation"
769        ))]
770        #[cfg(target_os = "macos")]
771        /// Creates an action that performs an inverse kinematic reach.
772        /// This action must be run on a descendent of the rootNode for animation to occur.
773        /// Running this action on the rootNode itself will not cause any animation to occur.
774        ///
775        /// Parameter `position`: The position (in screen space) to reach for
776        ///
777        /// Parameter `root`: Where to start the inverse kinematic operation from
778        ///
779        /// Parameter `velocity`: The speed in points per second of the end node in the chain
780        #[unsafe(method(reachTo:rootNode:velocity:))]
781        #[unsafe(method_family = none)]
782        pub unsafe fn reachTo_rootNode_velocity(
783            position: CGPoint,
784            root: &SKNode,
785            velocity: CGFloat,
786        ) -> Retained<SKAction>;
787
788        #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
789        #[cfg(target_os = "macos")]
790        /// Creates an action that performs an inverse kinematic reach.
791        /// This action must be run on a descendent of the rootNode for animation to occur.
792        /// Running this action on the rootNode itself will not cause any animation to occur.
793        ///
794        /// Parameter `node`: The node to reach for
795        ///
796        /// Parameter `root`: Where to start the inverse kinematic operation from
797        ///
798        /// Parameter `sec`: The duration of the animation, in seconds
799        #[unsafe(method(reachToNode:rootNode:duration:))]
800        #[unsafe(method_family = none)]
801        pub unsafe fn reachToNode_rootNode_duration(
802            node: &SKNode,
803            root: &SKNode,
804            sec: NSTimeInterval,
805        ) -> Retained<SKAction>;
806
807        #[cfg(all(
808            feature = "SKNode",
809            feature = "objc2-app-kit",
810            feature = "objc2-core-foundation"
811        ))]
812        #[cfg(target_os = "macos")]
813        /// Creates an action that performs an inverse kinematic reach.
814        /// This action must be run on a descendent of the rootNode for animation to occur.
815        /// Running this action on the rootNode itself will not cause any animation to occur.
816        ///
817        /// Parameter `node`: The node to reach for
818        ///
819        /// Parameter `root`: Where to start the inverse kinematic operation from
820        ///
821        /// Parameter `velocity`: The speed in points per second of the end node in the chain
822        #[unsafe(method(reachToNode:rootNode:velocity:))]
823        #[unsafe(method_family = none)]
824        pub unsafe fn reachToNode_rootNode_velocity(
825            node: &SKNode,
826            root: &SKNode,
827            velocity: CGFloat,
828        ) -> Retained<SKAction>;
829
830        /// Creates an action that sets the strength of a field
831        ///
832        /// Parameter `strength`: The new value for strength
833        ///
834        /// Parameter `duration`: The duration of the animation, in seconds
835        ///
836        /// See: SKFieldNode
837        #[unsafe(method(strengthTo:duration:))]
838        #[unsafe(method_family = none)]
839        pub unsafe fn strengthTo_duration(
840            strength: c_float,
841            duration: NSTimeInterval,
842        ) -> Retained<SKAction>;
843
844        /// Creates an action that sets the strength of a field
845        ///
846        /// Parameter `strength`: The value to modify strength by
847        ///
848        /// Parameter `duration`: The duration of the animation, in seconds
849        ///
850        /// See: SKFieldNode
851        #[unsafe(method(strengthBy:duration:))]
852        #[unsafe(method_family = none)]
853        pub unsafe fn strengthBy_duration(
854            strength: c_float,
855            duration: NSTimeInterval,
856        ) -> Retained<SKAction>;
857
858        /// Creates an action that idles for a specified period of time
859        ///
860        /// Parameter `duration`: The duration of the idle, in seconds
861        #[unsafe(method(waitForDuration:))]
862        #[unsafe(method_family = none)]
863        pub unsafe fn waitForDuration(duration: NSTimeInterval) -> Retained<SKAction>;
864
865        /// Creates an action that idles for a randomized period of time
866        ///
867        /// Parameter `duration`: The duration of the idle, in seconds
868        ///
869        /// Parameter `durationRange`: The range of possible values for the duration
870        #[unsafe(method(waitForDuration:withRange:))]
871        #[unsafe(method_family = none)]
872        pub unsafe fn waitForDuration_withRange(
873            duration: NSTimeInterval,
874            duration_range: NSTimeInterval,
875        ) -> Retained<SKAction>;
876
877        /// Creates an action that removes the node from its parent
878        #[unsafe(method(removeFromParent))]
879        #[unsafe(method_family = none)]
880        pub unsafe fn removeFromParent() -> Retained<SKAction>;
881
882        /// Creates an action that calls a method on an object
883        ///
884        /// Parameter `selector`: The selector of the method to call
885        ///
886        /// Parameter `target`: The target object
887        ///
888        /// # Safety
889        ///
890        /// - `selector` must be a valid selector.
891        /// - `target` should be of the correct type.
892        #[unsafe(method(performSelector:onTarget:))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn performSelector_onTarget(
895            selector: Sel,
896            target: &AnyObject,
897        ) -> Retained<SKAction>;
898
899        #[cfg(feature = "dispatch2")]
900        /// Creates an action that executes a block
901        ///
902        /// Parameter `block`: The block to run
903        ///
904        /// # Safety
905        ///
906        /// `block` must be a valid pointer.
907        #[unsafe(method(runBlock:))]
908        #[unsafe(method_family = none)]
909        pub unsafe fn runBlock(block: dispatch_block_t) -> Retained<SKAction>;
910
911        #[cfg(feature = "dispatch2")]
912        /// Creates an action that executes a block
913        ///
914        /// Parameter `block`: The block to run
915        ///
916        /// Parameter `queue`: The queue to perform the action on
917        ///
918        /// # Safety
919        ///
920        /// - `block` must be a valid pointer.
921        /// - `queue` possibly has additional threading requirements.
922        #[unsafe(method(runBlock:queue:))]
923        #[unsafe(method_family = none)]
924        pub unsafe fn runBlock_queue(
925            block: dispatch_block_t,
926            queue: &DispatchQueue,
927        ) -> Retained<SKAction>;
928
929        /// Creates an action that runs an action on a named child object
930        ///
931        /// Parameter `action`: the action to run
932        ///
933        /// Parameter `name`: the name of a child object
934        ///
935        /// See: SKNode.name
936        #[unsafe(method(runAction:onChildWithName:))]
937        #[unsafe(method_family = none)]
938        pub unsafe fn runAction_onChildWithName(
939            action: &SKAction,
940            name: &NSString,
941        ) -> Retained<SKAction>;
942
943        #[cfg(all(
944            feature = "SKNode",
945            feature = "block2",
946            feature = "objc2-app-kit",
947            feature = "objc2-core-foundation"
948        ))]
949        #[cfg(target_os = "macos")]
950        /// Creates an action that executes a block over a duration
951        ///
952        /// Parameter `duration`: The duration of the animation, in seconds
953        ///
954        /// Parameter `block`: The block to run. The block takes the following parameters:
955        /// node The node on which the action is running.
956        /// elapsedTime The amount of time that has passed in the animation.
957        #[unsafe(method(customActionWithDuration:actionBlock:))]
958        #[unsafe(method_family = none)]
959        pub unsafe fn customActionWithDuration_actionBlock(
960            duration: NSTimeInterval,
961            block: &block2::DynBlock<dyn Fn(NonNull<SKNode>, CGFloat)>,
962        ) -> Retained<SKAction>;
963
964        /// Creates an action of the given name from an action file.
965        ///
966        /// Parameter `name`: The name of the action
967        #[unsafe(method(actionNamed:))]
968        #[unsafe(method_family = none)]
969        pub unsafe fn actionNamed(name: &NSString) -> Option<Retained<SKAction>>;
970
971        /// Creates an action of the given name from an action file with a new duration.
972        ///
973        /// Parameter `name`: The name of the action
974        ///
975        /// Parameter `duration`: The duration of the action
976        #[unsafe(method(actionNamed:duration:))]
977        #[unsafe(method_family = none)]
978        pub unsafe fn actionNamed_duration(
979            name: &NSString,
980            duration: NSTimeInterval,
981        ) -> Option<Retained<SKAction>>;
982
983        /// Creates an action of the given name from an action file.
984        ///
985        /// Parameter `name`: The name of the action
986        ///
987        /// Parameter `url`: The url of the file containing the action
988        #[unsafe(method(actionNamed:fromURL:))]
989        #[unsafe(method_family = none)]
990        pub unsafe fn actionNamed_fromURL(
991            name: &NSString,
992            url: &NSURL,
993        ) -> Option<Retained<SKAction>>;
994
995        /// Creates an action of the given name from an action file with a new duration.
996        ///
997        /// Parameter `name`: The name of the action
998        ///
999        /// Parameter `url`: The url of the file containing the action
1000        ///
1001        /// Parameter `duration`: The duration of the action
1002        #[unsafe(method(actionNamed:fromURL:duration:))]
1003        #[unsafe(method_family = none)]
1004        pub unsafe fn actionNamed_fromURL_duration(
1005            name: &NSString,
1006            url: &NSURL,
1007            duration: NSTimeInterval,
1008        ) -> Option<Retained<SKAction>>;
1009    );
1010}
1011
1012/// NodeWithPhysicsBody.
1013impl SKAction {
1014    extern_methods!(
1015        #[unsafe(method(changeChargeTo:duration:))]
1016        #[unsafe(method_family = none)]
1017        pub unsafe fn changeChargeTo_duration(
1018            v: c_float,
1019            duration: NSTimeInterval,
1020        ) -> Retained<SKAction>;
1021
1022        #[unsafe(method(changeChargeBy:duration:))]
1023        #[unsafe(method_family = none)]
1024        pub unsafe fn changeChargeBy_duration(
1025            v: c_float,
1026            duration: NSTimeInterval,
1027        ) -> Retained<SKAction>;
1028
1029        #[unsafe(method(changeMassTo:duration:))]
1030        #[unsafe(method_family = none)]
1031        pub unsafe fn changeMassTo_duration(
1032            v: c_float,
1033            duration: NSTimeInterval,
1034        ) -> Retained<SKAction>;
1035
1036        #[unsafe(method(changeMassBy:duration:))]
1037        #[unsafe(method_family = none)]
1038        pub unsafe fn changeMassBy_duration(
1039            v: c_float,
1040            duration: NSTimeInterval,
1041        ) -> Retained<SKAction>;
1042
1043        #[cfg(feature = "objc2-core-foundation")]
1044        #[unsafe(method(applyForce:duration:))]
1045        #[unsafe(method_family = none)]
1046        pub unsafe fn applyForce_duration(
1047            force: CGVector,
1048            duration: NSTimeInterval,
1049        ) -> Retained<SKAction>;
1050
1051        #[cfg(feature = "objc2-core-foundation")]
1052        #[unsafe(method(applyForce:atPoint:duration:))]
1053        #[unsafe(method_family = none)]
1054        pub unsafe fn applyForce_atPoint_duration(
1055            force: CGVector,
1056            point: CGPoint,
1057            duration: NSTimeInterval,
1058        ) -> Retained<SKAction>;
1059
1060        #[cfg(feature = "objc2-core-foundation")]
1061        #[unsafe(method(applyTorque:duration:))]
1062        #[unsafe(method_family = none)]
1063        pub unsafe fn applyTorque_duration(
1064            torque: CGFloat,
1065            duration: NSTimeInterval,
1066        ) -> Retained<SKAction>;
1067
1068        #[cfg(feature = "objc2-core-foundation")]
1069        #[unsafe(method(applyImpulse:duration:))]
1070        #[unsafe(method_family = none)]
1071        pub unsafe fn applyImpulse_duration(
1072            impulse: CGVector,
1073            duration: NSTimeInterval,
1074        ) -> Retained<SKAction>;
1075
1076        #[cfg(feature = "objc2-core-foundation")]
1077        #[unsafe(method(applyImpulse:atPoint:duration:))]
1078        #[unsafe(method_family = none)]
1079        pub unsafe fn applyImpulse_atPoint_duration(
1080            impulse: CGVector,
1081            point: CGPoint,
1082            duration: NSTimeInterval,
1083        ) -> Retained<SKAction>;
1084
1085        #[cfg(feature = "objc2-core-foundation")]
1086        #[unsafe(method(applyAngularImpulse:duration:))]
1087        #[unsafe(method_family = none)]
1088        pub unsafe fn applyAngularImpulse_duration(
1089            impulse: CGFloat,
1090            duration: NSTimeInterval,
1091        ) -> Retained<SKAction>;
1092    );
1093}
1094
1095/// PlaybackControl.
1096impl SKAction {
1097    extern_methods!(
1098        #[unsafe(method(play))]
1099        #[unsafe(method_family = none)]
1100        pub unsafe fn play() -> Retained<SKAction>;
1101
1102        #[unsafe(method(pause))]
1103        #[unsafe(method_family = none)]
1104        pub unsafe fn pause() -> Retained<SKAction>;
1105
1106        #[unsafe(method(stop))]
1107        #[unsafe(method_family = none)]
1108        pub unsafe fn stop() -> Retained<SKAction>;
1109
1110        #[unsafe(method(changePlaybackRateTo:duration:))]
1111        #[unsafe(method_family = none)]
1112        pub unsafe fn changePlaybackRateTo_duration(
1113            v: c_float,
1114            duration: NSTimeInterval,
1115        ) -> Retained<SKAction>;
1116
1117        #[unsafe(method(changePlaybackRateBy:duration:))]
1118        #[unsafe(method_family = none)]
1119        pub unsafe fn changePlaybackRateBy_duration(
1120            v: c_float,
1121            duration: NSTimeInterval,
1122        ) -> Retained<SKAction>;
1123    );
1124}
1125
1126/// MixerControl.
1127impl SKAction {
1128    extern_methods!(
1129        #[unsafe(method(changeVolumeTo:duration:))]
1130        #[unsafe(method_family = none)]
1131        pub unsafe fn changeVolumeTo_duration(
1132            v: c_float,
1133            duration: NSTimeInterval,
1134        ) -> Retained<SKAction>;
1135
1136        #[unsafe(method(changeVolumeBy:duration:))]
1137        #[unsafe(method_family = none)]
1138        pub unsafe fn changeVolumeBy_duration(
1139            v: c_float,
1140            duration: NSTimeInterval,
1141        ) -> Retained<SKAction>;
1142    );
1143}