question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

flickering, jumping when using setPin()

See original GitHub issue

I am using this following code to make a scale-based Animation with ScrollMagic and GSAP:

const timeline = gsap.timeline({ paused: true });
timeline.fromTo(Container, 1, { scale: 2.5 }, { scale: 1 });

const containerResizeScene = new ScrollScene({
    triggerElement: document.querySelector('#hero'),
    triggerHook: 0,
    duration: 500,
    gsap: {
        timeline: timeline
    }
});
containerResizeScene.Scene.setPin('#subheading'); //set Pin

but when I scroll, the scalable element always jumps up briefly. I have already tested several css properties, but nothing worked really well, except I use position: absolute and I remove the setPin() function.

I have read that a native setPin() function is planned… Could this be my solution? Can I wait for the implementation, or do I have to think of an alternative?

Are there any helpful tips or workarounds?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jonkwheelercommented, Mar 24, 2020

@niklasgrewe I added a “mimic pinning” example. It basically simulates a pin in the hero. https://scrollscene.jonkwheeler.now.sh/?path=/story/scrollscene-examples--mimic-pinning

You can see the code here: https://github.com/jonkwheeler/ScrollScene/blob/master/src/stories/story.js#L1464

Again though, if you want to learn how to use this more, please take Petr’s course https://ihatetomatoes.net/get-scrollmagic-workshop/ as it shows you how to do all of this.

0reactions
niklasgrewecommented, Mar 25, 2020

@jonkwheeler thank you very much for this example. You don’t know how much you’ve helped me. Now the animation works as desired, no flickering or jumping - thanks for your effort

But I still have only one small questions and I hope that you can answer them:

How can i calculate the scale number correctly?

I do not want to scale the box with static values and mediaQueries. Would you know a sample formula that can calculate how much I need to scale the box on each screen? Currently I scale with 2.2 and use height: 100vh on the figure tag. The problem is that, depending on the scaling value, I also have to change the height so that the screen-image is displayed centered. How could I make the whole thing more dynamic? Do you have an idea?


I’m not asking you any more questions on this issue. But I would be very grateful if you could give me some assistance in these one point. Thanks again for your generous support. 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix screen flickering in Windows - Microsoft Support
Screen flickering in Windows is usually caused by display drivers. To update your display driver, you'll need to start your PC in safe...
Read more >
Circuit1
You can make use of the millis() function to keep track of the time when ... long debounceDelay = 50; // the debounce...
Read more >
Networking and Communications - Fab Academy
Once this is done, just import all you component for your board using the "add" ... if (flashing ) { if (mySerial.available() >...
Read more >
attachInterrupt: Flow meters trigger button interrupt - Firmware ...
Using an electron, Device OS: 1.5.0, flashing with Workbench. Serial connected. Using two flow meters, two push buttons, and a motorized valve, ...
Read more >
First Steps With The Arduino: A Closer Look At The Circuit ...
That line is saying "Set pin 13 to output mode". 13, remember, is the built-in LED. Then there is the loop: void loop()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found