Skip to content
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

I want change scale center to left , but some problem. #4

Closed
susuyan opened this issue Jul 14, 2019 · 0 comments
Closed

I want change scale center to left , but some problem. #4

susuyan opened this issue Jul 14, 2019 · 0 comments

Comments

@susuyan
Copy link

susuyan commented Jul 14, 2019

Simulator Screen Shot - iPhone 8 - 2019-07-13 at 11 03 58

private func configureAttributes(for attributes: UICollectionViewLayoutAttributes) {
    guard let collection = collectionView else { return }
    var visibleRect = CGRect()
    visibleRect.origin = collection.contentOffset
    visibleRect.size = collection.bounds.size
    let collectionLeft =  itemSize.width / 2
    let offset = collection.contentOffset.x
    let normalizedLeft =  attributes.center.x  - offset

    let maxDistance =  self.itemSize.width
    let distance = min(abs(collectionLeft - normalizedLeft), maxDistance)
    let ratio = (maxDistance - distance)/maxDistance
    let scale = ratio * (1 - sideItemScale) + sideItemScale

    var t = CATransform3DIdentity
    t = CATransform3DScale(t,  scale, scale, 1.0)
    attributes.zIndex = Int(scale * 10)
    attributes.transform3D = t
    //  change item space,  

}
@susuyan susuyan closed this as completed Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant