<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Milan Balać on Medium]]></title>
        <description><![CDATA[Stories by Milan Balać on Medium]]></description>
        <link>https://medium.com/@bote.bote?source=rss-1698e083200a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lg5PxYeai21-W1ece0st0g.jpeg</url>
            <title>Stories by Milan Balać on Medium</title>
            <link>https://medium.com/@bote.bote?source=rss-1698e083200a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 00:24:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bote.bote/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Secret Way to Skip Ads on the World’s Default Video App]]></title>
            <link>https://medium.com/@bote.bote/the-secret-way-to-skip-ads-on-the-worlds-default-video-app-5a88816018bf?source=rss-1698e083200a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a88816018bf</guid>
            <dc:creator><![CDATA[Milan Balać]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 15:10:46 GMT</pubDate>
            <atom:updated>2026-01-31T08:48:07.824Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ehnue1QfHYjCdw_HfSSqcw.png" /></figure><p>I get the economics behind free content, but sometimes you just want to get to the thing without having to wait 5 seconds for the permission to skip.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F1151202952%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F1151202952&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F2102309189-fc1ba18cfaf62cabe84a3ae6a7ceb63e7887f0c95a5604cce801f87589dbdb35-d_1280%3Fregion%3Dus&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/3694be7e86a782ec47581a087d90c5ee/href">https://medium.com/media/3694be7e86a782ec47581a087d90c5ee/href</a></iframe><p>Lucky for us our corporate overlords provided us with an elegant way to handle this issue — subscribe to Premium.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bO31N3kjlGqmuvtL" /><figcaption>Do it!</figcaption></figure><p>But what if you’re cheap?</p><p>On desktop, basically all browsers offer some sort of an ad-blocker. These have served us well for many years, but the native experience doesn’t allow for such luxuries. The only alternate way to avoid ads altogether in the red-play-icon-app is to install a modified version.</p><p>But there is another way, a built in way. It won’t save you much time, but will make you giddy every time you do it. Better yet, it spares you from ads for the next few videos as well. And yes, it works on both Android and iOS.</p><h3>How it’s done</h3><p>Once you’ve selected a piece of content to numb your mind from the horrors of everyday life and an ad kicks in, tap the ellipsis menu in the upper right. This opens the ad preferences. From there, choose <strong>Block and continue</strong>. Once you back out of the overlay, the ad is immediately skipped and the video continues.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F1151201715%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F1151201715&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F2102307666-0ef78c8d3730d556d457647231d353141a1094c3e291af1e7c7643f030dc8837-d_1280%3Fregion%3Dus&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e17c43d38bb1b02715de685a2f89eee/href">https://medium.com/media/7e17c43d38bb1b02715de685a2f89eee/href</a></iframe><p>That’s it.</p><p>And just to reassure you, the process is exactly the same on Android.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F1151240111%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F1151240111&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F2102360943-8fc411bf2f4173e64a2bcb701e73cc9246f89cfd4f76e63e769adf9b380466ab-d_1280%3Fregion%3Dus&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/74933ae80f078798991c4b6f53bea8c3/href">https://medium.com/media/74933ae80f078798991c4b6f53bea8c3/href</a></iframe><h3>90 percent of the time, it works every time</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GZgKEBom3x1lQN5Upg4ulw.png" /><figcaption>Watch Anchorman, btw.</figcaption></figure><p>A few caveats.</p><p>Sometimes, rarely, the Block option will be disabled. These ads can’t be skipped using this method, because they come from verified advertisers or campaigns with stricter rules. 95% of the ads being served can be blocked, in my experience.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F1151238461%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F1151238461&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F2102358723-efed9dd782b0d02e8436b8b71da2843c8681d822e9dd14b38fa110ea7cf39a9a-d_1280%3Fregion%3Dus&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/73a3762e1f7728abf6f444b928704edd/href">https://medium.com/media/73a3762e1f7728abf6f444b928704edd/href</a></iframe><p>I can’t say for sure this works the same all over the world, but it does in Europe. Let me know in the comments if there are any differences for other regions.</p><p>This is not a permanent solution and works only because the platform allows you to say what you don’t want to see. It may eventually be moved or reconfigured. So enjoy it while it’s there.</p><p>One more thing: this isn’t much faster than waiting for the Skip button to appear. The satisfaction comes from <em>how</em> it works, not the speed. It feels a little more deliberate, a little more in your control.</p><h3>Tracking Change</h3><p>As of recent I started noticing activity in the Ad Preferences screen. Slight UI changes that are probably due to systems being updated. I’ll try to document these as I enccounter them to keep track of the different versions.</p><h3>To wrap up</h3><p>There’s something satisfying about discovering a small, hidden interaction that gives you a bit more agency. Consider this another tool in your content-consumption toolkit.</p><p>If you genuinely enjoy someone’s work, let the ads play every now and then. Supporting creators still matters.</p><p>That’s it. Enjoy your newly found power, and remember it comes with great responsibility :p</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a88816018bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Motion: A Vibe-Coded Approach]]></title>
            <link>https://medium.com/@bote.bote/automating-motion-a-vibe-coded-approach-33d122b7c345?source=rss-1698e083200a------2</link>
            <guid isPermaLink="false">https://medium.com/p/33d122b7c345</guid>
            <category><![CDATA[motion]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[portfolio]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <dc:creator><![CDATA[Milan Balać]]></dc:creator>
            <pubDate>Sun, 30 Nov 2025 18:48:58 GMT</pubDate>
            <atom:updated>2025-11-30T19:25:25.769Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TpFxA9aQHzf9DhQpMoeSAw.png" /></figure><p>I think my portfolio still holds up. It’s been six-seven (:p) years since I discovered Readymag and fell in love with its tooling, especially when it came to on-scroll animation. Vibe-coding and vibe-designing weren’t a thing back then, but building with Readymag came really close.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F1141857483%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F1141857483&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F2089407174-82fdaecd1ddcbadcab2f4300cfe25f9337e4072448dc4955aafa4c4617619356-d_1280%3Fregion%3Dus&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e418357a0a0a3da6de89a8c154d7d84/href">https://medium.com/media/7e418357a0a0a3da6de89a8c154d7d84/href</a></iframe><p>Having recently added a new case study to my collection I found myself happy with how it turned out. So happy that I wanted to share it with the world in form of a video.</p><p>At first, I figured I’d just scroll through the showcase manually. I’m sure it would eventually work out, but knowing myself, it’d probably take too long to get the distances right, so I opted for automation, vibe-coding in CGPT.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F1141857957%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F1141857957&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F2089407721-e8eebb357e482576fb56a979c5beb3b9cbe9f26d3b0d6b22e50db513f1624b93-d_1280%3Fregion%3Dus&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/67ecdbd2bfd748cc71f5fc5fc0e3e881/href">https://medium.com/media/67ecdbd2bfd748cc71f5fc5fc0e3e881/href</a></iframe><h3>Automating Scroll</h3><p>The idea is simple: every section in the portfolio piece has its own set of animations. Those animations trigger at a set position and finish up after a set distance. If I could control the distances scrolled with a script, i’d be able to frame and pace the on-scroll animations exactly as I envisioned.</p><p>So I stared out with a prompt:</p><blockquote>Hey, could you help me write an automated scroll script (˶ᵔ ᵕ ᵔ˶)</blockquote><p>The application of this idea is pretty self explanatory — build out a js script, step by step, and run it in the console + record the screen.</p><p>I’ll take the rest of the article to go over the hurdles for my specific case, but most of these learnings can apply in other contexts too.</p><p>All good?</p><p>Then let’s get going!</p><h4>Hurdle #1: Readymag Doesn’t Scroll Like a Regular Website</h4><p>The test script I used to validate my idea failed immediately:</p><pre>window.scrollBy({<br>  top: 600,<br>  behavior: ‘smooth’<br>});</pre><p>While running this script in an ordinary website produces the expected result, Readymag has a special scrolling wrapper. This means the Window itself doesn’t scroll, rather a container inside.</p><p>Through a bit of back-and-forth, we created a probing script to listen which element animated when I performed a scrolling action:</p><pre>(function() {<br>    console.log(&quot;Listening for scroll targets…&quot;);<br>    const elements = Array.from(document.querySelectorAll(&quot;*&quot;));<br>    const last = new WeakMap();<br>    elements.forEach(el =&gt; {<br>        last.set(el, el.scrollTop);<br>        el.addEventListener(&quot;scroll&quot;, e =&gt; {<br>            const prev = last.get(el) || 0;<br>            const now = el.scrollTop;<br>            if (now !== prev) {<br>                console.log(&quot;Scrolled:&quot;, el, &quot; → scrollTop:&quot;, now);<br>                last.set(el, now);<br>            }<br>        }, {<br>            passive: true<br>        });<br>    });<br>})();</pre><p>Having found the scroll container, we’d be able to target it specifically, and the rest of the script would play out in pretty much the same manner as it would with a regular website.</p><pre>const el = document.querySelector(<br>    &#39;#root &gt; main &gt; div.mag-pages-container &gt; div.container.disable-transitions &gt; article.page.center-page.neighbour.page-with-fixeds-desktop &gt; div.content-scroll-wrapper.has-vertical-scroll.accelerated-scroll&#39;<br>);<br><br>el.scrollTop += 600;</pre><p>Next came defining the scroll behavior.</p><h4>Hurdle #2: Tuning the Motions</h4><p>I essentially asked for a scroll that behaved similarly to swiping against the touchpad of a MacBook which formed the motion basis for all consecutive steps.</p><pre>const el = document.querySelector(<br>    &#39;#root &gt; main &gt; div.mag-pages-container &gt; div.container.disable-transitions &gt; article.page.center-page.neighbour.page-with-fixeds-desktop &gt; div.content-scroll-wrapper.has-vertical-scroll.accelerated-scroll&#39;<br>);<br><br>// Touchpad-like easing<br>function easeInOutCubic(t) {<br>    return t &lt; 0.5 ?<br>        4 * t * t * t :<br>        1 - Math.pow(-2 * t + 2, 3) / 2;<br>}<br><br>// Base motion function<br>function smoothScroll(el, distance, pxPerSec = 750) {<br>    const start = el.scrollTop;<br>    const duration = Math.max(0.18, Math.abs(distance) / pxPerSec);<br>    const startTime = performance.now();<br><br>    function frame(now) {<br>        const t = Math.min(1, (now - startTime) / (duration * 1000));<br>        const eased = easeInOutCubic(t);<br>        el.scrollTop = start + distance * eased;<br><br>        if (t &lt; 1) requestAnimationFrame(frame);<br>    }<br><br>    requestAnimationFrame(frame);<br>}<br><br>// Test motion<br>smoothScroll(el, 600);</pre><p>The rest of the process boiled down to this formula:<br>1. Prompt with a distance in pixels<br>2. Optionally define a different scroll behavior and acceleration<br>3. Run in console to test<br>4. Tweak<br>5. Move onto next step.</p><p>Eventually I ended up with a script consisting of 33 steps of varying distances and durations. Having reviewed it, I realised some steps can be refined, merged, etc. An issue became apparent: if I needed to tweak a middle step — step 17, for example — I had to wait for every preceding step to run before I could preview that brief moment.</p><h4>Hurdle #3: Micro Tweaks and Versioning</h4><p>ChatGPT doesn’t offer git-style versioning, so there’s no visual tree to fall back to. Still, asking it to mark certain scripts as major versions gave me enough structure to reference specific points and keep building from them —albeit it in a limited linear way.</p><p>What we’d do was take out a few consecutive steps from the script, and skip the distance required to get to them. Once the tweaks were done, they would get merged into the full script.</p><pre>(() =&gt; {<br><br>    // === Target element (ReadyMag&#39;s real scroll container) ===<br>    const SEL =<br>        &#39;#root &gt; main &gt; div.mag-pages-container &gt; div.container.disable-transitions &gt; article.page.center-page.neighbour.page-with-fixeds-desktop &gt; div.content-scroll-wrapper.has-vertical-scroll.accelerated-scroll&#39;;<br><br>    // --- Distances for the isolated steps ---<br>    const STEP_15_PX = 1444;<br>    const STEP_16_PX = 1312;<br>    const STEP_17_PX = 1302;<br><br>    // --- Speeds (same base as the full script) ---<br>    const SPEED_PX_PER_SEC = 750;<br>    const SPEED_MED = Math.round(SPEED_PX_PER_SEC * 0.86);<br><br>    // Optional waits (reduce or adjust during refinement)<br>    const WAIT_15_MS = 300;<br>    const WAIT_16_MS = 300;<br>    const WAIT_17_MS = 300;<br><br>    // === Standard touchpad-like easing ===<br>    const easeInOutCubic = t =&gt;<br>        t &lt; 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;<br><br>    // === Utility: wait ===<br>    const wait = ms =&gt; new Promise(r =&gt; setTimeout(r, ms));<br><br>    // === Utility: scroll animator ===<br>    function animateScrollBy(el, delta, pxPerSec, easeFn = easeInOutCubic) {<br>        return new Promise(resolve =&gt; {<br>            const startTop = el.scrollTop;<br>            const duration = Math.max(0.18, Math.abs(delta) / pxPerSec);<br>            const t0 = performance.now();<br><br>            function frame(now) {<br>                const t = Math.min(1, (now - t0) / (duration * 1000));<br>                const eased = easeFn(t);<br>                el.scrollTop = startTop + delta * eased;<br>                if (t &lt; 1) requestAnimationFrame(frame);<br>                else resolve();<br>            }<br><br>            requestAnimationFrame(frame);<br>        });<br>    }<br><br>    (async () =&gt; {<br>        const el = document.querySelector(SEL);<br>        if (!el) return console.log(&#39;Scroll container not found.&#39;);<br><br>        // === Isolated Steps 15–17 ===<br>        await animateScrollBy(el, STEP_15_PX, SPEED_MED);<br>        await wait(WAIT_15_MS);<br><br>        await animateScrollBy(el, STEP_16_PX, SPEED_MED);<br>        await wait(WAIT_16_MS);<br><br>        await animateScrollBy(el, STEP_17_PX, SPEED_MED);<br>        await wait(WAIT_17_MS);<br><br>        console.log(&quot;Steps 15–17 complete.&quot;);<br>    })();<br><br>})();</pre><p>Having finished the script, I moved onto recording. Starting out, the plan was to simply use QuickTime, but it turned out I had a few more things to address first.</p><h4>Hurdle #4: Screen Resolution</h4><p>The initial recording turned out sub-par. What seemed like smooth motion during the recording, ended up a choppy mess.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F1141854145%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F1141854145&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F2089403087-1d0e0403fe61bd8696f01927dd30a79e08d3dab4e90d4895a536e3642f0daf67-d_1280%3Fregion%3Dus&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ddf4417df9285a3a45df1da1d37d459/href">https://medium.com/media/0ddf4417df9285a3a45df1da1d37d459/href</a></iframe><p>The first intervention was product of an accident. Unintentionally resizing the browser window, I realised the screen resolution was 2560x1440. Assuming a higher resolution meant more pixels to render, I went ahead and rolled back to a safe 1920x1080. However, since the script was made for a higher resolution, some adjustments had to be made.</p><p>Luckily it was a quick fix. Accounting for the difference in vertical size of the window a scale factor of 0.75 can be calculated:</p><pre>newDistance = oldDistance × 0.75</pre><p>Moreover, a shorter distance means all the scroll steps will play out faster, so the speed needs to be adjusted as well, using the same factor of 0.75. The final script looks like this (minified):</p><pre>(()=&gt;{const a=.75,t=750,i=Math.round(516),e=Math.round(388.125),o=Math.round(645),n=Math.round(375),w=Math.round(1.3*n),r=Math.round(562.5),s=Math.round(.8*r),c=Math.round(.85*s),u=Math.round(.8*o),l=Math.round(.45*o),d=Math.round(.7*l),h=Math.round(600),m=a=&gt;a&lt;.5?4*a*a*a:1-Math.pow(-2*a+2,3)/2,p=a=&gt;a&lt;.5?4*a*a*a:1-Math.pow(-2*a+2,2.4)/2;function M(a){const t=a&lt;.6?.2:.2+(a-.6)/.4*.8;return(1-t)*m(a)+t*p(a)}const f=a=&gt;new Promise((t=&gt;setTimeout(t,a)));function g(t,i,e,o=m){const n=t.scrollTop||0,w=Math.round(i),r=Math.max(30,e*a),s=Math.max(.18,Math.abs(w)/r),c=performance.now();return new Promise((a=&gt;{requestAnimationFrame((function i(e){const r=Math.min(1,(e-c)/(1e3*s));t.scrollTop=n+w*o(r),r&lt;1?requestAnimationFrame(i):a()}))}))}(async()=&gt;{try{const a=await function(a,t=8e3){return new Promise(((i,e)=&gt;{const o=performance.now();!function n(){const w=document.querySelector(a);return w?i(w):performance.now()-o&gt;t?e(new Error(&quot;timeout&quot;)):void requestAnimationFrame(n)}()}))}(&quot;#root &gt; main &gt; div.mag-pages-container &gt; div.container.disable-transitions &gt; article.page.center-page.neighbour.page-with-fixeds-desktop &gt; div.content-scroll-wrapper.has-vertical-scroll.accelerated-scroll&quot;,8e3),n=a.style.outline;a.style.outline=&quot;3px solid magenta&quot;,setTimeout((()=&gt;a.style.outline=n),800),await f(1600),await g(a,615,t),await f(2e3),await g(a,900,t),await f(1111),await g(a,900,t),await f(600),await g(a,780,t),await f(0),await g(a,780,t),await f(1100),await g(a,999,t,p),await f(400),await g(a,819.75,e,M),await f(1e3),await g(a,1612.5,478.125,m),await f(600),await g(a,765,t,m),await f(2200),await g(a,510,600,m),await f(1020),await g(a,1522.5,h,m),await f(1800),await g(a,465,i,m),await f(1500),await g(a,1083,o,m),await f(1200),await g(a,984,o,m),await f(1400),await g(a,976.5,o,m),await f(1500),await g(a,1636.5,w,m),await f(0),await g(a,1241.25,s,m),await f(1e3),await g(a,592.5,s,m),await f(500),await g(a,1597.5,s,m),await f(2882),await g(a,450,c,m),await f(777),await g(a,2362.5,u,m),await f(666),await g(a,990,o,m),await f(1221),await g(a,1065,o,m),await f(888),await g(a,975,o,m),await f(5555),await g(a,960,o,m),await f(1221),await g(a,585,o,m),await f(2112),await g(a,735,o,m),await f(1111),await g(a,247.5,d,m),console.log(&quot;✅ 1080p full 33-step scroll complete (PRE_WAIT=1600, WAIT_32=2112).&quot;)}catch(a){console.log(&quot;⚠️ Target not found; scroll sequence skipped.&quot;,a)}})()})();</pre><p>Changing the resolution did smooth things out a bit, but there was still room for improvement with one final hurdle to cross.</p><h4>Hurdle #5: Screen Recorder</h4><p>QuickTime is my go-to screen recorder. It’s built-in, reliable, easy to understand, and gets the job done so I was surprised to see it producing sub-par results.</p><p>Turns out QuickTime records at a variable frame rate (VFR) which can result in some dropped frames. Usually it’s barely noticeable, but since I was going for higher frame rates, it turned out to be an issue.</p><p>Since there’s no way to to control frame rate in QT, I opted for OBS. It’s a more expansive tool, and best of all it’s free. It did take a bit of getting used to, but the final recording turned out significantly smoother.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F1141848530%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F1141848530&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F2089396396-e0d9ab9bd8caf3c74389ca5e76803defc115489e64fcdeb33765ff4db7f3078b-d_1280%3Fregion%3Dus&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1440" frameborder="0" scrolling="no"><a href="https://medium.com/media/e23a7e0d1b0908444024e0e7d1d0dec9/href">https://medium.com/media/e23a7e0d1b0908444024e0e7d1d0dec9/href</a></iframe><p>Yes, there’s still a bit of chop in the final video, but that’s simply baked into the portfolio piece itself — and those imperfections I’m perfectly fine with.</p><h3>Some Closing Thoughts</h3><p>Everything I built here was aimed at solving a very niche challenge, but I think it doesn’t take long to see the broader application.</p><p>If the live version of your website looks better than the design file, or you’ve got some visual effects you can’t easily reproduce, this is the way to go without needing to jump back into Figma, After Effects, or Jitter just to painstakingly recreate what that already exists.</p><p>With vibe-coding smoothing out a bunch of manual labor, you’ll be able to build up to the “ideal” experience of your work. Sure, yes, no one will ever scroll those exact distances at that exact speed, but if showing the perfected version of your work entices them to check it out, I consider that a win.</p><p>Cheers.</p><p>P.S. If you’d like to test the script with the project it was built for, you can do so <a href="https://readymag.website/bote.bote/milan-balac/sofa/">over here</a>. Mobile coming when it’s done 😁</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33d122b7c345" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimising gradient assets on Roku (and pretty much everywhere else*)]]></title>
            <link>https://medium.com/@bote.bote/optimising-gradient-assets-on-roku-and-pretty-much-everywhere-else-c09b562b2602?source=rss-1698e083200a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c09b562b2602</guid>
            <category><![CDATA[compression]]></category>
            <category><![CDATA[uitv]]></category>
            <category><![CDATA[optimisation]]></category>
            <category><![CDATA[roku]]></category>
            <category><![CDATA[gradient]]></category>
            <dc:creator><![CDATA[Milan Balać]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 08:18:47 GMT</pubDate>
            <atom:updated>2024-09-10T15:58:57.582Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hVy5KlLyu0b3Yq2eV1YNAQ.jpeg" /></figure><p>Hey there. My name is Milan, I’ve been a designer for a while now, and I’ve dedicated about 3 years of my career to designing for TV. In the upcoming period I’ll be sharing some of the insights from this design niche, so let’s kick things off with some gradients.</p><p>What if I told you thereʼs a way to cut down the size of a linear gradient PNG by about 70% without ever using a compression engine?</p><p>Youʼd probably tell me “Milan, we can draw gradients programatically…ˮ<br>Yes, hence the asterisk in the title. Had I realised this 10-15 years ago, it would have been applicable to a much wider set of cases. Keep in mind though, this does apply to every case where a linear gradient asset may be used, but most tech today will allow for it to be drawn with code. That said, there are still uses for this insight, Roku being one of them.</p><h3><strong>What’s a Roku?</strong></h3><p>Put simply, Roku is a streaming device. They offer both physical devices and software, but we donʼt have to dig that deep.</p><figure><img alt="Image of a Roku set-top box with a Roku remote." src="https://cdn-images-1.medium.com/max/1024/1*m93OCxGJmKFLXJZNAsNrnA.png" /><figcaption>Roku device and remote</figcaption></figure><p>Roku devices come in a variety of price points, ranging from about $30 to $180. And chances are that the price point is one of the reasons why theyʼre used so widely. Itʼs the number one streaming platform in America, with about 80 million active accounts. But the bargain comes at a price. You see, Rokusʼ capabilities are relatively limited, especially when compared to its more robust streaming peers like Apple TV and Amazon Fire, or with modern web. This allows for dead-simple experiences, but also for constraints that weʼve forgot existed this day and age.</p><h4><strong>The constraints</strong></h4><p>Let’s start off with the most important. Roku has a package size limit of 4 megabytes. Simple as that. So the more frugal we can be with what we’re packaging, the better.</p><p>Moreover, gradients themselves are a bit tricky on Roku. Mind you, theyʼre not impossible, but they require a bit more work than you might be used to on other platforms. Pair that with a relatively underpowered device and you may end up with janky experiences of gradients loading in with lag, being hard to maintain etc. So when doing gradients on Roku we rely on the old-school way of creating and exporting an asset, a PNG, and packing it up along with code. It ainʼt modern, but itʼs reliable.</p><p>Why not an SVG? Simple answer — Roku.</p><p>Basically, weʼre creating a resource, and that resource has a file size, and if that file size is too bulky itʼll make for a bigger package, and the package is capped at 4MB… you get the gist of it.</p><h4><strong>The ask</strong></h4><p>The ask was pretty straightforward. We had a component consisting of two halves, one reserved for some text, and the other for an image asset. We call these spotlights, the name being pretty self-explanatory. We use them to promote important pieces of content, events etc. anything weʼd like to catch out customersʼ eye.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ErgLih9DsqQcpITxVgK1DA.jpeg" /><figcaption>Spotlight component example</figcaption></figure><p>To prevent any hard edges within the component, and maintain good text legibility, we would blend the two sides by using a gradient. Pretty standard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LD0pS9B2CvTZXDtoFh-eQA.jpeg" /><figcaption>Gradient zone in spotlight component</figcaption></figure><p>We exported these gradients @2x for better quality assets, but didn’t take into account that it made for a 1.2MB asset. Paired with Rokus’ package size cap, it made for more than 1/4 of the entire package size. And that was a bit of a problem. <br>The engineering team approached me to look into ways of making the asset smaller, and I got to solving. Here’s where it gets interesting.</p><h3><strong>Kicking off with lossy compression</strong></h3><p>To start things off, I tried the standard way of pushing the gradient file through a compression engine. For this example we’ll use the gradient exported @1x, but the same will apply at higher resolutions.</p><p>Technically we got what we wanted — a smaller file size, but the asset itself ended up looking messy. What was most apparent were the transitions between different levels of opacity within the gradient.</p><p>Using lossy compression file size was trimmed by about 90%, but the gradient itself ended up being messy.</p><p>Check the example. The first gradient is the exported PNG file without using any type of compression, re-imported into Figma as an image. The second was crunched in tiny png’s compression engine which is inherently lossy, and the third one is using compressor.ioʼs lossy compression.</p><figure><img alt="Example of gradient file sizes: simply exported and re-imported to Figma, exported and pushed through tinypng, exported and pushed through compressor.io lossy compression" src="https://cdn-images-1.medium.com/max/1024/1*u_K0E6M2Npe9k6r1fJFsGA.jpeg" /><figcaption>Gradient asset sizes after lossy compression, dark background</figcaption></figure><p>As I mentioned, the subtle steps from 100% to 0% opacity become apparent when using lossy methods, and they become even more apparent when put against a light background.</p><figure><img alt="Example of gradient file sizes: simply exported and re-imported to Figma, exported and pushed through tinypng, exported and pushed through compressor.io lossy compression" src="https://cdn-images-1.medium.com/max/1024/1*w0tFYer8ULX1h96MuEc6gw@2x.png" /><figcaption>Gradient asset sizes after lossy compression, lite background</figcaption></figure><p>Let’s zoom in.</p><figure><img alt="Zoomed gradients to better illustrate vertical lines as byproduct of lossy compression" src="https://cdn-images-1.medium.com/max/1024/1*I-cEBdsv21EUEIBgUWWxxQ@2x.png" /><figcaption>Gradients lossy compression, zoomed, check vertical lines</figcaption></figure><p>We can use the first gradient as control. When comparing the second two, we can see the vertical lines, especially in the last one. Take into account hundreds of different screen qualities, and the issues may become even more obvious.</p><p>So, we got super-compressed files, but visually theyʼre messy, and weʼre visual creatures, right? Letʼs try lossless compression.</p><h3><strong>Moving onto lossless compression</strong></h3><p>We know the trade off here will be a larger file size. Tiny png doesnʼt have the option of selecting between lossy and lossless, so weʼll keep the lossy gradient for comparison. Compressor.io has a dedicated lossless method. If you want, you can try out a bunch of different options, but I got the answers I needed by using the two.</p><p>The end result ended up looking better, but the file size was cut only by 25%.</p><figure><img alt="Example of gradient file sizes: simply exported and re-imported to Figma, exported and pushed through tinypng (lossy), exported and pushed through compressor.io lossless compression" src="https://cdn-images-1.medium.com/max/1024/1*iBcCQfHCwW4tU-uiUMGdkA@2x.png" /><figcaption>Gradient asset sizes after lossless compression, lite background</figcaption></figure><p>Here we have our control, plus a lossy method, and finally a lossless result. Letʼs zoom in again to check for artifacting and vertical lines.</p><figure><img alt="Zoomed gradients to better illustrate differences between different types of compression" src="https://cdn-images-1.medium.com/max/1024/1*Zh3SpMl5r5WKW8wUo_-w-g@2x.png" /><figcaption>Gradients lossless compression (example 3), zoomed, check vertical lines</figcaption></figure><p>Okay, cool. The end result is a lot better. The transitions are not as obvious and we got a slightly smaller file. But is that all there is to it? Could there be a middle ground? Is there a way to get the best of both worlds? Do I dare bring this back to engineering?</p><p>Then it hit me.</p><h3><strong>The middle ground</strong></h3><p>Maybe thereʼs a way to get solid file size reduction without messing up the gradient visual itself. Just maybe…</p><p>First, let’s try and figure out how gradients work.</p><h4><strong>How gradients work</strong></h4><p>Now, I havenʼt done the in-depth research on this one, I relied mostly on intuition, and I may be painfully wrong so feel free to correct me. But the logic seems to make sense.</p><p>If you remember back in the hay-day of dial up, the images online used to load in almost as if being scanned, row by row. So we can assume that the information about any specific image is saved in horizontal rows. Check the video for a quick overview:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fra0EG9lbP7Y%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dra0EG9lbP7Y&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fra0EG9lbP7Y%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3599ec493d82642a85c6e252f3272bdf/href">https://medium.com/media/3599ec493d82642a85c6e252f3272bdf/href</a></iframe><p>Since a linear left-to-right (or right-to-left) gradient is basically sequential opacity reduction from side to side, row by row, it made sense that the file size would be larger if every row contained opacity info from 100% to 0%. If simplified and broken down into pixels itʼd look something like this:</p><figure><img alt="Horizontal gradient rows consist of opacity information for every pixel, going from 100% opacity to 0% opacity" src="https://cdn-images-1.medium.com/max/1024/1*9_yZYSd_MqCrKMZgvYqAzQ@2x.png" /><figcaption>Simplified illustration of horizontal gradient rows</figcaption></figure><p>Basically, every pixel in a row would be 1% more transparent, and that would have to be repeated for every row in the image. But if every pixel in a row was the same opacity, theoretically the redundant information for every row would be removed making for a smaller file size. Check the example for comparison (instead of reducing opacity by 1% in increased the steps to 10% to better illustrate the difference):</p><figure><img alt="Vertical gradients contain same opacity for every pixel in a row" src="https://cdn-images-1.medium.com/max/1024/1*f0iNPvYkMdWferQkfM1CWA@2x.png" /><figcaption>Simplified illustration of vertical gradient rows</figcaption></figure><p>The logic seemed sound, and all that was left was to test that theory in practice.</p><h4><strong>Rotating gradients</strong></h4><p>It was as simple as rotating the horizontal gradient asset by 90 degrees to make it vertical, turning it from left-to-right into a bottom-to-top gradient, and hitting export. And crossing my fingers in the process…</p><p>Aaaaand…</p><p>I ended up with a file that was around 60% smaller without relying on any compression engine.</p><figure><img alt="Comparison of gradient asset size reduction for gradients exported at 1x and at 2x, and gradients rotated and exported at 1x and at 2x" src="https://cdn-images-1.medium.com/max/1024/1*47hUDyHeYVkFf95AZqOyMQ.png" /><figcaption>Comparison of gradient asset size reduction for gradients exported @1x and @2x</figcaption></figure><p>If I were to export the asset at 2x, the percentage reduction was even bigger, at around 80%. That was the exact middle ground I was looking for — smaller file without compromising visual quality.</p><p>If we were to zoom in, weʼd see thereʼs little to no artifacting happening.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnAa-op9_ICdPsVmdfD2dA@2x.png" /><figcaption>Side-by-side comparison of vertical gradients exported @1x and @2x</figcaption></figure><p>Finally, letʼs do a comparison of the exported file, lossy compression, and lossless compression. We already know the effect on file sizes, but letʼs check how the end result will be affected visually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvPzeSxrwZZslIEwBa0fCg@2x.png" /><figcaption>Exported vertical gradient vs the same gradient with lossy and lossless compression</figcaption></figure><p>The results above are to be expected. Basically, lossy will give us the smallest file size with heavier visual downgrades, while lossless will slightly reduce the file size but wonʼt be as visually impairing. Letʼs zoom in:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6fi6mgu9itMClSsIMkG4jw.jpeg" /><figcaption>Zoomed in vertical gradient vs the same gradient with lossy and lossless compression, check horizontal lines in the middle example</figcaption></figure><p>Honestly, lossless doesnʼt look half-bad, and may be used as an additional step for an even smaller file size. The end result is slightly grainier than the uncompressed asset, but the differences are hardly noticeable.</p><h4><strong>Testing with colours</strong></h4><p>To take things a bit further letʼs do a test with different colours. Weʼll use a pure black gradient along with Red (#FF0000), Green (#00FF00) and Blue (#0000FF), just to see whether these findings will still apply.</p><p>Lo and behold, they do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOiEodR1UP8vwmVh1YBs0Q@2x.png" /><figcaption>Applying same methods to coloured gradients</figcaption></figure><p>We basically get a consistent file size reduction for all colours, just by rotating the gradient by 90 degrees.</p><p>Great success!</p><h3>Closing thoughts</h3><p>There you have it. After some careful exploration and reliance on unorthodox methods we got some interesting results. Reducing asset size by about 70% won’t end hunger or anything like that, but it can be a useful tool in your belt. Keep in mind the package size cap at 4MB, having crunched asset sizes we reduce the risk of going overboard in terms of package size.</p><p>One thing I enjoy the most in this line of work is the fact that you can always end up with interesting solutions if you get yourself out of the goddamn everyday grind. Screw the process — experiment.</p><p>If you got this far, leave a like, share your thoughts, and thank you for your attention. Until the next article in the world of TV design, stay beautiful, stay strong, and have a good one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c09b562b2602" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>