-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Like animation #80
Like animation #80
Changes from all commits
6da8016
43ab433
76bdcdf
2e47221
8b061eb
f541396
8731210
06d0a47
8b91956
4fb472a
a452e7d
b6428db
4b6754b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,28 +10,27 @@ import UIKit | |
import DSKit | ||
|
||
final class DummyFooterView: UICollectionReusableView { | ||
private let backgroundGradientLayer = CAGradientLayer() | ||
private let borderGradientLayer = CAGradientLayer() | ||
private let maskLayer = CAShapeLayer() | ||
|
||
private lazy var cardTimeView = CardTimeView() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: .zero) | ||
|
||
configureUI() | ||
layer.cornerRadius = 20 | ||
clipsToBounds = true | ||
|
||
makeUI() | ||
setupLayers() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
override func layoutSubviews() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bounds가 설정된 다음에 layer의 frame을 할당하도록 수정했습니다. |
||
layoutGradientLayers() | ||
} | ||
|
||
private func configureUI() { | ||
layer.borderWidth = 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. layer를 추가하는 것이다보니 borderWidth가 추가적으로 설정되는 문제가 있어 삭제했습니다. |
||
layer.cornerRadius = 20 | ||
clipsToBounds = true | ||
// backgroundColor = .blue | ||
// layer.borderColor = UIColor.orange.cgColor | ||
|
||
addGradientBackground() | ||
addGradientBorder() | ||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private func makeUI() { | ||
|
@@ -43,51 +42,39 @@ final class DummyFooterView: UICollectionReusableView { | |
} | ||
} | ||
|
||
private func addGradientBackground() { | ||
let gradientLayer = CAGradientLayer() | ||
gradientLayer.frame = bounds | ||
|
||
gradientLayer.colors = [ | ||
DSKitAsset.Color.DummyUserGradient.backgroundFirst.color, | ||
DSKitAsset.Color.DummyUserGradient.backgroundSecond.color, | ||
DSKitAsset.Color.DummyUserGradient.backgroundFirst.color | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cgColor가 아니면 색상이 적용되지 않는 문제가 있었습니다.. |
||
private func setupLayers() { | ||
backgroundGradientLayer.colors = [ | ||
DSKitAsset.Color.DummyUserGradient.backgroundFirst.color.cgColor, | ||
DSKitAsset.Color.DummyUserGradient.backgroundSecond.color.cgColor, | ||
DSKitAsset.Color.DummyUserGradient.backgroundFirst.color.cgColor | ||
] | ||
|
||
gradientLayer.locations = [0.0, 0.5, 1.0] | ||
|
||
gradientLayer.startPoint = CGPoint(x: 0.5, y: 1.0) | ||
gradientLayer.endPoint = CGPoint(x: 0.5, y: 0.0) | ||
backgroundGradientLayer.locations = [0.0, 0.5, 1.0] | ||
|
||
// layer.addSublayer(gradientLayer) | ||
backgroundGradientLayer.startPoint = CGPoint(x: 0.5, y: 1.0) | ||
backgroundGradientLayer.endPoint = CGPoint(x: 0.5, y: 0.0) | ||
layer.addSublayer(backgroundGradientLayer) | ||
|
||
layer.insertSublayer(gradientLayer, at: 0) | ||
borderGradientLayer.colors = [ | ||
DSKitAsset.Color.DummyUserGradient.borderFirst.color.cgColor, | ||
DSKitAsset.Color.DummyUserGradient.borderSecond.color.cgColor | ||
] | ||
|
||
borderGradientLayer.startPoint = CGPoint(x: 0.5, y: 1.0) | ||
borderGradientLayer.endPoint = CGPoint(x: 0.5, y: 0.0) | ||
borderGradientLayer.mask = maskLayer | ||
layer.addSublayer(borderGradientLayer) | ||
} | ||
|
||
private func addGradientBorder() { | ||
let gradientLayer = CAGradientLayer() | ||
gradientLayer.frame = bounds | ||
|
||
gradientLayer.colors = [ | ||
DSKitAsset.Color.DummyUserGradient.borderFirst.color, | ||
DSKitAsset.Color.DummyUserGradient.borderSecond.color | ||
] | ||
|
||
// gradientLayer.locations = [0.0, 0.5, 1.0] | ||
private func layoutGradientLayers() { | ||
backgroundGradientLayer.frame = bounds | ||
borderGradientLayer.frame = bounds | ||
|
||
gradientLayer.startPoint = CGPoint(x: 0.5, y: 1.0) | ||
gradientLayer.endPoint = CGPoint(x: 0.5, y: 0.0) | ||
|
||
let shapeLayer = CAShapeLayer() | ||
let path = UIBezierPath(roundedRect: bounds, cornerRadius: layer.cornerRadius) | ||
shapeLayer.path = path.cgPath | ||
shapeLayer.lineWidth = 1 | ||
shapeLayer.fillColor = DSKitAsset.Color.LikeGradient.gradientFirst.color.cgColor | ||
shapeLayer.strokeColor = DSKitAsset.Color.LikeGradient.gradientFirst.color.cgColor | ||
|
||
gradientLayer.mask = shapeLayer | ||
|
||
// layer.addSublayer(gradientLayer) | ||
|
||
layer.insertSublayer(gradientLayer, at: 0) | ||
|
||
maskLayer.path = path.cgPath | ||
maskLayer.lineWidth = 1 | ||
maskLayer.fillColor = UIColor.clear.cgColor | ||
maskLayer.strokeColor = UIColor.orange.cgColor | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유저 좋아요, 싫어요 최근 이벤트 후, 5초 딜레이 시켰습니다.