[HN Gopher] Faces.js, a JavaScript library for generating vector...
       ___________________________________________________________________
        
       Faces.js, a JavaScript library for generating vector-based cartoon
       faces
        
       Author : starkparker
       Score  : 179 points
       Date   : 2024-04-06 18:37 UTC (4 hours ago)
        
 (HTM) web link (zengm.com)
 (TXT) w3m dump (zengm.com)
        
       | thatha7777 wrote:
       | i love this
        
       | gkoberger wrote:
       | Very cool. Here's another style! https://getavataaars.com/
        
       | throwaway35777 wrote:
       | import { display, generate } from "facesjs";              //
       | Generate a random face         const face = generate();
       | // Display in a div with id "my-div-id"         display("my-div-
       | id", face);
       | 
       | Beautiful API.
        
         | xg15 wrote:
         | As beautiful as the faces.
        
           | throwaway35777 wrote:
           | The faces are amazing! I hope if he finds an artist they
           | don't get changed too much.
           | 
           | I absolutely am looking for an excuse to use faces.js
           | somewhere.
        
       | xg15 wrote:
       | Has a bit of a South Park and/or Futurama vibe to it, but why
       | not?
        
         | rasso wrote:
         | Exactly, why not! Love it.
        
       | krebby wrote:
       | This would be fun to use with Chernoff Faces
       | https://en.m.wikipedia.org/wiki/Chernoff_face
        
         | winwang wrote:
         | Thank you for evangelizing -- this is amazing and kinda
         | hilarious. Does it count as biohacking? lol.
        
       | af3d wrote:
       | Well, I didn't find the art very appealing. But I do love the
       | idea behind it. Neat project!
        
       | ramijames wrote:
       | This is adorable.
        
       | cmgriffing wrote:
       | Really cool. I would love to see an api for just passing a
       | numeric seed value. Then users of an app can click a "refresh"
       | button to get one they like that could persist across page loads
       | and devices without having to store the entire face object in the
       | db.
        
         | cypressious wrote:
         | You could serialize the JS representation to Base64 or Base10
         | if you want it to be numeric.
        
           | wongarsu wrote:
           | But that's a lot more data than just storing which of the
           | ~2^50 possible faces was generated. You could serialize the
           | entire face including the colors and scaling factors into a
           | much smaller string, or just take one number that is used as
           | a seed for a random number generator that sets the other
           | parameters
        
       | hacker_88 wrote:
       | Back in the day out used to be called NFT
        
       | toisanji wrote:
       | very cool. Are there libraries like these that do whole
       | characters with bodies? Would love to play with those!
        
       | rented_mule wrote:
       | Someone I know has done some work to parameterize facial
       | expressions: https://www.redblobgames.com/x/1845-face-generator/
       | 
       | He has a bunch of other interesting things like this, too:
       | https://www.redblobgames.com/
        
         | jlturner wrote:
         | This is pretty common in 3D work. Blender has a feature called
         | "blend shapes" that implements a similar interface, and is
         | commonly used for complex facial animation and general model
         | parameterization.
        
           | Tijdreiziger wrote:
           | Duolingo did a talk at their Duocon conference about how they
           | use parametrization to animate the characters in their app.
           | 
           | https://www.youtube.com/watch?v=fgOqvyPif3g
           | 
           | (no affiliation)
        
         | sabellito wrote:
         | Their post on Polygonal Map Generation for Games [1], from
         | 2010, got me into procedural generation in general.
         | 
         | [1] http://www-cs-students.stanford.edu/~amitp/game-
         | programming/...
        
       | outime wrote:
       | I liked it a lot, including the README. The author seems to be an
       | indie dev who creates sport management sim games [1], all of
       | which run entirely in the browser like the linked library (which
       | is used in the games).
       | 
       | [1] https://zengm.com/
        
       | Joel_Mckay wrote:
       | Very fun little project. Nice =)
        
       | SiempreViernes wrote:
       | Aww, it's not making Chernoff faces :(
       | 
       | (https://en.wikipedia.org/wiki/Chernoff_face)
        
       | DyslexicAtheist wrote:
       | they should have called it "4 non blondes" because there are no
       | blonds
        
       | jszymborski wrote:
       | When are the Faces.js NFTs going for sale? /s
        
       | daltonlp wrote:
       | If you like that, you may also like:
       | 
       | https://pixelfaces.io/
        
       | ezequiel-garzon wrote:
       | Apologies for such a basic question. I have node installed on my
       | machine, but clearly no idea how a JS library is included anymore
       | (among other things...). I created an HTML file, included a div
       | ``a div with id "my-div-id"`` as instructed, and even added
       | type="module" in the script tag, but I get in Chrome ``Uncaught
       | TypeError: Failed to resolve module specifier "facesjs". Relative
       | references must start with either "/", "./", or "../".``
       | 
       | Any pointers on all the steps to running this? Should I expect
       | node to create a js file that could be served together with the
       | HTML file? Or would my hosting server need to have node, and run
       | it every time there is a request? Thanks in advance, I'm sorry
       | for the confusion.
        
       ___________________________________________________________________
       (page generated 2024-04-06 23:00 UTC)