You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: SpringAnimation/Sources/SpringAnimation/SpringAnimation.swift
+10-67
Original file line number
Diff line number
Diff line change
@@ -1,66 +1,18 @@
1
1
import UIKit
2
2
3
-
4
-
/// Animation options
5
-
publicprotocolSpringable:AnyObject{
6
-
// Animation properties
7
-
/// Automatic animation start
8
-
varautostart:Bool{getset}
9
-
/// Hides the view
10
-
varautohide:Bool{getset}
11
-
/// Animation name
12
-
varanimation:String{getset}
13
-
/// The of animation
14
-
varforce:CGFloat{getset}
15
-
/// The delay (in seconds) after which the animations begin.
16
-
///
17
-
/// The default value of this property is 0. When the value is greater than 0, the start of any animations is delayed by the specified amount of time.
18
-
vardelay:CGFloat{getset}
19
-
/// The total duration of the animations, measured in seconds. If you specify a negative value or 0, the changes are made without animating them.
20
-
varduration:CGFloat{getset}
21
-
/// Defines how the spring’s motion should be damped due to the forces of friction.
22
-
vardamping:CGFloat{getset}
23
-
/// The initial velocity of the object attached to the spring.
24
-
varvelocity:CGFloat{getset}
25
-
/// Determines the number of times the animation will repeat.
26
-
varrepeatCount:Float{getset}
27
-
/// The x-coordinate of the point.
28
-
varx:CGFloat{getset}
29
-
/// The y-coordinate of the point.
30
-
vary:CGFloat{getset}
31
-
/// A value function scales by the input value along the x-axis. Animations referencing this value transform function must provide a single animation value.
32
-
varscaleX:CGFloat{getset}
33
-
/// A value function scales by the input value along the y-axis. Animations referencing this value function must provide a single animation value.
34
-
varscaleY:CGFloat{getset}
35
-
/// Object rotation
36
-
varrotate:CGFloat{getset}
37
-
///The opacity of the receiver. Animatable.
38
-
///
39
-
///The value of this property must be in the range 0.0 (transparent) to 1.0 (opaque). Values outside that range are clamped to the minimum or maximum. The default value of this property is 1.0.
40
-
varopacity:CGFloat{getset}
41
-
varanimateFrom:Bool{getset}
42
-
/// Animation preset
43
-
varcurve:String{getset}
44
-
45
-
// UIView
46
-
varlayer:CALayer{get}
47
-
vartransform:CGAffineTransform{getset}
48
-
varalpha:CGFloat{getset}
49
-
50
-
/// Run the animation with the given parameters
51
-
func animate()
52
-
/// Run next animation after complete current animation
53
-
func animateNext(completion:@escaping()->Void)
54
-
}
55
-
56
3
publicfinalclassSpringAnimation{
57
4
private unowned varview:Springable
58
5
privatevarshouldAnimateAfterActive=false
59
6
privatevarshouldAnimateInLayoutSubviews=true
60
7
61
8
init(view:Springable){
62
9
self.view = view
63
-
commonInit()
10
+
NotificationCenter.default.addObserver(
11
+
self,
12
+
selector: #selector(didBecomeActiveNotification),
13
+
name:UIApplication.didBecomeActiveNotification,
14
+
object:nil
15
+
)
64
16
}
65
17
66
18
publicfunc customAwakeFromNib(){
@@ -86,7 +38,7 @@ public final class SpringAnimation {
0 commit comments