Skip to content

Commit 8383a82

Browse files
# Conflicts: # README.md
2 parents d8c0dcf + 0fdf6ea commit 8383a82

1 file changed

Lines changed: 68 additions & 43 deletions

File tree

README.md

Lines changed: 68 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# ButtonClickStyle
22

3-
![image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/all_ipad_random.gif)
3+
![image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/preview_10sec33fps.gif)
4+
5+
This is a view button
46

5-
This is a layer button
67
Has 9 styles of animated click
78

89
Inside the layer you can style your button, create your own subviews
910

10-
+ You can expand the project
11-
adding new click-animation-styles
11+
You can expand the project adding new click-animation-styles
1212

1313
## Requirements
1414

@@ -28,66 +28,91 @@ Inside the layer you can style your button, create your own subviews
2828

2929
3) In Attributes Inspector of Interface Builder
3030
you can immediately select the button click `animationType`
31-
```ruby
32-
#type #name
33-
34-
hide .alpha
35-
hide .flash
36-
add .shadow
37-
add .shadow color
38-
add .color
39-
add .color flat (border text)
40-
move .pulsate new
41-
move .pulsate
42-
move .press
43-
move .shake new
44-
move .shake
45-
add .androidClickable dark
46-
add .androidClickable ligt
31+
32+
33+
![image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/click_styles_example_2x_10sec33fps.gif)
34+
35+
```swift
36+
extension ButtonClick {
37+
enum Style {
38+
case alpha
39+
case flash
40+
case shadow
41+
case shadowColor
42+
case color
43+
case colorFlat
44+
case pulsateNew
45+
case pulsate
46+
case press
47+
case shake
48+
case shakeNew
49+
case androidClickable
50+
case androidClickableDark
51+
}
52+
}
4753
```
4854

49-
4) Так же вы можете выбрать анимировать все слои `allSubviews` / или только 1
55+
4) Also you can select specific layers to animate / or just 1 specific one `allSubviews`
5056

5157

52-
5) Добавить + animation.Duration - время анимации
58+
5) Add animation duration `animationDuration`
5359

54-
6) Добавить + animation.Value - под значением имеется ввиду
55-
у анимации тип
56-
- "Hide .Alpha/Flash/Shadow/Color" будет меняться альфа от 0.0 до 1.0
57-
- "Move .Pulsate/Press/Shake" будет движения усиливаться уменьшаться от 0.0 до 1.0
58-
- "Add .AndroidClickable" будет увелмчиваться радиус пузырей
60+
6) Add animation value `animationTypeValue` - meaning means
61+
- "Hide .Alpha/Flash/Shadow/Color" - will change alpha from 0.0 to 1.0
62+
- "Move .Pulsate/Press/Shake" - will increase movement decrease from 0.0 to 1.0
63+
- "Add .AndroidClickable" - will increase bubble radius
5964

6065

6166
```swift
6267
@IBInspectable var allSubviews: Bool = true
63-
@IBInspectable var animationType: Int =
68+
@IBInspectable var animationType: Int = 0
6469
@IBInspectable var animationValue: CGFloat = 0.0
6570
@IBInspectable var animationDuration: CGFloat = 0.0
6671

6772
var addViews: [UIView]?
68-
6973
```
70-
7) Если иниализацируйие программно
71-
- Есть свойство `addViews` - позволяет передать вьшки/слои
72-
которые вы точно захотите задейстовать в анимации нажатия only
7374

75+
<!-- ![image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/ui3.gif) -->
7476

75-
```swift
76-
let btnView = ButtonClickStyleView(
77-
frame: @frame,
78-
animation: @type,
79-
value: @value,
80-
addViews: @views,
81-
)
82-
btnView.insertSubview(self.view, at: 0)
83-
btnView.updateSubviews()
77+
7) If initializing programmatically
78+
There is a property `addViews` - allows you to pass views / layers
79+
which you definitely want to use in the click animation only
80+
81+
8) Or initialize through a struct `ButtonClick.State`
8482

83+
```swift
84+
extension ButtonClick {
85+
struct State: Equatable {
86+
var titleText: String?
87+
var allSubviews: Bool = true
88+
var animationType: Int?
89+
var animationTypeValue: CGFloat?
90+
var animationDuration: CGFloat?
91+
var new: Bool = false
92+
var color: UIColor?
93+
var startClick: Bool = false
94+
var addBackgrondColor: Bool = true
95+
}
96+
}
8597
```
8698

87-
99+
![image](https://github.com/mrustaa/GifPresentations/blob/master/ButtonClickStyle/ui3.gif)
88100

89-
## Credits
101+
```swift
102+
@IBOutlet var mainView: UIView!
103+
104+
var views: [UIView]? = [mainView]
105+
let frame: CGRect = .init(x: 23 , y: 22, width: 156, height: 48)
106+
let viewAn = ButtonClickStyleView(
107+
state: state,
108+
frame: frame,
109+
radius: 20,
110+
addViews: views
111+
)
112+
btnView.insertSubview(mainView, at: 0)
113+
btnView.updateSubviews()
90114

115+
```
91116

92117
## License
93118

0 commit comments

Comments
 (0)