Jump to content
Search Community

monospace

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by monospace

  1. No, no, your code was clean and concise, and making those changes was easy. 
    What I was trying to do was come up with a way to make those settings configurable, so that by passing a variable to the function, something along the lines of initCarousel('leftright'), or initCarousel('downup') , I would be able to re-use this without having to re-write it.
    Again, easy enough, but that would have made the code longer again, and before you know it I might have ended up with something along the lines of your Helper Function: all good and fine, but it would have defeated my goal of having a small, clean snippet of code with a single purpose. 

    So rather than making this configurable, if I ever need a version of this that moves, say, left-right, or up-down, I'll just modify it as needed and use it that way. 

  2. 1 hour ago, monospace said:

    Now trying to figure out how to reverse direction with just one variable. 🤔

    Okay, yeah, after messing with this a bit: wrong approach. It's easy enough to change orientation and direction, but to make it configurable requires a lot more code. Far more efficient for my purposes is to just modify the code as needed and then drop it in.

     

  3. Yes, thanks, I had already found that helper function you prepared and it's a very good solution for a full-featured carousel. But sometimes what's required is just a quick "effect" style animation of a bunch of simple elements, not a full fledged application. 

    Thanks again for your examples, I'm in awe of their elegance.

    Now trying to figure out how to reverse direction with just one variable. 🤔

  4. 12 hours ago, GreenSock said:

    Are you saying that the very first element should be part of the first iteration/loop, but then you never see that one element again (but you do see all the others in a never-ending loop)? 

     

    Also, when you say "cleanest, leanest carousels" do you mean "smallest amount of code (even if it requires 30% more CPU)" or "most performant"? I always lean toward solutions that perform better even if it requires 50% more code, but if you just want the smallest amount of code that's important to know. 

     

    I want to avoid duplicating the first or the last item, because that would mess with screen readers. I would also like to avoid having to do any specific prep work on the items themselves, that is, I want to be able to use them as provided (be they images, divs, whatever) without having to modify them in any way.

    And by lean and clean I mean code that has the least amount of bells and whistles (no sliders, pause or reverse buttons, etc), and is easy to comprehend and modify (i.e. change x-axis to y-axis, maybe add a fade or a scale or a bounce or something.) Ideally of course it wouldn't bring down a user's computer, but I don't think that's much of an issue in this day and age. I don't mind a few extra lines of code to accomplish that. 

    All that said, thanks for those very interesting examples. I'm going to have to spend some time tinkering with those.

  5. Apologies for starting yet another "carousel" related topic, but I was hoping some of the brilliant minds here could help me out. 

    Is there a way to use GSAP to create an infinite looping "carousel" style animation that doesn't repeat the first element in the list, like this embedded CodePen? Mind you: I'm not looking for fancy controls to start or stop or reverse anything, just a simple, clean way to loop a bunch of items that also makes sense in a screen reader type of environment—no repetitions of items in the source code.

     

    See the Pen LYLOdPa by monospace (@monospace) on CodePen

  6. Wow, thanks for the speedy response. And thanks for the elegant re-working. Lots of things to pick apart for me there.
    Returning a fromTo() tween out of a function? Whoa.
    Am I right in assuming that xPercent and yPercent let you set the origin of a sprite/div? Nifty!
    And built-in shortcuts for randomization? 
    So much to learn!

    • Like 2
  7. Hey everyone, first time poster here. I'm building an animation of a "bubble" background. The idea is that bubbles are rising to the top of the container, and once out of view get repositioned below the bottom edge of said container. So far, so good, have a look at my CodePen. Problem is that the bubbles/sprites get repositioned smack inside the middle of the container, creating a "popping" effect that I do not want. I know that setting x and y in GSAP is using relative values, but the number I'm using to reposition the sprites is high enough that they should get reset out of view. Any ideas? 

    See the Pen xxrXEOg by monospace (@monospace) on CodePen

×
×
  • Create New...