extensions icon indicating copy to clipboard operation
extensions copied to clipboard

New Extension: Particle Engine

Open SharkPool-SP opened this issue 1 year ago • 40 comments

Create Powerful Particle Engines with NO Clones

https://github.com/user-attachments/assets/459d44a6-9f02-4d2a-97c5-80be29173808

https://github.com/user-attachments/assets/8d0669f7-7c75-4ab7-9bbd-71c6df2a309d

SharkPool-SP avatar Oct 15 '24 07:10 SharkPool-SP

Peak!!

BludIsAnLemon avatar Oct 15 '24 08:10 BludIsAnLemon

Two questions I have:

  1. Does high quality pen affect rendering quality?
  2. I've noticed that a lot of your extensions have gradient blocks. This looks cool, but the way you're implementing it with the patch is very weird. I think it'd be sick if we could use CSS colors and gradients as the color values for blocks instead of just hex values. How involved in the scratch-gui would it be to be able to do this?

Brackets-Coder avatar Oct 15 '24 12:10 Brackets-Coder

yes

circledude64 avatar Oct 15 '24 12:10 circledude64

WOW! a new particle engine with no clones! that's great for performance and now overflow your projects with clones! (even if i use clones, a lot)

hammouda101010 avatar Oct 15 '24 14:10 hammouda101010

Two questions I have:

  1. Does high quality pen affect rendering quality?

  2. I've noticed that a lot of your extensions have gradient blocks. This looks cool, but the way you're implementing it with the patch is very weird. I think it'd be sick if we could use CSS colors and gradients as the color values for blocks instead of just hex values. How involved in the scratch-gui would it be to be able to do this?

  1. no, this is not a "pen" canvas, to change quality, you'd need to use the set stage size block, but it comes at a cost of lower performance.

  2. The gui doesn't allow gradients in blocks at all. So I can't simply just put it in the extension block code. So I have to use the patch.

Additionally, blocks in the editor are all SVGs, which means you can't color them with any html property. You have do what I do and make SVG gradients or patterns.

SharkPool-SP avatar Oct 15 '24 14:10 SharkPool-SP

Two questions I have:

  1. Does high quality pen affect rendering quality?
  2. I've noticed that a lot of your extensions have gradient blocks. This looks cool, but the way you're implementing it with the patch is very weird. I think it'd be sick if we could use CSS colors and gradients as the color values for blocks instead of just hex values. How involved in the scratch-gui would it be to be able to do this?

well, i just ~~stole~~ borrowed code for you to use the patch:

   function add2Body() {
    var svg = document.createElement("div");
    svg.innerHTML = \`<svg><defs>
      <linearGradient x1="100" y1="0" x2="100" y2="200" id="SPpartEngine-GRAD1" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0090ff"></stop><stop offset="50%" stop-color="#0000ff"></stop></linearGradient>
      </defs></svg>`;
    document.body.appendChild(svg);
  }
  if (Scratch.gui) Scratch.gui.getBlockly().then((SB) => {
    add2Body();
    if (!SB?.SPgradients?.patched) { // Gradient Patch by 0znzw & SharkPool
      SB.SPgradients = {gradientUrls: {}, patched: false};
      const BSP = SB.BlockSvg.prototype, BSPR = BSP.render;
      BSP.render = function(...args) {
        const res = BSPR.apply(this, args);
        let category;
        if (this?.svgPath_ && this?.category_ && (category = this.type.slice(0, this.type.indexOf("_"))) && SB.SPgradients.gradientUrls[category]) {
          const urls = SB.SPgradients.gradientUrls[category];
          if (urls) this.svgPath_.setAttribute("fill", urls[0]);
        }
        return res;
      }
      SB.SPgradients.patched = true;
    }
    SB.SPgradients.gradientUrls["SPpartEngine"] = ["url(#SPpartEngine-GRAD1)"];
  });

hammouda101010 avatar Oct 15 '24 16:10 hammouda101010

Two questions I have:

  1. Does high quality pen affect rendering quality?
  2. I've noticed that a lot of your extensions have gradient blocks. This looks cool, but the way you're implementing it with the patch is very weird. I think it'd be sick if we could use CSS colors and gradients as the color values for blocks instead of just hex values. How involved in the scratch-gui would it be to be able to do this?

well, i just ~stole~ borrowed code for you to use the patch:

function add2Body() { var svg = document.createElement("div"); svg.innerHTML = <svg><defs> <linearGradient x1="100" y1="0" x2="100" y2="200" id="SPpartEngine-GRAD1" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0090ff"></stop><stop offset="50%" stop-color="#0000ff"></stop></linearGradient> </defs></svg>; document.body.appendChild(svg); } if (Scratch.gui) Scratch.gui.getBlockly().then((SB) => { add2Body(); if (!SB?.SPgradients?.patched) { // Gradient Patch by 0znzw & SharkPool SB.SPgradients = {gradientUrls: {}, patched: false}; const BSP = SB.BlockSvg.prototype, BSPR = BSP.render; BSP.render = function(...args) { const res = BSPR.apply(this, args); let category; if (this?.svgPath_ && this?.category_ && (category = this.type.slice(0, this.type.indexOf(""))) && SB.SPgradients.gradientUrls[category]) { const urls = SB.SPgradients.gradientUrls[category]; if (urls) this.svgPath.setAttribute("fill", urls[0]); } return res; } SB.SPgradients.patched = true; } SB.SPgradients.gradientUrls["SPpartEngine"] = ["url(#SPpartEngine-GRAD1)"]; });

I've already looked at the code, but I don't intend to use it for my extensions. Thank you anyway though.

Brackets-Coder avatar Oct 15 '24 16:10 Brackets-Coder

Two questions I have:

  1. Does high quality pen affect rendering quality?
  2. I've noticed that a lot of your extensions have gradient blocks. This looks cool, but the way you're implementing it with the patch is very weird. I think it'd be sick if we could use CSS colors and gradients as the color values for blocks instead of just hex values. How involved in the scratch-gui would it be to be able to do this?
  1. no, this is not a "pen" canvas, to change quality, you'd need to use the set stage size block, but it comes at a cost of lower performance.
  2. The gui doesn't allow gradients in blocks at all. So I can't simply just put it in the extension block code. So I have to use the patch.

Additionally, blocks in the editor are all SVGs, which means you can't color them with any html property. You have do what I do and make SVG gradients or patterns.

Interesting. I was just curious as to if we could change the scratch-gui repo to add some sort of functionality for gradients and CSS colors in the block color APIs, but I guess not - It didn't occur to me that the SVGs can't use CSS gradients. Maybe we could use this patch though, and manually inject the colors into the patch? IDK, it's just an idea. Probably won't be done though. What might be more possible is expanding the customizable block colors addon to allow for gradients.

Brackets-Coder avatar Oct 15 '24 16:10 Brackets-Coder

Theres now an interpolation option! :)

SharkPool-SP avatar Oct 30 '24 21:10 SharkPool-SP

!format

CubesterYT avatar Apr 21 '25 22:04 CubesterYT

!format

SharkPool-SP avatar Apr 21 '25 23:04 SharkPool-SP

Rewritten in WebGL! This is now much faster and efficient :)

image

SharkPool-SP avatar Apr 21 '25 23:04 SharkPool-SP

!format

SharkPool-SP avatar Apr 21 '25 23:04 SharkPool-SP

!format

SharkPool-SP avatar Apr 23 '25 05:04 SharkPool-SP

blending blocks! image

SharkPool-SP avatar Apr 23 '25 05:04 SharkPool-SP

!format

SharkPool-SP avatar Jul 18 '25 05:07 SharkPool-SP

!format

SharkPool-SP avatar Jul 18 '25 06:07 SharkPool-SP

No offense but I genuinely don't think this will ever get merged Still a peak extension, though

LSPECTRONIZTAR avatar Jul 18 '25 12:07 LSPECTRONIZTAR

!format

SharkPool-SP avatar Aug 05 '25 22:08 SharkPool-SP

!format

SharkPool-SP avatar Aug 27 '25 04:08 SharkPool-SP

@SharkPool-SP okay I'll review when I can

Brackets-Coder avatar Sep 18 '25 17:09 Brackets-Coder

Basically just remove the text from the banner then I guess we're good to merge this peak

Brackets-Coder avatar Sep 18 '25 18:09 Brackets-Coder

Basically just remove the text from the banner then I guess we're good to merge this peak

I think documentation can be saved for another time, the blocks are in order of usability. So it should be easy to pickup. It works closely to the geometry dash particle engine as well.

We can always go back and add it if need be

SharkPool-SP avatar Sep 18 '25 18:09 SharkPool-SP

Basically just remove the text from the banner then I guess we're good to merge this peak

I think documentation can be saved for another time, the blocks are in order of usability. So it should be easy to pickup. It works closely to the geometry dash particle engine as well.

We can always go back and add it if need be

In my testing it didn't take me long to figure out but I couldn't get engines working on sprites, only the stage? Maybe I was doing something wrong

Brackets-Coder avatar Sep 18 '25 19:09 Brackets-Coder

Basically just remove the text from the banner then I guess we're good to merge this peak

I think documentation can be saved for another time, the blocks are in order of usability. So it should be easy to pickup. It works closely to the geometry dash particle engine as well.

We can always go back and add it if need be

In my testing it didn't take me long to figure out but I couldn't get engines working on sprites, only the stage? Maybe I was doing something wrong

Wdym. The engines don't follow sprites, they're just attached to them

SharkPool-SP avatar Sep 18 '25 19:09 SharkPool-SP

Wdym. The engines don't follow sprites, they're just attached to them

No, I meant I for some reason couldn't get them working when attached to a sprite, I rushed through it so I must've done something wrong

Brackets-Coder avatar Sep 18 '25 20:09 Brackets-Coder

Wdym. The engines don't follow sprites, they're just attached to them

No, I meant I for some reason couldn't get them working when attached to a sprite, I rushed through it so I must've done something wrong

Maybe you didn't make an emitter for that engine?

SharkPool-SP avatar Sep 18 '25 20:09 SharkPool-SP

Maybe you didn't make an emitter for that engine?

Oops I got it working sorry

Brackets-Coder avatar Sep 18 '25 21:09 Brackets-Coder

Yeah just change the banner and we should be good to go

Brackets-Coder avatar Sep 18 '25 21:09 Brackets-Coder

Is that a gradient for the block colors? Looks really nice.

PPPDUD avatar Sep 18 '25 21:09 PPPDUD