OSUblake
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by OSUblake
-
-
That's what we're here for 😉
- 1
-
The calculations will be wrong with relative. The modifiers wraps based on the translated X position, but with relative, you would also have to take into account how far left the item is initially positioned.
BTW... this thread has a helper function that may be of use.
- 1
-
6 hours ago, Nzhiti said:
This seems to work as expected not sure it's the correct approach
If it works, it's correct. 😉
But it seems like a good approach to me.
- 1
-
Don't use images. Put everything into a single SVG. SVG is markup, just like HTML.
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/svg
- 2
-
1 hour ago, Nzhiti said:
I don't know how to insert code pen again 😃
Just post the url.
-
For one, you're using relative values like "-=200" and "+=200". That's just going to add/subtract to whatever the x value is at that moment in time.
For example, if x is 135 when you click prev, then it's going to animate x to 335, and not 400 like you're expecting.
Another thing is that this calculation doesn't work like you might expect when x is negative.
parseFloat(x) % containerWidth
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder
QuoteTo obtain a modulo in JavaScript, in place of
a % n
, use((a % n ) + n ) % n
Or you can use the wrap util.
https://greensock.com/docs/v3/GSAP/UtilityMethods/wrap()
- 1
-
-
19 hours ago, VoicesFromTheFuselage said:
Thanks OSUblake, seems like ive targeted the pie i cannot bite
How far did you get? That's a super complicated animation, and needs to be broken down into pieces. That's why I would recommend starting with the FLIP part.
- 2
-
Oh, I just did a quick estimate to get it working... and I probably used "vh" by accident. Either way, using vh/vw units probably isn't ideal because the gap between the slides looks like a px value.
You would probably have to calculate the amount on every resize. Assuming your component is the entire width of the screen, you could get the bounding rect of the last slide and subtract the screen width from it to get how far the slides need to animate.
const { left, width } = lastSlide.getBoundingClientRect(); const totalWidth = (left + width); const screenWidth = window.innerWidth; this.galleryAnim.progress(0); // create new animation this.galleryAnim = gsap.to(...)
-
The FlipPlugin might be a good place to start with moving elements.
https://greensock.com/docs/v3/Plugins/Flip
- 1
-
Here's a start. Needs a little bit of fine tuning. It gets a little jittery with small changes.
See the Pen f8af01af2eae2cb07bf3b65d3c6a6cb9 by osublake (@osublake) on CodePen
- 2
-
Hey, sorry about that. Had some other stuff come up that I needed to finish first, but I'm working on this right now.
-
25 minutes ago, Parthiban said:
I have about 100 frames in this animation; essentially, there are 100 http requests for loading this experience. I was wondering if it is a good idea to make image sprites and load a single image file;
Loading one image should be faster than loading 100 images, but we're in an http2 world, so the difference is negligible.
This is my performance tip.... get your animation working first. If you notice a performance problem, I will personally help you fix it.
- 1
-
Cool! I'll update your pen in a few.
While you're waiting, here is the strategy I use for stuff like that. I use a "hidden" proxy element for the draggable, then apply the changes from that proxy element to something else, like a WebGL animation.
Just an example. Uses are very old version of Angular.
See the Pen 5f0a77404087e565567cfb3870f0c2b6 by osublake (@osublake) on CodePen
- 2
-
Hey @Shaban Iddrisu™
Love seeing shaders!!!
Are you planning on replacing the horizontal scroll with draggable? I ask this because not everyone can scroll horizontally, i.e. people who use a mouse.
Technically you can scroll horizontally by holding the shift button while scrolling with the mouse wheel, but most people don't know that.
- 1
-
Pretty sure that would involve some sort of scroll jacking. What you're basically asking for is a way to pause scrolling, which isn't possible unless you hijack the scroll.
- 1
-
Reference - computed property names
- 2
-
Do you mean like this?
See the Pen 3dd173c4c827fa0a33bea4aaa8e686a2 by osublake (@osublake) on CodePen
- 2
- 1
-
Like I said, mask support is meh for HTML elements. You need to go all SVG.
See the Pen 29cfa0e0a2a25b403dcd15c365096996 by osublake (@osublake) on CodePen
If you're new to SVG animations, @PointC has some fantastic tutorials...
- 3
-
This should put you in the right direction. Basically, the horizontally movement is a paused animation, and we just set the progress of that animation to the ratio of how far it's been dragged/scrolled.
https://stackblitz.com/edit/angular-ivy-qjqa2k?file=src/app/app.component.ts
- 2
-
Can you put that in a demo? I've never used mask like that because support is meh. Usually go full-on svg.
-
You probably shouldn't be animating
left
as it's not a transform. Just usexPercent
.See the Pen a8f0ea008f87c51c94165aef32dc0550 by osublake (@osublake) on CodePen
- 2
-
5 hours ago, MFDes said:
The issue is, it makes it almost impossible for me to add a stagger effect like in this example
How so? Just animate 3 different shapes. A stagger is just a delay, or you can use different speeds, i.e. durations.
-
You need to load the text plugin.
https://cdnjs.cloudflare.com/ajax/libs/gsap/3.6.1/TextPlugin.min.js
- 1
Absolute to relative flip
in GSAP
Posted
It's best to move it from a container.
See the Pen cf9ef27c7ed8866b42d9bc967f86f132 by osublake (@osublake) on CodePen