HNHacker News
TopNewBestAskShowJobs

shaneos

676 karma · joined April 23, 2012

submissionscomments
shaneos··on Instant flood fill with HTML Canvas
Wordpress' free tier sucks alright. However, I have nothing against ads per se, just ads shown to children. Maybe I'll start giving Wordpress money after all these years of them hosting my blog.....

So no, not hypocritical. Ads are fine, just keep them away from young kids.

shaneos··on Instant flood fill with HTML Canvas
Thanks for the great write up - pull requests are welcome.
shaneos··on Instant flood fill with HTML Canvas
If you're referring to my blog, sorry yeah I use the free Wordpress plan and they stick those ads there for themselves :-(. The app has no ads though, which is important when it's for kids
shaneos··on Instant flood fill with HTML Canvas
https://excalidraw.com !! Such an amazing app, free and open source
shaneos··on Instant flood fill with HTML Canvas
Thanks - that toddler-games.com is really nice. It’s so simply done that even a two year old could enjoy it for hours. My kids are 5 and 7 now so want something a bit more advanced, but I wish I’d found that a few years ago
shaneos··on Instant flood fill with HTML Canvas
If you are right that would be amazing! The demo code is open source, please send a PR with such a flood fill implemented.

The requirement is that when the user clicks on a 2k x 2k image it takes 50ms or less, running on a cheap Android tablet. If a better algorithm, perhaps implemented in wasm, can achieve this, I’d love to discard all my complex code and just use it

shaneos··on Instant flood fill with HTML Canvas
The user can select from thousands of colours unfortunately :-) Tap the top left icon in the app, or just play with it for fun! https://kidzfun.art
shaneos··on Instant flood fill with HTML Canvas
Yes, ignoring the palm resting on the screen is essential. Doing that along with allowing zooming and pen input takes some creative thinking. It’s non trivial
shaneos··on Instant flood fill with HTML Canvas
Thanks, I’ll take a look at the article. This generally sounds very similar to my pre processing algorithm, setting the id of the enclosing area into each pixel so a fast/instant operation can be applied. Am I missing something though? In my solution, the only thing that happens when the user clicks is a fillRect() call. Is your suggestion similarly fast on click?
shaneos··on Instant flood fill with HTML Canvas
Thanks for the link, it’s great write up. I’ll play with his algorithm to see how it works for me, it may speed up the pre-processing. Its still slower to the user than using the pre generated masks however
shaneos··on Instant flood fill with HTML Canvas
Author here: I'm loving all the suggestions of ways that this might be achievable in either a faster or simpler method! The code is open source at https://github.com/shaneosullivan/example-canvas-fill and I'd love to see you hackers improve on it and share it with everyone. Any and all improvements I'll happily use going forward in my app.
shaneos··on Instant flood fill with HTML Canvas
Very cute! I started out with basically this, and my kids kept asking me for more and more features :-). Recently they asked to make animations, and that took a chunk of time to get right. I'm looking forward to whatever they ask for as they grow more advanced!
shaneos··on Instant flood fill with HTML Canvas
I wasn’t calling per pixel :-) even when just visiting each pixel once it would still take 50 - 100ms to fill a large image which the user perceives as lag. I wanted it to be instant
shaneos··on Instant flood fill with HTML Canvas
Not trolling. I haven’t played with wasm at all. Perhaps if it can fill a 2k x 2k pixel image super fast it would be indistinguishable from my solution. If someone had coded this and open sourced it I’d love to use it
shaneos··on Instant flood fill with HTML Canvas
The speed is achieved by using the fillRect() command with globalCompositeOperation. This is a single draw operation rather than a per pixel algorithm while the user waits. Anything more involved than this would, I think, be slower as perceived by the user
shaneos··on Instant flood fill with HTML Canvas
If a wasm algorithm can run in under 16ms for arbitrarily large images that would be amazing. Hard to beat pre-computing all possible fills however, as the user perceives it as instant.

If you’ve seen a really fast wasm solution I’d love to replace the fill portion with it though.

shaneos··on Instant flood fill with HTML Canvas
There’s a trade off between speed and showing progress to the user. I find it better to show slow progress rather than wait 500 - 1000ms to do it faster, but it depends on the use case
shaneos··on Instant flood fill with HTML Canvas
It can be made work. Precompute the image when the flood fill tool is activated and it’s fine, since you only have to do it once
shaneos··on Instant flood fill with HTML Canvas
Author here: in the app I use that, it seems to help alright
shaneos··on Using Bun.js as a Bundler
Yes, this is correct. All the canvas stuff has nothing to do with React, so I bundle it all separately. In fact, I don't even load React on the browser, I just render the initial page with it on the server then just work with the DOM from there on out. It greatly reduces the amount of JS shipped to the client, and since 90% of my code was going to be Canvas related, it's not much overhead to add a few click listeners for various DOM nodes
shaneos··on Using Bun.js as a Bundler
Glad you like it :-). I'm planning to write a few blog posts about how it's built, there's some fun stuff in there - the first one will probably be about how I make the paint bucket fill operation be instantaneous, that was an interesting problem to solve

Now, go make some Gifs in the Animation section!

shaneos··on Using Bun.js as a Bundler
Yes, Bun is very much in beta, but it's already really, really good. I'm fine using it with my hobby projects right now, but once it gets to 1.0 I'll give serious consideration to using it in production code too. The API is really simple, and I love how it just understands Typescript, so you can throw any code in your repo at it and it chugs away happily.
shaneos··on Using Bun.js as a Bundler
It’s the project I integrated Bun with as a bundler, thereby running into all these issues. I figured that others would hit the same problems so write this post about how to work around them
shaneos··on Using Bun.js as a Bundler
Glad to hear it! My kids love it which keeps me working on it. Having your ideal testers living with you is an amazing plus :-)
shaneos··on SwissGL: Swiss Army Knife for WebGL2
The example in the README seems to be dividing “undefined” by 1000. Am I misunderstanding something, does that code truly generate the output shown somehow?
shaneos··on Show HN: Sudoku with 0 Bells or Whistles
Another shameless plug - I built a multiplayer sudoku game where you and multiple others can compete to finish the game first. It's a web app at https://countdoku.app/
shaneos··on Tamagui 1.0 – Cross-platform React apps in less time, with better performance
Reading the docs, there seems to be a large amount of magical component creation going on that I find difficult to read. A key benefit of React is the simplicity of a component accepting props and using them in its render function. This library seems to dynamically create a component with a custom configuration language such that it requires a lot of thought to understand what is actually going on. It defines newly available props and their usage differently to other React components, reducing readability considerably.

Of course a person can get used to these things, but I question whether it scales to non-tiny teams. There’s a real smell of ye olde dynamic class creation here which React moved away from for very good reasons

shaneos··on Korea shatters its own record for world’s lowest fertility rate
This is very accurate. I’m Irish, and when my Korean wife and I were leaving the US with our two young kids, Korea wasn’t even considered as a place to raise them. She had such a needlessly tough time as a kid, and her siblings are having to put their young kids through exactly the same exhausting upbringing.

It’s not worth it. We’re luckily to have the choice of moving home to Europe and raising our kids in a way that they get to play a lot (I’m writing this while on a bench in a playground with them bouncing around in the sunshine) and also have school, art and sports.

Korea is actively discouraging Koreans from raising their kids there, especially if they have any other option

shaneos··on Twitter CEO Parag Agrawal on whistleblower story
Given Mudge's stellar professional history, and having worked near (not with) him for a short while, I certainly would take his word over the current Twitter leadership.
shaneos··on Show HN: I restored Palm's webOS App Catalog, SDK and online help system
I remember you well!! I think my app Mazer came in second in the free category. Such happy, simpler times

https://appcatalog.webosarchive.com/showMuseumDetails.php?se...

← PreviousPage 2 of 4Next →