lukePeavey / SplitType

Javascript utility that splits text into lines, words, characters for animation
https://lukepeavey.github.io/SplitType/
545 stars 39 forks source link

font-kerning not helping... #61

Closed helloganiel closed 10 months ago

helloganiel commented 1 year ago

Hello,

I've tried applying the font-kerning fix for letter spacing and nothing helped. Can someone help me with this please?

Experiencing this problem on this site: https://madebyblank.webflow.io/studio

Thanks!

lukePeavey commented 1 year ago

Hey I'd be happy to take a look at this...

Are you seeing a visible change in character spacing after the text is rendered?

lukePeavey commented 1 year ago

Do you want me to reopen this?

helloganiel commented 1 year ago

Hello Luke, after reloading the page you can already see the change. Yes, it is quite visible, see this: https://streamable.com/atv8lo

lukePeavey commented 1 year ago

Can you share the source code for this page? The text is split into lines, and the whole paragraph is wrapped as a single line element. This is usually a sign that split type is being called before the layout has rendered.

image

Are you using a react or something similar ?

helloganiel commented 1 year ago

No I am not using react, just webflow with codesandbox linked in.

Here you can preview my webflow site:

https://preview.webflow.com/preview/madebyblank?utm_medium=preview_link&utm_source=designer&utm_content=madebyblank&preview=f8e76df79c2cefaef02b3dde9996a0ce&pageId=62f39c2beafac58c606400d5&workflow=preview

and here is the code for splitting and animating with gsap:

let typeSplit = new SplitType("[text-split]", {
  types: "words, lines, chars",
  tagName: "span"
});

// Link timelines to scroll position
function createScrollTrigger(triggerElement, timeline) {
  // Play tl when scrolled into view (60% from top of screen)
  ScrollTrigger.create({
    trigger: triggerElement,
    start: "top 80%",
    onEnter: () => timeline.play()
  });
}

$("[words-slide-up]").each(function (index) {
  let tl = gsap.timeline({ paused: true });
  tl.from($(this).find(".word"), {
    rotation: 7,
    autoAlpha: 0,
    yPercent: 50,
    duration: 0.6,
    ease: "Expo.easeOut",
    stagger: { each: 0.066 }
  });
  createScrollTrigger($(this), tl);
});
lukePeavey commented 1 year ago

This issue is most likely related to using SplitType within WebFlow.

Unfortunately i'm not really familiar with WebFlow. But you need to ensure that SplitType is executed after the page content is fully rendered. If WebFlow is applying dynamic styles to the content at run time, you would need to make sure that SplitType executes after those styles have been applied.

A few things you could try for debugging...

helloganiel commented 1 year ago

Thanks, I'll try everything, but the split type in the chars is moving the kerning, even if I fix the issue when loading after the content is fully rendered, doesn't it still look "bad"(kerning)?

lukePeavey commented 1 year ago

Yeah, I see what you mean. I'll take another look.

lukePeavey commented 10 months ago

I'm going to close this. Sorry I wasn't able to resolve this.