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