-
Notifications
You must be signed in to change notification settings - Fork 25
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
Remove deletion delay when themes don't animate/transition outgoing messages #98
Comments
do animations fire a |
@fimion Animations fire an We're using both From // Give animation a chance
messageToDelete.addEventListener(
'transitionend',
_callbackRemoveMessageFromDom
);
messageToDelete.addEventListener(
'animationend',
_callbackRemoveMessageFromDom
);
// If no animation, delete anyways
setTimeout(_callbackRemoveMessageFromDom, 1200); In case of no animation/transition, or an animation/transition that takes too long, we have that The The trouble here is in cases where themes don't supply a "deleting" animation/transition, meaning that the overlay will wait a full 1.2 seconds to make time for an animation/transition that isn't happening. |
use |
Also, context on why 1.2 seconds: I figured the absolute longest a "deleting" message should take should be one second. Ideally, deletions would take even less time — since oftentimes, the goal is to clear up space or remove spam and bigotry, and so the goal should be to make sure the message GTFOs. With a 1 second max deletion time, I gave an extra 0.2 sec as a bit of a buffer — hence 1.2 seconds. |
@fimion I think this could work! Any chance you'd be interested in (and available for) spinning up a PR? |
let me take a look at it, because this would also potentially mess with anything that has a transition/animation for insertion or whatever. |
For sure. For what it's worth, now that we've established |
we might also need to set up full FLIP style classes for things so that it is easier to handle transitions/animations |
Not knowing anything about FLIP, would setting up a FLIP approach like that still afford the stylesheet full control over the entrance/exit animations? (i.e. themes don't have to modify the JavaScript to get custom animations?) |
correct. the idea behind FLIP is First Last Invert Play. (this is how the vue transition component works.) Basically, we give 3 classes/attributes for animation/transition.
the implementation works as follows: apply both the Let me see if I can get more information about the best way to listen for this. |
Iiiinteresting. I'd be open to exploring this! |
Originally posted by @NickyMeuleman in #91 (comment)
In #91, showmy.chat added an API to animate messages as they were being deleted (
data-twitch-message-display-status="deleting"
). However, this meant that we couldn't remove messages immediately — we had to apply the style hook, wait a bit (1.2 seconds), and then delete.This works great for themes that have outgoing message animations, but it introduces a delay when no animations are used — the overlay user says "remove messages after 5 seconds," and the overlay actually removes them after 6.2 seconds. This isn't noticeable after a long enough message lifespan (the difference between 20 seconds and 21.2 seconds isn't especially profound). However, it would be nice if we could tighten the gap between when the user says to remove messages and when we actually remove them in the case that the theme doesn't animate outgoing messages.
Themes could use either CSS transitions or CSS animations to animate an outgoing message. To detect animations, we've found the
getAnimations
method, which landed in Chrome 84. With Twitch streamers forced to update their OBS instances soon to continue streaming to Twitch, using>75
Chrome APIs is on the table, but I'd like to give it a few months before we start using>75
APIs just to be safe.The text was updated successfully, but these errors were encountered: