Jump to content
Search Community

creativeocean last won the day on June 26 2013

creativeocean had the most liked content!

creativeocean

Business
  • Posts

    52
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by creativeocean

  1. Jack's code is exactly what I was looking for today.

     

    One small additional thing that may help someone in a similar spot, I had other scrollTriggers further down the page that were impacted when the pin-spacer was removed. I added ScrollTrigger.refresh() at the end of the onLeave function to make it all work as expected.

     

    The more I use scrollTrigger the more I appreciate the immense amount of thought and effort that went into its development. Huge thanks Jack and everyone at GSAP :)

    • Like 1
    • Thanks 1
  2. Hey Carl. Thanks for the reply. ScrollTrigger's invalidateOnRefresh has the same effect as if you call invalidate() on the timeline (though it doesn't work if you do both). Since I needed to put the updated x calculation in the onRefresh function, I thought it read easier this way.

     

    PS, I swear I didn't mean to @ you for such a fast reply!  Thanks so much for your time + thoughts on this!! :)

     

  3. @Carl your video explaining invalidate() was SUPER helpful! Thanks a bunch for walking it through so clearly.

    I'm currently working on a ScrollTrigger animation that requires recalculating x position on resize and found invalidate() works as expected while the timeline's progress is 0. However, things break when scroll position puts the timeline's progress past 0. Below is a pen to demonstrate. Try resizing the width while above the scrollTrigger's start, and then try resizing somewhere after the start position. Any suggestions on how to handle this?

     

    See the Pen c2d6de92e189404436590c055a3c7a4f by creativeocean (@creativeocean) on CodePen

    • Like 1
  4. Wow I'm late -just seeing this thread now :)

    I 100% agree, one shouldn't rely on IDs to become global vars in any actual project. That said, it's a cheap shortcut for making concise demos.

     

    If you really wanted that behavior (I've worked for a few agencies that do this), you could loop over all the elements with an ID and make them global vars, like so:
     

    [].forEach.call(document.querySelectorAll('*'), function(el){ if (el.id) window[el.id] = el; }); // IDs to vars

    However, for future readers/editors of the code, it's kind of nice to see clearer variable definitions...sort of an intro to the cast of characters.

    • Like 2
  5. I'm building a little driving game and ran into trouble using motionPath's align property. The plan is to have a split-screen view; duplicating much of the SVG. This works well enough, except when I use align the second set of cars align to the first track. Do I just need to make 4 motionPath timelines to work around this?

     

    (to play click on the pen, and use your left/up/right arrows)

    See the Pen 576b5c1f140ea115cd6e5a87a904e4ee?editors=1010 by creativeocean (@creativeocean) on CodePen

  6. Gulp is great for building banners!

     

    I primarily use it for LiveReload, and sometimes for bundling lots of different ad versions. But I've worked at several agencies that use it for running all sorts of other tasks (sprite-sheeting, css preprocessing, image compression, building/compiling, testing). I've also seen some places use grunt and webpack for those tasks.

     

    Personally, I like to use minimal CSS in banners. GSAP does an excellent job smoothing over browser inconsistencies, so there's no real need to use SCSS. And if you're animating a CSS property, you might as well set the start/end values in JS.

     

    For sprite-sheets, gulp is a good option. However, I usually use this handy tool because the settings let you adjust padding + layout (important for image sequence vs just compiling separate images): https://draeton.github.io/stitches/

     

    And for image compression, if you're squeezing every last drop of optimization out of your assets, then you have to dial that in for each image. This is my favorite tool for that: https://compress-or-die.com/

     

    Hope those are useful insights/links for anyone building ads!

    • Like 5
  7. Wow! Jack, I didn't expect this much support and improvement. There's a lot to review/digest/learn here, but I'm very grateful for the help and guidance. Codepen is now back online and I've forked the previous pen (and made it public), now using your JS: 

    See the Pen OJgNyVm?editors=0010 by creativeocean (@creativeocean) on CodePen

     

    Turned out pretty slick, if I do say so myself! Go team!

    • Like 5
  8. I hope it's okay to ask for help here, even though my problem has nothing to do with an actual GSAP issue.

     

    I'm working on this horizontal slider, and right now the parallax image movement (line 89) is just based on the draggable element's total progress. That works fine when the carousel has just a few images, but when there are many images, the amount of movement that is visible as each box crosses the stage becomes too small. And lots of the image is never actually seen. 

     

    At first I thought this would be pretty simple, but I've been fruitlessly struggling to figure out an equation/setup that will make any number of slides have the same amount of parallax motion, and still be responsive to the full browser width.

    See the Pen 44639788dd72f4e26b8c8b52cb096480?editors=0110 by creativeocean (@creativeocean) on CodePen

    • Like 1
  9. @Cassie thanks for confirming my suspicion about tweening progress with different ease applied.

     

    @OSUblake that's a great point. Tweening the progress, is definitely the right way to get what I was originally after. But the fact that changing defaults (not just ease) would potentially have a jarring, jumping effect, answers why it wouldn't be a useful feature to have. Thanks!

     

    @elegantseagulls yoyoEase is an important prop to know about, even if it's not exactly applicable here. Until you mentioned it, I didn't know that yoyoEase:true flips the ease. I've always used it to define a completely different ease on reverse.

     

    • Like 4
  10. Often I use a single timeline for button animation, and play/reverse on enter/leave. I know it's possible to adjust the timeScale for play() and reverse(), but I'm wondering if there's a way to change the timeline's default easing. It'd be great to have an easeOut when playing forward, and an easeInOut when reversing. I guess one way to get this effect could be to tween the TL's progress with whatever ease is desired. But I'm curious to know, generally, if timeline defaults can be updated after the fact, similar to the timeScale method.

    See the Pen YzVmNJy by creativeocean (@creativeocean) on CodePen

    • Like 1
  11. I've built a thing that uses a ScrollTrigger to scrub a timeline, which transitions in/out fixed-position page sections. It's working fairly well, however, there's something happening in the snapping's velocity calculation that is causing issues when you click a progress marker button and scrollTo a specific point in the page. If you set the duration on line 315 of the JS to something like 1, it works fine...because that was enough time for the velocity calculation to simmer down. I thought maybe toggling the disable/enable would be the fix, but it seems the velocity is calculated regardless of if the specific ST is enable.

     

    Two questions: 1) is there a way to use 'label' snapping without velocity calculations, and just move to the nearest label at the end of the delay, and 2) is it possible to change the snap property after an ST has been created? 

    See the Pen b0028a71d7263ff1122245389cb7d721?editors=1010 by creativeocean (@creativeocean) on CodePen

  12. I know this thread is now over a month old, but I wanted to share a fork of Zach's pen. I made a 6-sided die from the cube. To simplify/clarify, the 3d rotations are moved out of the CSS. Hopefully this demo is useful to someone...

     

    See the Pen qBRbNwa by creativeocean (@creativeocean) on CodePen

     

    • Like 15
  13. Yea, I closed my Twitter acct earlier this year (my handle was @FlashGuyTom which tells you how out of date and disused it was). I'm plenty active on CodePen, though! Thanks again for the referrals, and I hope the svg image sequence stuff works out well!

    • Like 1
×
×
  • Create New...