-
Posts
1,002 -
Joined
-
Last visited
-
Days Won
71
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
ScrollTrigger Demos
Downloads
Posts posted by Sahil
-
-
@alessio Sorry I am not sure what effect you are trying to achieve and what problem you are facing. It will be great if you rephrase your question and post a simple demo that shows your problem.
-
1
-
-
Quote
I was on a mission to win 7 days straight, had to give up all hopes when I saw Blake online today. Looks like I will have to start over again someday.
Still 2 more to go, if anybody has 10 questions please post them today when none of mods are online.
-
5
-
-
Quote
If you've ever heard about the FLIP animation technique, that's basically what @Sahil was showing you.
I thought you will never mention FLIP on forum again.
-
It was supposed to be,
if ( target.classList && (target.classList.contains("map-card__header") || target.classList.contains("map-card__close")) ) { target = target.closest('.map-card'); }
Why it still worked then? Because in your demo if dataset.mapCard is undefined then animation would reverse.
See the Pen QrQNKd?editors=0010 by Sahil89 (@Sahil89) on CodePen
Quoteevent.stopPropagation();
That is used to stop event bubbling. What was happening was, you were listening to click event on map card and close button so when you clicked on close icon, your timeline would start reversing but then even would get bubbled to the parent that is map card and it would again play your animation so you must have felt that close doesn't work.
In following demo animation is set to play or reverse when you click on '.container' but all three elements are listening to click event. So
1. if you click on edge of container then animation will play or reverse.
2. If you click on edge of wrapper then nothing will happen because event is getting bubbled twice
3. but if you click on center then animation will play or reverse because event is getting bubbled three times. So lets say animation is reversed, it will start reversing then playing and again reversing but you will only see it getting reversing because everything happens at the same time.
See the Pen qYxNBB?editors=0010 by Sahil89 (@Sahil89) on CodePen
-
4
-
-
I thought you meant you want video to play when you hover text and pause when you mouse out.
I have updated the demo and wrapped your content boxes in a wrapper so you can use that wrapper to listen mouse events.
-
1
-
1
-
-
Adding delay to tweens using delay method does not get affected by the TimeScale but it seems like it does get affected by globalTimeScale or timeScale of parent timeline. So you will need to set timescale on individual tweens instead of timeline.
See the Pen aGEWQg?editors=0010 by Sahil89 (@Sahil89) on CodePen
if you want to change globalTimeScale or parent timeline's timeScale and want the tweens to keep delay then you will need to update delay and multiply it with timeScale.
-
2
-
-
Easiest way would be to change your click handler to header so your map card won't listen to click event.
See the Pen PeEmYP?editors=0010 by Sahil89 (@Sahil89) on CodePen
-
5
-
-
Alright, I ignored that part completely. To play, pause video you need to select the video element and use it's play or pause method and you can reset time by setting currentTime property to zero. Check the updated demo.
-
2
-
1
-
-
The way you have created your tweener class(or is it Blake's demo? ), it takes one container as trigger element and runs the animation on all items that you pass. If you want to trigger animation independently then you will need to create multiple instances of Tweener and add items to them.
-
4
-
-
-
1
-
-
Nice question. I have had similar question but never bothered too much about it because it works. I will try to explain with what I know.
JavaScript runs in a single thread so it will execute all statements before rendering/updating the page. So let's say on click event you are executing a function, JavaScript will execute all the statements before rendering the layout. In following demo you can see a there is a loop that executes 10 times it executes 20 statements of TweenMax and many more that you don't see from library. In console you can see that it takes about 2-8 miliseconds to execute the loop, it can vary depending from system to system. Once all statements are executed then browser will update the layout with any changes that occurred.
Now for your animation to run at 60FPS browser must update any changes every 16 milliseconds so if you are doing a lot of animations that take more than 16ms, it will start degrading the performance by dropping the frames because JavaScript is busy executing other stuff. In demo, If you change the count to something like 5000, you will see that it takes browser about 1500ms to execute the loop. If you log the performance of the page using devtools you can see that for that time browser never rendered anything so no question of seeing jumps, just horrible user experience.
See the Pen Xqzxpo?editors=1010 by Sahil89 (@Sahil89) on CodePen
Interestingly, just today a video was published about whole JavaScript event loop that talks in detail how JavaScript is executed, I haven't seen the video yet but it will be worth watching. You will find a lot more videos on that channel about everything in details.
An article that talks about rendering and performance in details, https://developers.google.com/web/fundamentals/performance/rendering/
Another article worth reading that talks about how different scrolling methods affect the performance https://blogs.windows.com/msedgedev/2017/03/08/scrolling-on-the-web/#lvzozB8m1fZOWgTt.97
Another thing is how animating certain properties affects the layout, for example if you animate left, top, height or width it will trigger the layout and browser will have to recalculate entire page. While animating transforms won't cause layout trigger in most browsers. On following page you will find list of browsers and what property triggers what, so you want to avoid those triggers wherever possible for better performance.
About how animations work, at core GSAP just calculates over time with different easing formulas and set those values on the element. So basically you can animate numbers of any object, that's why it is very easy to use GSAP to animate different libraries like Three.js, PIXI js etc. GSAP uses the requestAnimationFrame function which makes sure everything animates at constant frame rate given that you don't animate too many pixels at once.
Following is simple demo of how you can ease using simple Math,
See the Pen PeOydK?editors=1010 by Sahil89 (@Sahil89) on CodePen
But of course GSAP does a lot more than simple easing, it makes sure that your animations execute at exact duration that you set and a lot of other work to work around different browser inconsistencies.
-
5
-
1
-
-
Possible with modifiersPlugin. Though out of box solution sounds interesting to me.
See the Pen Bxmrax?editors=0010 by Sahil89 (@Sahil89) on CodePen
@GreenSock Isn't there a property that will snap object to the start point of path before animating? I think I have used it once but can't find it in docs.
-
4
-
-
Here is how you can animate element as you change it's parent. You can do that by recording element's old and new position using getBoundingClientRect and then animate the difference using from tween.
See the Pen OZOWqG?editors=0010 by Sahil89 (@Sahil89) on CodePen
-
7
-
-
Problem is you are using timeline to animate three elements with random sequence. So lets say you click on circle and quickly click on body, then your both timelines start almost at same time.
1. The body click event's timeline finishes first tween and sets the alpha of '.copy' to zero but by the time it reaches third tween.
2. Your hotspot click event's timeline reaches third tween which sets alpha of '.copy' back to 1.
You can get around that by maintaining two arrays that will hold your timeline at that index so you can kill the animation.
See the Pen bMYgqO?editors=0010 by Sahil89 (@Sahil89) on CodePen
Take a look at following thread with similar idea, it uses same animation to play or reverse but you will find it helpful in future.
In your demo you were using TweenMax 1.20.3 under javascript settings then you had TweenMax 1.20.4 link added under HTML setting. You don't need TimelineMax when you are using TweenMax, it is bundled with it.
Also, in the demo you are mixing jQuery with vanilla js randomly it will lead you to a lot of errors and confusion.
-
4
-
-
You can do that by only start animating once scrollY is greater than element's offset. Then use window.innerHeight to set progress. You can use innerHeight to set the percentage, the way scrollMagic trigger works.
https://www.kirupa.com/html5/get_element_position_using_javascript.htm
See the Pen PeObOj?editors=0010 by Sahil89 (@Sahil89) on CodePen
You can improve performance by avoiding calculating offset every time you scroll by saving it as Skroller property and calculating it on resize.
-
4
-
-
Quote
Am the only one? that shocks!!! that everybody use the method TweenMax.to
You can use TweenLite PixiPlugin as you don't really need all other plugins bundled within TweenMax. TweenMax also has some additional methods like stagger tweens, killAll, pauseAll, globalTimeScale etc so if you don't need them you can use TweenLite only. . There is of course less code to execute in TweenLite but you probably will never notice any difference.
QuoteIs it not ? more logical for the performances to initiate one time only this class ?, and then modify these parameters with a scope.
You mean initilize TweenMax just once? Performance has always been main focus of GSAP so I doubt @GreenSock will miss something obvious.
-
1
-
-
You need to set dragClickables property to true. Also, you were using 4 year old version of draggable. Latest version 1.20.4 will fix any issues you are having.
See the Pen ELwJop?editors=1010 by Sahil89 (@Sahil89) on CodePen
-
2
-
1
-
-
@WilliamBay Happy to help! It looks beautiful. Nice work.
-
1
-
-
@jonForum No problem at all.
I gave it a try using ThrowPropsPlugin, see if it helps.
See the Pen JvrZyd?editors=0010 by Sahil89 (@Sahil89) on CodePen
I also tried to ease it in a way where object will slow down before animating reverse but I doubt that will be possible, maybe Blake can suggest something.
Also, try avoiding easeIn and easeInOut because they behave very unexpectedly. @GreenSock can explain why that happens.
-
1
-
1
-
-
That's pretty unique approach I have seen for the first time. I don't see any issue with it except the play part. I will try to explain.
When you tween something GSAP records the start and end values to optimize performance plus that's what tween engines do I guess. So when you play the Tween GSAP will record the values and and if you play that tween again it will repeat the same animation. Which you can see in following example. If you click again on window you will see that GSAP is repeating same animation, instead of taking into account new value.
See the Pen RyLgJq?editors=1010 by Sahil89 (@Sahil89) on CodePen
You will also notice that I am passing 0 as argument to the play method, if you remove that you will notice that after first run animation won't repeat. That's because playhead of animation is already at the end so there is nothing to play further.
So to get around it you will need to invalidate your tween which will cause GSAP to record new values and your animation can move to new location.
See the Pen gzGRdy?editors=1010 by Sahil89 (@Sahil89) on CodePen
Though you will still need to pass the zero because even though you invalidated the tween the playhead is at the end. Does that help?
I am just getting started with PIXI but this seems like an interesting thread so feel free to ask any questions. @OSUblake will join the conversation once he gets online.
Also, most of the resources are targeted towards web developers so I don't think you will find a lot of useful tutorials for you. But if it helps you can visit the YouTube channel: https://www.youtube.com/user/GreenSockLearning
There is also learning page link at the top of menu but I doubt you will find a lot of help there, so feel free to post your questions.
-
4
-
-
Hey @jonForum
Unfortunately no. You can chain certain methods but can't do something similar for easing. Your best way would be write your properties per line, far easy to read or comment out.
TweenLite.to(obj, 2, { pixi: { pivotX: x, pivotY: y }, ease: Power2.easeOut });
-
1
-
1
-
-
Here is simple example. Trick is to animate scaleX so element looks like it transitions out and new element comes from left and changing transform origin of your element. Also animating scale instead of width gives you far better performance.
See the Pen ELwZOb?editors=0010 by Sahil89 (@Sahil89) on CodePen
-
6
-
1
-
-
You can check that using tl.reversed() method.
See the Pen zjENPw?editors=1010 by Sahil89 (@Sahil89) on CodePen
-
5
-
-
Quote
See... this is why it's Jack against the whole mod team. (and we'll still probably lose)
@OSUblake Would be on our team. Let's have a code off between Blake and Jack. I will some popcorns.
-
2
-
Can't get updateTo to work properly
in GSAP
Posted
I couldn't reproduce that behavior using snippets you posted. Can you post that as reduced test case demo?