jesper.landberg
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by jesper.landberg
-
-
Can I force matrix transforms? I find those smoother then the "translate(XX, XX) translate3d(0, 0,0)" ones.. or am I just imagining this?
-
Hi,
What I want to do:
Repeat part of a timeline infinite, until a window.onload callback, after which the timeline should play out fully.
Any tips how to do?
-
Am I the first one here to say u shouldn't animate backgroundPosition, but instead try to stick to transforms?
- 4
-
You probs solved this already but the problem is in your prev() function, ur just setting this.data.next. It should/could look like this:
prev() { if (this.data.animating) return this.data.direction = "back" this.data.next = this.data.current this.data.current = this.data.current == 0 ? 2 : this.data.current - 1 this.slideIt() }
Then u could just check the direction in slideIt() for example like this:
const translateX = this.data.direction === 'back' ? -100 : 100
- 3
-
26 minutes ago, TEQQED said:
I understand the tilt effect on scroll, but what about the angle the content/image makes on scroll after a certain point: http://prntscr.com/mtw53w ?
@TEQQED What I would do is create a GSAP timeline, then increase the progress of it tied to scroll.
Here I created a quick demo, it doesnt have the perspective/angle, but u get the point.
See the Pen 1be4b0a81ac8f1c2ddaca22f37f8ab98?editors=0010 by ReGGae (@ReGGae) on CodePen
- 3
-
13 hours ago, smallio said:13 hours ago, TEQQED said:
@smallio checking it out now, thanks so much! Love this community so far, people are so helpful
I need to update those demos to some fresher/better ones:P
Between the other code in those demos the actual logic for the effect is pretty straight forward. You just lerp the scroll value, check the diff between the new and old value... and apply that value to anything.. like a skew in this case.
Something like the below (not tested).let scrollTarget = 0 let scrollCurrent = 0 let ease = 0.1 const skewTarget = someElement window.addEventListener('scroll', () => { scrollTarget = window.scrollY }) function render() { scrollCurrent += (scrollTarget - scrollCurrent) * ease const diff = scrollTarget - scrollCurrent const vel =+ diff skewTarget.style.transform = `skewY(${vel}deg)` requestAnimationFrame(render) } requestAnimationFrame(render)
- 4
-
2 minutes ago, GreenSock said:
Yes, sort of. It was considered a "bug" (though I suppose that's arguable) that things would render immediately when the timeline was paused. Notice your timeline is initially paused, thus the from() tweens technically shouldn't render. See what I mean?
You have two options:
- Don't pause the timeline initially (there's really no reason to because you call play() on the same tick).
- Specify immediateRender:true in your tweens to force it.
To be clear, the new behavior only affects the DEFAULT value (when you don't specify immediateRender one way or the other).
Does that help?
Makes sense, thanks:) -
Hi,
I updated my gsap version, no other changes done. Now my transitions doesn't "immediaterender", instead the elements show in the regular state before the timeline and tweens start. Did 2.1 change the default behaviour of this?
See the Pen WPWdKE?editors=0010 by ReGGae (@ReGGae) on CodePen
-
3 minutes ago, mikel said:
Yeah, got it to work with some if isActive() kill thing:P- 1
-
Hi,
Any tips on preventing the blue layer to get "stuck" if hovering in/out very fast for a bit?
See the Pen bOMbKW?editors=0110 by ReGGae (@ReGGae) on CodePen
-
On 1/3/2019 at 1:25 PM, mamin said:
hi
i watch this site
https://asaro.co.uk/experiences/adventures/#introduction
how to use wave on image? Such examples
please help me...
Hi,
I made this site, the image is rendered with three.js, and the effect is made in a shader distorting the UV values with some sin and cos math.
- 4
- 1
-
27 minutes ago, Carl said:
please don't post private pens. we can't fork them.
is there a reason you don't just restart() the timeline?
Please try this code
const btn = document.querySelector('.js-play') const split = new SplitText('.js-typewriter', { type: 'lines, words, chars' }) let tl = new TimelineLite({ paused: true }) tl.staggerFrom(split.chars, 0.1, { width: 0, alpha: 0, ease: SteppedEase.config(1) }, 0.1) function animate() { tl.restart(); } btn.addEventListener('click', animate)
also, the TextPlugin basically does all that for you with even less code:
See the Pen GqKrxG?editors=0010 by GreenSock (@GreenSock) on CodePen
Yeah, i can just restart unfortunaly.
Ohhh, I didn't even know about that plugin hah. Thanks.- 1
-
Hi,
I have done a super simple typewriter effect, which works as intended, excerpt when u interrupt and restart it. The width of each char will just be correct until the previous reset point. Check the Pen to understand. If you let the whole timeline run before clicking the button, everything is fine, however, clicking it in the middle of the animation, messes up the next.
See the Pen 17da5944201f156706391328fe7421dd by ReGGae (@ReGGae) on CodePen
-
23 minutes ago, GreenSock said:
Yeah, I'm unclear about what exactly you're asking or why. Is it one element and you're trying to figure out the bounding box of the entire animation? For example, if you've got a 10x10 element that starts at coordinates 0,0 and animates 100px to the right, the bounding box would be {top:0, left:0, right:110, bottom:10}?
Like @OSUblake said, a demo would REALLY help.
@OSUblake
Im animating tweens tied to scroll, and when doing an Y transform, the progress reaches 1 before the element of the tween is out of view. I reckon this is because in my this.elems array i'm only storing the start bounds of the elements, when I would need the end bounds.
Take a look at the first animated element in this demo below, and u can see what I mean. So i was thinking that in my getElems method, maybe I should put the timeline progress to 1, set the bounds, then put it back to progress 0 ?.
-
Hi,
What would be the best way to get the end boundingRect of a tween? If I tween yPercent: 0 to yPercent: 200 for example. Would it be to store the rect in a variable in an onComplete callback or is there any better way?
-
Hi,
I'm trying to create a personal little mini lib/class to handle timelines tied to scroll. Could use ScrollMagic, but wouldn't learn much from that would I?
Any feedback on what is done so far? Thinking about how I would play more advanced timelines, rather than just simple fromTo's. I guess those would be best of defined in the javascript, but trying to think of an elegant solution to that, any tips? Currently I define animations through data attribute, as valid json.
Also, is it possible to get the end bounds/rect of a timeline/tween element in advance? Or would I need to put progress(1) .. get new rect... put back to progress(0) ?
-
23 minutes ago, smallio said:
@jesper.landberg Love your work man Seen a few things on codepen recently... not to mention how juicy the Asaro site is!
Thanks, appreciate it:) If you like those stuff i will probs like my next prod that is going live within a week or so, pretty proud of it:) Smoother than ever!:P- 1
-
2 minutes ago, Sahil said:
Those values get passed as string. You need to create JSON string and parse it.
<div data-from='{"yPercent": "0", "rotation": "0"}' data-to='{"yPercent": "-100", "rotation": "5", "ease": "Expo.easeOut"}'>
const from = JSON.parse(el.dataset.from); const to = JSON.parse(el.dataset.to);
Double quotes are important, if you don't want to use quotes, you will find some stack overflow threads with regex solutions. You can also encode JSON string from server in PHP, there will be equivalent solutions for other languages.
There it was, thanks you:) -
Hi,
Im trying to build out some timelines based on props and values from data-attributes. However it doesn't seem to work, and it's throwing no errors or doing nothing when i try to play or build it. What am I missing?Looks like this:
<figure class="c-photos__img c-photos__img--1"> <div data-from="yPercent: 0, rotation: 0" data-to="yPercent: -100, rotation: 5, ease: Expo.easeOut"> <img src="/static/images/photo-1.jpg"> </div> </figure> <figure class="c-photos__img c-photos__img--2"> <div data-from="yPercent: 0, rotation: 0" data-to="yPercent: -100, rotation: 5, ease: Expo.easeOut"> <img src="/static/images/photo-3.jpg"> </div> </figure> <figure class="c-photos__img c-photos__img--3"> <div data-from="yPercent: 0, rotation: 0" data-to="yPercent: -100, rotation: 5, ease: Expo.easeOut"> <img src="/static/images/photo-3.jpg"> </div> </figure> <figure class="c-photos__img c-photos__img--4"> <div data-from="yPercent: 0, rotation: 0" data-to="yPercent: -100, rotation: 5, ease: Expo.easeOut"> <img src="/static/images/photo-4.jpg"> </div> </figure> <figure class="c-photos__img c-photos__img--5"> <div data-from="yPercent: 0, rotation: 0" data-to="yPercent: -100, rotation: 5, ease: Expo.easeOut"> <img src="/static/images/photo-5.jpg"> </div> </figure>
this.dom.elems.forEach(el => { const tl = new TimelineLite({ paused: true }) const from = el.dataset.from const to = el.dataset.to tl.fromTo(el, 1, { from }, { to }) tl.play() // Example, this won't play or throw any error this.elems.push({ tl: tl }) })
-
Hi @Noturnoo ! Sorry I just saw this thread now, did you archive your goal? It was me who developed the Asaro site including the slider ur referring to.
- 1
-
33 minutes ago, mikel said:
Cool thanks, would it be possible to reverser the order of the stagger also? 0.075 -> -0.075
I think maybe this is more of an issue with the first tween/timeline getting overwritten? Is there any way to interupt, but not kill the other tween so it can be played again?
-
3 minutes ago, mikel said:
Hi @jesper.landberg,
If I understand you correctly ...
try using tlGrab.reverse() - by default it is playing in reverse from wherever the playhead currently is.
Happy tweening ...
Mikel
Well yeah kind off... but what I dont like when doing reverse() is the reversing of the easing functions. I would want easeOut both directions, not easeIn which it is when doing reverse. Thats why I'm doing two timelines. Do you understand?:) -
20 hours ago, Carl said:
I'm guessing that your animation might be a from() or staggerFrom() and perhaps the starting values are the same as the existing values.
Unfortunately, I can't look at your full production site. However if you make a super simple reduced test case (publicly accessible) that doesn't include your protected images and stuff specific to your client then we can take a look. This reduced test case just needs enough code to replicate the issue... a single div that you populate with different text, split and animate. If you can set that up using CodePen... fantastic. I'm guessing you can probably fake the ajax calls and just call a function that simulates new text coming into the title. Perhaps something as simple as a single H1 element and 2 buttons that change the text and trigger a new animation.
Hmm. But I revert the splittext, and clear all styles from the title. And also when i switch page the title is removed from the dom, and then inserted again. I also to a fromTo, but it only sets the from values, just won't animate.
I will see if I can get a simple demo up. -
Hi,
See my attached PEN.
I want the in/out timelines to interup each other seemingly. If I do mouseup before the tlGrab is finished, I want tlRelease to play from the current position. Currently it gets messy and then basically doesnt work at all.
Tips, solutions?
set progress of tween without calling callbacks/events?
in GSAP
Posted
So If I have a timeline like this random example:
But need to change the progress initially like:
How would u do this without calling the callback?
I tried removing it from the timeline, and add it like below, but doesn't seem to work as I want?