question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Canvas is not clearing, generative images are overlapping

See original GitHub issue

I’m having a problem where the output images are on top of each other. For Example: First generated image is wearing a black hat. Second generated image is generated with no hat but the black hat from image one is still showing.

I have tried : ctx.clearRect(0, 0, canvas.width, canvas.height); but have had no luck as I’m not sure where it has to go.

I have been following the tutorial on youtube Code generative art for NFT in node.js .

Thank you.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

1reaction
Jubakeecommented, Nov 30, 2021

for(let i = 1; i <= edition; i++){ ctx.clearRect(0, 0, canvas.width, canvas.height); for (const layer of layers) await drawLayer(layer, i); console.log("Creating edition " + i);

};

This works for me. 😁✌️

On Wed, 1 Dec 2021 at 8:51 AM, Marssurterre @.***> wrote:

I have the same problem if you found the solution help me 🙏

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HashLips/generative-art-node/issues/111#issuecomment-982966588, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWRSAI6GQZOTESRGDFTPEWLUOUTMFANCNFSM5IZPJUXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

0reactions
uniteXandercommented, Jan 27, 2022

It stopped doing this with your edits! Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js Canvas image overlapping issue / canvas is creating ...
I can create the .png files fine but the first image or the image before is not being cleared. index.js const fs =...
Read more >
Code generative art UPDATE 2 - YouTube
In this update, we take a look at how to solve the overlapping layers issue as well as the unique ID problem that...
Read more >
How to position images within a canvas while avoiding ...
Suppose that you can fit a new image to the canvas. Move the image to the left as far as possible. You either...
Read more >
Creating Generative Patterns with The CSS Paint API
A little familiarity with generative art and some knowledge of the Paint API/HTML canvas will be handy but not essential.
Read more >
An Evolutionary Approach to Generative Art - onlygenerated
Canvas Background. All images begin with a very basic gradient of randomly chosen colors. Most of the time, this gradient is covered by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found