GithubHelp home page GithubHelp logo

Comments (5)

robderijk avatar robderijk commented on May 28, 2024

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.

nicklockwood avatar nicklockwood commented on May 28, 2024

Hi Lexar,

  1. 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.

  1. 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:

  1. 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.
  2. 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.

lexar avatar lexar commented on May 28, 2024

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.

lexar avatar lexar commented on May 28, 2024

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.

lexar avatar lexar commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.