Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to reset char-index value within each word #42

Open
hexagoncircle opened this issue Sep 19, 2019 · 1 comment
Open

Add option to reset char-index value within each word #42

hexagoncircle opened this issue Sep 19, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@hexagoncircle
Copy link

I would love to have the ability to either:

  • reset the --char-index within each word by passing an option to do so
  • have an additional variable that sets an index for each character in a word, i.e. --word-char-index (which could also be optional if it's polluting the HTML a bit much)

Hopefully this is enough information, but here's an example of the first idea:

<h1 data-splitting>
  <span class="word" data-word="Reset" style="--word-index:0;">
    <span style="--char-index:0;">R</span>
    <span style="--char-index:1;">e</span>
    ...
  </span>
  <span class="word" data-word="Index" style="--word-index:1;">
    <span style="--char-index:0;">i</span>
    <span style="--char-index:1;">n</span>
    ...
  </span>
</h1>

This would allow more granular control over things like animations inside each word. If I wanted to set a delay on the second word's characters and multiply the --char-index by some value, it wouldn't work as I'd want it to. In the example above, the --char-index would start at 5 instead of 0.

Let me know if I can provide any more details. Cheers!

@shshaw
Copy link
Owner

shshaw commented Sep 19, 2019

Makes sense.

First thought would be to implement it as a new split word-chars, which would split words as normal, then run the char split on each word.

It could be interesting to additionally include a variable like --word-start-char that would be the amount of characters before the word, so you could still calculate the char index from the main parent.

@shshaw shshaw added the enhancement New feature or request label Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants