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

Cycling custom type animation #905

Open
maukur opened this issue Jul 5, 2022 · 0 comments
Open

Cycling custom type animation #905

maukur opened this issue Jul 5, 2022 · 0 comments

Comments

@maukur
Copy link

maukur commented Jul 5, 2022

Does anyone know how I can cycle custom type?

Layout my view looks like this:

image

I use a custom type from here:
Link


func carousel(_ carousel: iCarousel, itemTransformForOffset offset: CGFloat, baseTransform transform: CATransform3D) -> CATransform3D {
            let centerItemZoom: CGFloat = 1.329
            let centerItemSpacing: CGFloat = 1.41
        
            let spacing: CGFloat = 0.87
            let absClampedOffset = min(1.0, abs(offset))
            let clampedOffset = min(1.0, max(-1.0, offset))
            let scaleFactor = 1.0 + absClampedOffset * (1.0/centerItemZoom - 1.0)
            let offset = (scaleFactor * offset + scaleFactor * (centerItemSpacing - 1.0) * clampedOffset) * carousel.itemWidth * spacing
            var transform = CATransform3DTranslate(transform, offset, 0.0, -absClampedOffset)
            transform = CATransform3DScale(transform, scaleFactor, scaleFactor, 1.0)
            transform = CATransform3DTranslate(transform, 0, 11, 0)
            return transform
        }
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