I was trying to use iCarousel for one my solutions, I need to achieve something like the image below
It should be exactly the way
iCarouselOptionFadeMin
iCarouselOptionFadeMax
iCarouselOptionFadeRange
iCarouselOptionFadeMinAlpha
works using
- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value
I tried to create a function exactly like
- (CGFloat)alphaForItemWithOffset:(CGFloat)offset
I discovered that it cane be done using offset
values, but things are not working me, can any one can help me achieving this?
Thanks.
I do not have enough reputation to comment so i have to ask a further question as a reply :(
@burax is it possible to layout items on linear line instead of a hyperbola but keep the resizing?
Regards, and sorry for asking like this
Edit : with random tries i achieved with this :
there is probably a better way but i am new to transformations :)
A little modified and in SWIFT to copy paste ;) - works perfekt for me
You can do this via the
iCarousel
'siCarouselTypeCustom
type in the delegate methodJust set the type of the carousel (e.g. in
viewDidLoad
of the carousel's view controller):And calculate the transform as you like. I've laid the objects on a hyperbola, and shrink them in addition a bit as they move away from the center. That quite resembles your image, I think:
and the result:
you can adjust the float constants to your liking.
For moving items around a circle while scaling them just use goniometric functions for translation, then rotate and scale:
and again, the result:
you can adjust the spacing and the radius in the
carousel:valueForOption:withDefault:
method.Enjoy! :)