home.social

#lerp — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #lerp, aggregated by home.social.

  1. Code at: github.com/villares/sketch-a-d
    More sketch-a-day: abav.lugaralgum.com/sketch-a-d
    I really need your support to keep going, if you can, donate any amount at: paypal.com/donate/?hosted_butt #Processing #Python #py5 #CreativeCoding #NumPy #lerp #LinearInterpolation

    Update: This could be done with:
    `r = py5.lerp(a[:,np.newaxis], b[:,np.newaxis], t) # np.newaxis is an alias for None`

  2. #TodayILeaned I can use #py5's #lerp (Linear intERPolation, also very much liked in #Processing & p5.js) function with #NumPy arrays (and why wouldn't it work, right?) I should write a post about this... I used to have a slow recursive function called lerp_tuple to interpolate between two polygons or collections of point positions and I can probably retire it!

  3. #Processing drawing infrastructure, out of the box, doesn't come with a "dashed line" primitive, or sophisticated line styles. Golan Levin and Tega Brain (Code as Creative Medium, 2021) propose writing a function for that as a small exercise. How to tackle it? How would you draw a dashed line if you only had a simple line() function for drawing?

    My first intuition I think would be to use #lerp to get intermediary points along the line. I have often used some kind of "lerp tuple" strategy for coordinates. What would you do?

    #creativeCoding #CACM

  4. In the same way there is no "correct" way to blend colours, there is also no "correct" way to sort them.

    Back in 2015 I wrote a lengthy article showing various different ways in which colours can be sorted. 👇

    alanzucconi.com/2015/09/30/col

    #gamedev #games #colour #lerp #unity #tips #coding

  5. The problem of colour interpolation becomes apparent when you to blend in RGB space.

    The colour "in between" BLUE and YELLOW in RGB space is a not-so-exciting grey-ish.

    🔵+🟡=⚪ ❌

    If you want an out of the box solution that simulates how colour pigments are blended together, I'd suggest checking out Mixbox.

    🔵+🟡=🟢 ✔️

    A Unity package is also available!

    #gamedev #games #coding #tips #lerp #unity #mixbox

    scrtwpns.com/mixbox/

  6. One of the most interesting—yet often overlooked—topics in #gamedev is COLOUR INTERPOLATION. 🎨

    Blending two colours is not as easy as it sounds. This is because the RGB colour space stores data in the most convenient format to *display* it, but does not take into account how colours are actually *perceived*. 👁️

    This article explains in details why this problem is so complex, and what can be done to fix it! 👇

    alanzucconi.com/2016/01/06/col

    #games #lerp #unity #tip #coding

  7. another thing that is a #lerp: gradients. so i was wondering if anyone was beziering those. turns out: yes!

    larsenwork.com/easing-gradient

    it allows something called easing gradients and it looks pretty sweet! and they are prospsed to be built into #CSS!

    github.com/w3c/csswg-drafts/is

    well i think one could also do interesting beziery things to the shape of gradients, making them curve in more complex ways than just linearly and radially, so that might be interesting to explore…