Emoji Fluff

:discourse2: Summary Adds optional variations or animations to emojis.
:eyeglasses: Preview Preview on theme-creator.discourse.org
:hammer_and_wrench: Repository Link https://github.com/arkshine/discourse-emoji-fluff
:open_book: New to Discourse Themes? Beginnerā€™s guide to using Discourse Themes

Install this theme component

:information_source: This component requires Discourse to be current as of 2024-11-26T23:00:00Z. [1]

Description

Emoji Fluff allows users to put mirrored or animated emojis in their posts.
It allows users to post fancy emoji work such as:

flexing emoji

You can choose these decorations from the emoji autocompletion pop-up, from the emoji picker, or by appending keywords directly after the emoji shortcode:

Examples: :bike:f-slide , :smile:f-bounce

Horizontal and vertical flips can be combined with other decorations.

Examples:

  • :horse:f-slide,flip:
  • :spider:f-float,flip_v:

Screenshots

Available emoji fluff

Fluff list

How to add fluff to an emoji

From the emoji autocompletion pop-up

fluff autocompletion

From the emoji picker

Fluff emoji picker

By typing manually the fluff suffix

Fluff suffix

Features

  • Horizontally or vertically mirrored emojis

  • Animated emojis (bounce, rotate, pulse, etc)

  • Setting to choose which emoji decorations should be available to users

  • Setting to choose inserting a decorations selector in autocomplete or emoji picker.

  • Allow admins to create new fluffs

Settings

Setting Description
enabled Turn on or off the componentā€™s functionalities.
Default value: true
Disabling will prevent the emoji decoration from being applied.
This is useful if you want to pause or plan to remove the component but donā€™t want to see the decoration code, such as :slightly_smiling_face:spin:, in posts.
For more information, check out Reverting emoji decorations in the topic.
allow decorations List of allowed decorations.
Default value: flip|flip_v|spin|pulse|bounce|wobble|float|slide|fade|negative|hue|gray
allow selector in Where the fluff selector should be available.
Default value: both
none ā€“ disable the selectors.
both ā€“ enable the selector in the autocomplete and the emoji picker.
autocomplete ā€“ enable the selector only in the autocomplete.
emoji-picker ā€“ enable the selector only in the emoji picker.

:earth_africa: Additionally, the theme component strings are translatable from the settings.

Reverting emoji decorations

If you disable the component, these suffixes remain, resulting in emojis like this: :smile:f-spin:

Due to theme component limitations and design choices, we add straightforward suffixes to emojis to give them these decorative effects. The fluff prefix f- helps identify these decorations, making them easy to remove through the script available below.

You can download and run a rake task to remove fluff suffixes definitely from posts.

wget -P lib/tasks/ https://raw.githubusercontent.com/Arkshine/discourse-emoji-fluff/refs/heads/main/tasks/fluff.rake
rake fluff:delete_all

:information_source: The rake task doesnā€™t create post revisions by default. You can add false as an argument to change this behavior: rake fluff:delete_all[false]

Read Administrative Bulk Operations for instructions on entering the container to run the rake task.

:warning: Always make a backup before running this task. There is no guarantee that it wonā€™t remove unwanted strings. Use it at your own risk, and review the code if in doubt.

Creating your fluffs

Fluff creation requires CSS knowledge.

When a fluff is added to an emoji inside a post, the emoji is wrapped by a <span> tag with a fluff class:

<span class="fluff fluff--bounce">
  <img src="https://your.discourse.com/images/emoji/twitter/kangaroo.png?v=12" title=":kangaroo:" class="emoji" alt=":kangaroo:" loading="lazy" width="20" height="20" style="aspect-ratio: 20 / 20;">
</span>

Add custom CSS to your theme or a new theme component to add new fluffs.
Here are two examples of new fluff:

Tilt 90Ā° an emoji

Emoji tilt

.fluff--tilt img {
  transform: rotate(90deg);
}

Do a 3D spin effect

Emoji 3D spin

.fluff--spin3d img {
  animation: f-spin3d 2s infinite linear;
}

@keyframes f-spin3d {
  0% {
    transform: perspective(50em) rotateY(0deg);
    filter: brightness(1);
  }
  50% {
    transform: perspective(50em) rotateY(90deg);
    filter: brightness(0.85);
  }
  51% {
    transform: perspective(50em) rotateY(91deg);
    filter: brightness(1.15);
  }
  100% {
    transform: perspective(50em) rotateY(180deg);
    filter: brightness(1);
  }
}

Then, you need to add the fluff suffix in the Emoji Fluff allowed decorations:

Thatā€™s all; your new fluffs should now be available to users. Enjoy!

Credit

  • @Canapin: Original idea, general help preparing and testing this TC.

  1. To be precise, TC requires at least a Discourse version after October 30, and specifically the support of emoji picker, a current version as of 2024-11-26T23:00:00Z (thanks to the team for adding a plugin outlet a few days ago!) ā†©ļøŽ

26 Likes

haha this is awesome! trĆØs bien! :star_struck:

10 Likes

I have a feeling that it conflicts with this component Omit Emoji component causing the UI for the one that selects the emoji to not show the componentā€™s magic wand


2 Likes

I donā€™t use that component, but Iā€™m using iPad and drafting has done that couple times now ā€” Iā€™m writing a help for users. Publishing fixes it.

2 Likes

This is amazing! Well done!! :star_struck:

(small nitpick, would ā€œnegativeā€ be a better description than ā€œinvertā€?)

4 Likes

Did you update Discourse? You only receive a notification to update when a new beta is released, but new commits are added every day.

4 Likes

Thanks! :smile:

Youā€™re right; it has been renamed now!

As stated by Moin, you will need to update Discourse.
I looked at the Theme component code and tested it; once you update Discourse, they should work together without issues! :+1:

8 Likes

Hi, I can no longer see the option to add the Emoji Fluff component. Is it still supported?

1 Like

Iā€™ve pushed a partial fix to make it work with the latest Discourse version. However, this fix only addresses the autocomplete feature. :slight_smile:

Currently, I am unable to resolve the issue with the emoji picker. Recently, the team has unified the emoji picker with the chat in DEV: unifies emoji picker by jjaffeux Ā· Pull Request #28277 Ā· discourse/discourse Ā· GitHub. Unfortunately, the plugin outlet in the emoji picker footer, which was previously used to insert a toggle, has been removed in the new version. At this moment, I do not have a solution. Sorry for the inconvenience! :pray:

2 Likes

PR a new one? I believe they welcome such things?

2 Likes

Yes, I will!

Iā€™m still thinking of possible alternatives.
If you look at the new emoji picker, a few spaces are available. You probably donā€™t want to cut the placeholder text, but this is the only space that makes sense:

It might be okay for one icon. But I feel like making a plugin outlet here doesnā€™t seem reasonable. :smile:

2 Likes

Great fun!

Stretch goal:

3D animation :wink:

2 Likes

To answer this, I did here:

One of the good things about the unified emoji picker is that Fluff will work with chat!

The image shows a chat message at 2:20 PM from a user named "arkshine" containing an Easter egg and a grinning face emoji. (Captioned by AI)

Hopefully, the PR will get some attention!

By 3D animation, do you mean pure CSS with 3D transformation?
Like that:
The image displays a screenshot of a text formatting interface with a highlighted shortcut command for horizontal flipping of an image, accompanied by an emoji with a neutral expression. (Captioned by AI)

3 Likes

No, I meant a fully 3D effect of someone shaking their head which of course is not trivial.

Possibly better addressed by using stickers?

3 Likes

More like that then?

chrome_Xmd6KEmSLH


EDIT:

Oh, @merefield, I see what you mean by Plugin for animated stickers!

I guess that would be out of the scope for this TC. It would not be easy to find the 3D version of every emoji.

I really like the falcoā€™s sticker idea!

4 Likes