Skip to content
This repository was archived by the owner on Sep 14, 2026. It is now read-only.
This repository was archived by the owner on Sep 14, 2026. It is now read-only.

Cycling custom type animation  #905

Open

Description

@maukur

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
        }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions