Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Use of emoji #24

Closed
pmcp opened this issue Aug 14, 2016 · 1 comment
Closed

Use of emoji #24

pmcp opened this issue Aug 14, 2016 · 1 comment

Comments

@pmcp
Copy link

pmcp commented Aug 14, 2016

It would be fun to use this with emoji's, but i can't seem to get it to work. I tried it in a codepen, but it regulary shows the replacement character � instead of the emoji. Any idea why?

http://codepen.io/martyLauders/pen/VjgAyA

@camwiegert
Copy link
Owner

camwiegert commented Aug 15, 2016

This a good question, and one that I hope to address clearly in the documentation soon. This blog post has a good explanation of the problem.

The solution, at the moment, is to use surrogate pairs for unicode characters that fall outside of the range expressable in javascript. I forked your pen here. This tool can help you calculate the surrogate pairs for emoji.

let b = baffle('.headline', {
    characters: [
      '\uD83D\uDE00',
      '\uD83D\uDE09',
      '\uD83D\uDE0D',
      '\uD83D\uDE05'
    ],
    speed: 100
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants