Comments (5)
I can answer your first question, the mirror view isn't created programmatically, it's part of the image itself. For example, you can use https://github.com/nicklockwood/ReflectionView to create the mirror view.
from icarousel.
Hi Lexar,
- The mirror effect in the example is just part of the image I used in the example (don't worry, you're not the first to ask).
I do have another library called ReflectionView that you can use to do the same effect automatically though. Just use it as the base for your carousel item views.
- It should be pretty easy to implement this. Use the custom transition delegate method, as shown in the example for creating the "slip 3d" transition. Basically the method returns a CATransform3D that specifies how each view should be positioned relative to its offset from the center of the carousel. You can see how the standard transforms are done by looking at the transform code in iCarousel.m.
For the linear carousel, I just multiply the offset by the item width. What you probably want to do is take that and then scale it using CATransformScale with a scale factor proportional to the number of items in the carousel, that way the items will get smaller as the number of items increases.
Have a go at doing it yourself, if you really can't figure it out then I'll try to help some more.
Nick
On 20 Oct 2011, at 18:55, lexar wrote:
Hello,
first of all, amazing work! I was able to use the carousel immediately. Thank you!
I have 2 questions:
- I studied the example app, but I didn't understand how the mirror view at the bottom is done? My implementation doesn't show one.
- I would like to have a mixture of a linear and rotary custom carousel: The items should grow and shrink in size as in the rotary mode, but navigation should stop i.e at the first item and should not show the last item behind that, so the items should be lined up from left to right.
Could I get some hints where to start on this, I admit I am pretty illiterate with quartz.Again, thank you for this great work.
lx
Reply to this email directly or view it on GitHub:
#50
from icarousel.
Thanks, murdoch - aah, it's in the image! Didn't see that at first with the grey Xcode background. Thanks for the pointer to ReflectionView!
from icarousel.
Hello Nick,
thank you for your help. I modified iCarousel with a new type "iCarouselTypeLinear2" which I implemented like this in transformForItemView:withOffset:
case iCarouselTypeLinear2:
{
NSInteger count = MIN(numberOfVisibleItems, numberOfItems + (shouldWrap? 0: numberOfPlaceholdersToShow));
CGFloat arc = M_PI * 2.0f;
CGFloat radius = itemWidth / 2.0f / tanf(arc/2.0f/count);
CGFloat angle = offset / count * arc;
CATransform3D newTransform = CATransform3DTranslate(transform, radius * sin(angle), 0.0f, radius * cos(angle) - radius);
return CATransform3DTranslate(newTransform, offset * itemWidth, 10.0f, 10.0f);
}
This gives me the desired result when returning 200 from carouselItemWidth: , but if I decrease that float the animation gets weird. This is of course because I don't really know what I'm doing.
I can live with this solution, but perhaps someone has a better suggestion or could point me to documentation which makes me better understand what CATransform does.
Anyway, thank you both for your help.
from icarousel.
Hello all,
my custom carousel solution has come back haunting me. There is a brief twitching/stuttering visible when two imageviews have the same size within the carousel. I am pretty sure my CATransform above is not the best way to do this. Could anyone give me advice how to best achieve the same result?
Thanks, l
from icarousel.
Related Issues (20)
- ICarousel Accessibility Inspector return incorrect UI element location for Mac
- constraints attribute? for optimizing for device size?
- Crash report from Fabric
- Carousel like glidejs.com
- An unwanted view is displaying first time when we scroll slowly as a background shadow
- How to install
- Can you expose the previousItemIndex
- Spacing between items HOT 1
- Swift Package Manager Support
- On UIButtonClicked Change UIView at particular indexpath in iCarousel
- iCarouselTypeRotary type number of visual images invalid setting
- iCarouselTypeRotary type number of visual images setting invalid
- Carousel inside reusable UITableViewCell, carousel views shuffled
- iOS 13 deprecate in iCarousel.m new warnings due to use of old animation method
- tvos icarousel
- On apps running on Mac OS with Catalyst to move between different item you can't use trackpad gesture but need to press and drag HOT 1
- Delegate and Datasource should be weak? HOT 1
- Cycling custom type animation
- Swift Package Manager support issue
- Scrollable carousel view accessibility Id is not working.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icarousel.