Skip to content
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

[Proposal] Shiny Mixin for PokemonSprite #3

Open
1 of 3 tasks
NoelDavies opened this issue Aug 20, 2024 · 0 comments
Open
1 of 3 tasks

[Proposal] Shiny Mixin for PokemonSprite #3

NoelDavies opened this issue Aug 20, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@NoelDavies
Copy link

NoelDavies commented Aug 20, 2024

Shiny Mixin for PokemonSprite

Summary`

Potential reusable Shiny particle animation (canvas)

Motivation

To better convey and more obviously communicate the instance of a shiny pokemon

Detailed design


function shine(){
  if (!particles.length){
    for (var i = 0; i < 5; i++) setTimeout(addSparkles, i * 100);
    drawer = setInterval(drawSparkles, 50);
    setTimeout(stopDrawing, 1000);
  }
}

function addSparkles(){
	for (var i = 0; i < 8; i++) particles.push({ "scale": 1, "radius": 60, "angle": 45 * i });
}

function drawSparkles(){
	ctx.clearRect(0, 0, 256, 256);
	for (p of particles){
      var x = 128 + p.radius * Math.cos(p.angle * Math.PI / 180);
      var y = 128 + p.radius * Math.sin(p.angle * Math.PI / 180);
      var scaled = Math.max(32 * p.scale, 0);
      ctx.drawImage(sparkle, x - scaled / 2, y - scaled / 2, scaled, scaled);
      if (p.scale > 0.6) p.scale -= 0.2;
      else p.scale -= 0.05;
      p.angle -= 5;
      p.radius += 5;
    }
}

Drawbacks (optional)

More potential workload on streamer/user's GPU whilst potentially streaming (would need to include the option to disable GPU rendering / fancy gpu-intensive stuff like this)

@NoelDavies NoelDavies added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant