toxi, Example #167, and the very first example showing basic usage of the new https://thi.ng/geom-webgl interop package (still unreleased): Parsing a SVG path, sampling it with uniform vertex density (configurable), converting it into a complex polygon (w/ holes) and then into WebGL buffers (w/ vertex color option enabled), randomizing colors via probabilistic color theme, and — finally — drawing it all...
Demo (reload for new variation):
https://demo.thi.ng/umbrella/geom-webgl-basics/Source code:
https://github.com/thi-ng/umbrella/blob/develop/examples/geom-webgl-basics/src/index.ts#ThingUmbrella #WebGL #SVG #Geometry #Tessellation #Triangulation #DebugArt #TypeScript #Typography #Polygon
#ThingUmbrella
toxi, Testing/debugging the dynamic tessellation feature of the upcoming thi.ng/geom-webgl interop package... This will provide a single polymorphic function to convert https://thi.ng/geom shapes into WebGL binary data & model/attribute specs, with lots of options for memory layout, indexing, instancing and other advanced usage...
By default (and as shown here), polygons are tessellated via ear cutting[1], but users have a choice of 9 other algorithm presets (or their own custom ones), incl. iterative application of multiple tessellation strategies..
[1] https://en.wikipedia.org/wiki/Polygon_triangulation
#ThingUmbrella #WebGL #Geometry #Tessellation #DebugArt #TypeScript #Gems
A random, blobby, triangulated polygon, with each triangle tinted in a random colorful gradient
A random, blobby, triangulated polygon, with each triangle tinted in a random colorful gradient
A random, blobby, triangulated polygon, with each triangle tinted in a random colorful gradient
toxi, Progress...
#ThingUmbrella #WebGL #Geometry #Tessellation #Triangulation #DebugArt #TypeScript
A complex polygon disc with triangular hole, tessellated into hundreds of triangles, each tinted with a randon, iridescent, rainbow colored gradient
A complex polygon disc with triangular hole, tessellated into hundreds of triangles, each tinted with a randon, iridescent, rainbow colored gradient
A complex polygon disc with triangular hole, tessellated into hundreds of triangles, each tinted with a randon, iridescent, rainbow colored gradient
toxi, As part of the work on the upcoming thi.ng/geom-webgl package, today I've also been completely rewriting all tessellators in https://thi.ng/geom-tessellate and extending the package with more features, incl. an adapted version of https://github.com/mapbox/earcut to handle complex polygons (with holes, but can also be combined/nested with all the other tessellators, incl. the non-triangular ones)...
Instead of producing an array of faces (each itself an vertex array), all tessellators are now producing/populating/adding to a single tessellation, consisting of a vertex array and another array of face vertex IDs. This makes the result much more flexible for a number of use cases, incl. WebGL/WebGPU conversion.
Very happy with how the new API for both packages is turning out. The last image shows the source code for generating a single frame of the "SB" anim, starting with parsing two SVG paths, grouping & fitting them into a target bounding rect, then tessellating the entire group, rebuilding a new group from the resulting triangles, and finally serializing everything to SVG. For WebGL, there'll be a single
asWebGLModel()
function which performs shape tessellation automatically behind the scenes (fully configurable, though)...#ThingUmbrella #WebGL #SVG #Geometry #Tessellation #Triangulation #DebugArt #TypeScript #Typography #Polygon
The letter "B" tessellated into dozens of triangles, each tinted with a randon, iridescent, rainbow colored gradient
TypeScript source code snippet to create a single frame of the anim in the previous image: // create paths/shapes from SVG definitions (truncated here) const S = pathFromSvg(
toxi, Added a convolution kernel filtering operator for polygons/polylines to https://thi.ng/geom, incl. some useful preset kernels: box filter, triangle, gaussian, all with configurable size...
The image shows effects of various kernel sizes & iterations. Unlike with subdivision smoothing, here each version has the exact same number of vertices, only their positions are impacted: orange = box, magenta = triangle, blue = gaussian
(For now the operator is only implemented for polygons (also w/ holes) & polylines, but can be extended to other shape types...)
#ThingUmbrella #Geometry #Polygon #Curve #Convolution #Gaussian #TypeScript
jbzfn, 🦾 Functional TypeScript #1: Algebraic Data Types | Injuly
"In functional programming, algebraic types are so ubiquitous that you would be hard pressed to find a language that doesn't support them. Strangely though, nothing about them demands that a language be functional by paradigm. That imperative languages have avoided ADTs for decades seems almost an accident."
toxi, (edited ) Useful snippet for computing pixel dimensions from paper sizes (both metric (DIN) and (US) imperial presets included) using https://thi.ng/units, an elaborate & powerful unit converter/calculator/DSL for all SI dimensions:
Full list of predefined constants:
https://github.com/thi-ng/umbrella/tree/develop/packages/units#constants
nclslbrn, @toxi Great, I saw that another package could do this, glad to see that thi.ng/umbrella already does.
toxi, @nclslbrn Yeah, it's one of the more unknown packages in the collection, but I'm finding myself using it much more often than I thought I would initially... :)
ohmrun, #Haxe still has a better type system than #Typescript, soz.
tanepiper, @ohmrun I loved working with Haxe back in the day - it's a shame it never quite took off the same way
chriskrycho, The first of my two #lambdaconf2024 talks—this one, born out of my experiences with versioning and #TypeScript and #JavaScript over the past 7 years. Script and slides now, video once it’s up! https://v5.chriskrycho.com/elsewhere/cutting-edge-of-versioning/
toxi, Still only on a feature branch, but over the past few days I've been working on updating https://thi.ng/geom to add support for polygons with holes and paths with holes (or more generally support for sub-paths, e.g. multiple curves). Since both of these shape types are containers of multiple geometries and therefore require in some situations (e.g. shape conversions) different handling than the other shapes with a single boundary/geometry, adding support for these also includes updating a dozen or so polymorphic shape operators/functions and unfortunately will involve a few of breaking changes. For instance, some of these functions are returning an array of shapes now, instead of just a single one. Also related, some of the other geom support packages (e.g. https://thi.ng/geom-axidraw, https://thi.ng/geom-sdf) will have to be refactored more and partially have been already (likely only internally, though)...
As part of this work, I've also just added example #160(!!!) to demonstrate & test out some of this new functionality:
Demo:
https://demo.thi.ng/umbrella/geom-complex-poly/Commits:
https://github.com/thi-ng/umbrella/compare/feature/geom-complex-pathsI will of course send another update once this all has been merged & released...
#ThingUmbrella #Geometry #Polygons #Shapes #PoissonDisk #TypeScript #JavaScript #OpenSource
casraf, Help me reach 50 stars! 🙏 🤩
hongminhee, Should I rewrite #Fedify in a programming language other than #TypeScript? 😅
hongminhee, @thisismissem When you say ESM builds, do you mean do the Fedify package published to npm support ESM? If that's what you mean, then yes, it does.
I'm constantly improving the documentation, but it's not easy (especially writing in English as a non-native English speaker). 😅
thisismissem, @hongminhee perhaps that's an area to get beginners involved? Documentation can help people learn the framework & find flaws/rough edges in it.
davidbisset, Extension.js: a plug-and-play, zero-config, cross-browser extension development tool with built-in support for #TypeScript, #WebAssembly, React, and modern #JavaScript.
alexelcu, Async/await in #TypeScript is essentially “direct style”. It will be interesting to see if Effect, a monadic effect system, will take off, as a case study for #Kotlin & #Scala — although for “direct style”, these have the advantage of context parameters.
Profpatsch, Okay, so
After spending some time with #typescript, going back to #haskell is a real hard sell, ngl
BoydStephenSmithJr, @Profpatsch Oof, pass. I got really stoked around typescript for a little while, but they stopped maintaining the spec, and these days I greatly prefer #Purescript if I have to target a browser and have a choice. (It doesn't have a spec either, but I find it a much nicer language.)
At work, we still just do JS, but that's because it's likely to come out of a julius splice from #Yesod.
hongminhee, My short yak shaving journey is over. Lacking a decent logging library, so I created #LogTape and started logging in #Fedify using it, which should make inbox/outbox debugging easier starting with Fedify 0.7.0. ✌️
thisismissem, @hongminhee mildly curious why a well established package like pino (or winston) didn't meet your needs?
davidbisset, Pragmatic drag and drop lib that can be used with any view layer (react, svelte, vue, angular and so on).
Powers Trello, Jira and Confluence.
#TypeScript #JavaScript #opensource
https://github.com/atlassian/pragmatic-drag-and-drop #webdev
aeveltstra, Hey, #typescript devs: is there any way to compile typescript without needing NPM and Node?
Microsoft’s documentation says the easiest way to install tcl is by using NPM. That means they aren’t saying it’s the only way. But it also lacks mention of other ways.
I’m not adverse to building tcl myself if needed, or use different methods for different operating systems.
Please advise!
aeveltstra, @lukem Thank you, I’ll check it out.
aeveltstra, @castarco Thank you!
toxi, For @made and others who might have questions about the new https://thi.ng/transducers-async library, I've tried to illuminate the behind-the-scenes approach over here:
https://github.com/thi-ng/umbrella/discussions/461#discussioncomment-9102966
#ThingUmbrella #Transducers #Async #Generators #TypeScript #JavaScript #FunctionalProgramming
alxd, Time for a #jobSearch post!
I'm looking for a #typeScript / #python / #RustLang 100% #remote #softwareDev position, both contract and permanent, GMT+2 timezone.
I previously worked as a Senior / Lead / Principal #fullStack developer with #cyberSecurity , #softwareArchitecture and #devOps experience.
I specialize in #react , #nodejs , #django , #fastAPI , #pandas , #postgresql , #docker , #kubernetes , #AWS and #digitalOcean .
schizanon,
louisrcouture, French @schizanon typescript is cool but it's annoying sometimes
schizanon, French @louisrcouture typescript is fine as long as I can //@ts it. It's the people who insist that everyone use it that get on my nerves. the extensions you use in your IDE are between you and your god. Don't foist a transpiler on your teammates just to do some fancy linting.
julian, What am I doing this weekend? Learning #TypeScript, #Deno, and @hongminhee's #Fedify all at the same time, for a project which I'm hoping will be used by many people.
What could possibly go wrong? 💪
calisti, TailwindCSS is looking to hire a perfectionist staff software engineer, fully remote, ET - CET timezones, 275‘000 USD.
https://tailwindcss.com/careers/staff-software-engineer
#FediHire #TypeScript #RustLang #NodeJS #React #a11y #TailwindCSS
toxi, Earlier today[1], helped my son with a raycasting issue and then ended up updating/extending the 2D shape intersection function in https://thi.ng/geom, which now also supports ray intersections with nested shape groups/hierarchies (via same single function call) and a new option to return all intersection points found (rather than just the first/closest). Both of these features are shown in a new example project (forthcoming) and in the anim below...
#2D #Geometry #Shapes #Intersection #RayCasting #ThingUmbrella #TypeScript #JavaScript
[1] It also was the first day of the year for us working outside on a bench in the woods, yay!
toxi, Variation on a theme... (see prev toot for context)
#2D #Geometry #Shapes #Intersection #RayCasting #ThingUmbrella #TypeScript #JavaScript
rauschma, 1/ #TypeScript: Common approach for validating untyped data—e.g. Zod: https://2ality.com/2020/06/validating-data-typescript.html
– Encode type via runtime data (“schema”).
– Schema is converted to static type for type-checking.New approach—Typia. https://typia.io/docs/setup/
– Compile static type to (runtime) validation code.
– Downside: Tools don’t work that strip out types and run result.Rust does latter approach well. For TS, I prefer former.
reconbot, @rauschma I love zod and found https://valibot.dev which is zod but functional instead of chaining (and smaller bundle size?)
brawaru, @reconbot I have tried Valibot in the past and it was a pain to write, it very quickly turns into a parentheses hell and Prettier doesn't help it... chaining is a lot more convenient :sad_dog:
That said though, I have honestly completely gave up on those libraries, because they are either pain to set up, or like Zod, completely tank TypeScript's performance doing black magic with types. Perhaps things weren't meant to be strictly validated and writing a custom validator is enough.
joshhunt, Inspired by a recent conversation, I wrote down my thoughts on why Typescript's user-defined type guards are still not safe, and a few alternatives
https://joshhunt.dev/posts/typescripts-user-defined-type-guards-are-not-safe
joshhunt, I'm trying the whole "lets blog" thing that seems to be in vogue now to get better at writing things longer than a single reddit comment. Open to feedback (be kind 🥺) on my writing :)
joshhunt, I posted this on reddit and they didn't like it 😭
schizanon, Typescript is just JavaScript for people who hate freedom.
Agree?
#typescript #javaScript #webDev #web #frontend #programming #softwaredevelopment
atzanteol, @schizanon
Not at all. In computing, however, types are not subjective. JavaScript won't let you add items to an int. Or do math with an Object. You have types. It's just "someone else's problem" to figure out which type it is.
schizanon, @atzanteol my tests tell me when I have type errors