-
Notifications
You must be signed in to change notification settings - Fork 362
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
New addon: blur background #7250
base: master
Are you sure you want to change the base?
Conversation
2024-03-05.11-21-24.1.mp4Demo of it happening. |
I once made something like this! The fade-in/out effect looks pretty cool. |
Oh you did? What happened to it? I'd like to see your implementation of it And why thankyou, got the idea for the fade from a Minecraft mod lol, I think it just looks really nice |
I never opened a pull request, but it was part of an addon I made with multiple modal enhancements. The way I did it was by adding some style rules to the modal backdrop which meant there wasn't a fade out animation for closing the modal, which is why I like your implementation. |
I actually thought of doing it that way too but decided not to, and I am curious about what other things you had in this addon? Maybe DM me cuz this is getting a bit off topic |
It's too small to be an addon imo. This addon should either be merged with another addon or not made at all. |
cough cough resizable-comment-input cough but yes, it is small, and I know i keep bringing this up but this would work GREAT for @RedGuy12 and I's tweaks idea |
Yeah I'm really thinking that needs to become a thing because I want this addon but at the same time I agree it's small |
I'm biased but I do think so too, I'm not smart enough yet to think about starting that myself but yeah, it really is a great idea |
Editor dark mode already has a setting for the color of the modal backdrop, so this could be moved there. |
Yeah I can get behind that, anyone else just drop a like on this message and I'll do that (I still stand by the tweaks idea) |
I believe there should be an addon called aesthetic-enhancements and it should contain at least like 5 different enhancements that solely improve scratch's look (subjectively), where more can be added to later. This is perhaps the same as the "tweaks" idea previously mentioned. This is not to do with dark mode so it shouldn't go there. Once this aesthetic -enhancement addon has enough mini-addons (again I think 5 is enough) it can be released. perhaps there are other PR's / issues which were previously closed for being too small which could be put in this. |
That's pretty much the idea for tweaks, in a nutshell, they are an idea for SA 2.0 which contains small changes which no one would have a problem having on. Things like bug fixes and small changes like these. I'm sure there are a LOT of addons that would work better as a tweak rather than their own addon, and it also opens the door for more tweak-sized things to be made. The idea of tweaks is that they do not interrupt functionality, and can all be enabled by default, with little to no downsides. Things like this blur, ctrl + enter to post comments, and a lot more things would suit it well. |
instead of 1 addon called "tweaks" there should be three addons: bug-fixes, aesthetic-enhancements, ux-enhancements. (alternatively aesthetic-tweaks, ux-tweaks), and, except for bug fixes, it shouldn't be enabled by default, because who are we to subjectively decide what experience is best for scratch users. |
Well it's not an addon, that's the whole point, it's whole other section dedicated to them, but yes I believe that was in our plans. Idk there might be an issue somewhere for tweaks, can't remember. |
By just using CSS on the existing overlay I was able to get a nicer fade in animation that also works on the modal itself. The problem and probably the reason you didn't do that is because there's no way to fads it out since it's removed from DOM. |
Yeah, that's what I ran into as mentioned earlier. But what if we made that backdrop transparent and then put our own behind it, or reuse a parent element of the modal? That should allow us to add a proper fade-out animation, and this PR already does that for the blur effect. |
As for making a general aesthetic enhancements addon, one thing I would propose is an option to make buttons more rounded. We should make an issue before we go off-topic here. |
Are we talking about fading that overlay out too as well as this blur? That could be cool.. someone give me the green light and I'll work on that, I should be able to just make the current overlay go bye bye, add the colour to the blur overlay. The only thing I need is... How the hell do I use custom CSS variables? I do not understand them at all lol, I've tried learning about them but I do not understand them very well, if anyone can DM me a link or an explanation please do. |
For just using your settings in CSS: Generating new CSS variables based on those settings is a little more complicated: https://scratchaddons.com/docs/reference/addon-manifest/#customcssvariables |
And variables from other addons? I would use the overlay colour from the editor colours addon yeah? (And thankyou) |
Yeah, and you can just reference that normally. Iirc, |
Oh I didn't realise they would be in the global scope, sweet, thanks Paul |
@Jazza-231 There's a slight delay when opening a pop up for the blur to come, it looks very odd. |
I don't believe I can do anything about this, I'm using the Redux event (edit, no I'm not??? Uhm I'll look at it) |
I dont think i can do anything, the delay seems to just be caused by the transition |
export default async function ({ addon, console }) {
const overlay = document.createElement("div");
overlay.classList.add("sa-blur-overlay");
document.body.insertBefore(overlay, document.body.firstChild);
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
const modalOverlayExists = document.querySelector(".ReactModal__Overlay");
overlay.classList.toggle("blur", modalOverlayExists);
});
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
} This doesnt use a while true loop and delay, instead it uses a mutation observer. |
And does this work faster? |
Yes, the event is instant now. But the blur has transition effects while the popup does not which makes an illusion like it's slow. but of course faster than the current one you have. |
Transition effects to the pop-up would only work for fading in, not out as the pop-up is removed from the dom |
Adding fade-out on closing isn't a matter cause as no one is gonna notice it. |
Have a setting in editor dark mode, since that's where the background colour is controlled. |
A setting for....? |
Consider sharing a video cause it's way better now, most people dont actually clone the branch and test it. |
"description": "Blurs the background when you are creating a new variable, list, or custom block.", | ||
"tags": ["theme", "editor", "codeEditor"], | ||
"versionAdded": "1.37.0", | ||
"credits": [{ "name": "Jazza", "link": "https://scratch.mit.edu/users/greeny--231" }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jazza-231 Mind crediting me for the faster method?
"credits": [{ "name": "Jazza", "link": "https://scratch.mit.edu/users/greeny--231" }], | |
"credits": [ | |
{ "name": "Jazza", "link": "https://scratch.mit.edu/users/greeny--231" }, | |
{ "name": "Waakul", "link": "https://scratch.mit.edu/users/Waakul" } | |
], |
I assume turning this addon into a setting in editor-dark-mode. |
What does blur background on popup have to do with editor dark mode lmao. |
(editor-dark-mode is Editor dark mode and customizable colors, and it already has a "Show workspace dots" setting so it isn't just for customizing colors.) |
ik?, but it has nothing to do with blurring the background on a popup |
This entire addon, but as a setting in Editor dark mode and customizable colors. |
Background colour is already there. |
You are no longer using interval loops, edit it. |
So, is the general consensus that this should be moved there?
What? |
you are no longer using interval loops, so change it in the desc of this pr (you mentioned there you are using interval loops) |
This PR already contains dozens of comments. It would have been nicer to create an issue first. |
I always do that don't I |
observer.observe(document.body, { | ||
childList: true, | ||
subtree: true, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure running a querySelector each time there's any change on the body would hurt performance, specially inside the editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hence why I did not go with this method...they seemed quite adamant though and I didn't feel like arguing
Can we get an update on this? I'm ok if its put on the backburner until (I will literally never stop talking about this idea) tweaks, as it really does fit better there |
Resolves community suggestion
Changes
Adds an overlay that shows when a new variable, list, or custom block is created to blur the background
Reason for changes
It looks very nice, and just makes scratch more aesthetically pleasing.
Tests
Works fine on brave.
More
It doesn't do much on light mode purely because of the bright blue background overlay. (resolved)
I current check for the modal going away using an interval loop. This isnt great, so if anyone knows the redux event (if it exists) or a better way, please feel free to reveiw this pr. (resolved)