<?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 Gowtham J on Medium]]></title>
        <description><![CDATA[Stories by Gowtham J on Medium]]></description>
        <link>https://medium.com/@gowthamjaganthan?source=rss-7c4883f81036------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*64sqf0bmEdaETzC6RQNA-w.png</url>
            <title>Stories by Gowtham J on Medium</title>
            <link>https://medium.com/@gowthamjaganthan?source=rss-7c4883f81036------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:35:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gowthamjaganthan/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[Relighting a Photo, and My Live Selfie Camera, with One Skia Shader in React Native]]></title>
            <link>https://medium.com/@gowthamjaganthan/relighting-a-photo-and-my-live-selfie-camera-with-one-skia-shader-in-react-native-0258b1b73d4a?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/0258b1b73d4a</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[cameras]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react-native-skia]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Sat, 03 Oct 2026 17:42:42 GMT</pubDate>
            <atom:updated>2026-10-03T17:42:42.746Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Subtitle:</strong> A moving light that wraps around a flat photo in 3D, then the same idea running live on the front camera. Inspired by William Candillon’s React Native Skia 3.0 talk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UYLJkXaW-tbMhUhR6RTMRw.png" /></figure><h3>Where this started</h3><p>In his React Native Skia 3.0 talk, William Candillon showed Vermeer’s “Girl with a Pearl Earring” lit by a small glowing orb. As the light moved, the painting reacted as if it had real depth. It looked like magic.</p><p>I wanted to understand it and rebuild it, first on the painting, then on my own photo, and finally on my live front camera.</p><h3>Credits first</h3><ul><li><strong>William Candillon</strong>, for the idea and the talk: <a href="https://youtube.com/watch?v=L-PNQi1nBSA">https://youtube.com/watch?v=L-PNQi1nBSA</a></li><li><strong>React Native Skia</strong> by Shopify and William Candillon: <a href="https://github.com/Shopify/react-native-skia">https://github.com/Shopify/react-native-skia</a></li><li><strong>Skia</strong>, Google’s graphics engine: <a href="https://skia.org/">https://skia.org</a></li><li><strong>VisionCamera</strong> by Marc Rousavy, plus its Skia plugin: <a href="https://github.com/mrousavy/react-native-vision-camera">https://github.com/mrousavy/react-native-vision-camera</a></li><li><strong>Reanimated &amp; Worklets</strong> by Software Mansion.</li><li>“Girl with a Pearl Earring” by Johannes Vermeer (c. 1665, Mauritshuis) is in the public domain.</li></ul><p>All the code below is my own recreation.</p><h3>How relighting works (no maths degree needed)</h3><p>A photo only has colour. To light it, every pixel also needs a direction it “faces”, called a normal. With a normal, a light position and a classic lighting formula (Blinn-Phong), each pixel gets:</p><ul><li><strong>Diffuse:</strong> brighter when it faces the light.</li><li><strong>Specular:</strong> a small highlight where light bounces toward you.</li><li><strong>Attenuation:</strong> dimmer the further it is from the light.</li><li><strong>An orb:</strong> a glowing core with a soft halo, drawn where the light is.</li></ul><p>The whole question becomes: where do the normals come from?</p><ol><li><strong>Painting (my first attempt):</strong> treat brightness as height. Bright brush strokes bulge toward the light. It’s cheap and works on any image, but it looks embossed.</li><li><strong>My photo:</strong> bake a proper normal map offline, with a rounded 3D relief of my head and shoulders plus a little facial detail.</li><li><strong>Live camera:</strong> there’s no time to bake anything, so I estimate shape from smoothed brightness, plus a soft rounded “face” shape where a selfie face usually sits.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*cBQ7JbrYxI1ezgwmeMI7Pg.png" /><figcaption>The normal map: colour encodes which way each pixel faces</figcaption></figure><h3>Step 1: Set up the project</h3><pre>npm install @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler</pre><pre>cd ios &amp;&amp; pod install &amp;&amp; cd ..</pre><p>Add the worklets Babel plugin (it must be last) in babel.config.js:</p><pre>module.exports = {<br>  presets: [&#39;module:@react-native/babel-preset&#39;],<br>  plugins: [&#39;react-native-worklets/plugin&#39;],<br>};</pre><p>Versions I used: React Native 0.85, @shopify/react-native-skia 2.14.0, react-native-reanimated 4.3.1, react-native-worklets 0.8.3.</p><h3>Step 2: Generate the photo assets</h3><p>The script separates me from my plain grey wall with a simple colour test, then builds a smooth rounded relief from my silhouette:</p><ul><li><strong>Smooth edges:</strong> a distance transform with a quadratic falloff, so there’s no dark rim at the edge of my outline.</li><li><strong>No banding:</strong> the normal map is computed in float precision at full resolution and only saved to 8-bit at the end. My first version saved a height map and differentiated it in the shader; the 8-bit steps showed up as contour lines on my shirt.</li><li><strong>No band at the frame edge:</strong> the mask is padded at the image border, because my shoulders run off the frame.</li></ul><p>(The same script also generates the letter point cloud from Part 1.)</p><pre>python3 -m venv .venv &amp;&amp; .venv/bin/pip install numpy pillow scipy<br># scripts/portrait/build_portrait.py<br>&quot;&quot;&quot;<br>Turns a portrait photo into the assets used by the Skia showcase:<br>  src/skiaShowcase/assets/portrait.jpg        the photo (relight scene)<br>  src/skiaShowcase/assets/portraitNormals.png a normal map (relight scene)<br>  src/skiaShowcase/letters/portraitPoints.json point cloud (letters scene)<br>Usage:<br>  python3 -m venv .venv &amp;&amp; .venv/bin/pip install numpy pillow scipy<br>  .venv/bin/python scripts/portrait/build_portrait.py path/to/photo.jpg<br>Works best with a plain, light, neutral background (a wall or backdrop).<br>&quot;&quot;&quot;<br>import json<br>import sys<br>from pathlib import Path<br>import numpy as np<br>from PIL import Image<br>from scipy import ndimage<br>ROOT = Path(__file__).resolve().parents[2]<br>ASSETS = ROOT / &quot;src/skiaShowcase/assets&quot;<br>CLOUD = ROOT / &quot;src/skiaShowcase/letters/portraitPoints.json&quot;<br>GRID = 260  # analysis resolution<br>POINTS = 7000  # candidates; the app uses the first N<br>WORLD = 1.4  # world-space height of the portrait<br><br>def person_mask(rgb: np.ndarray) -&gt; np.ndarray:<br>    r, g, b = rgb[..., 0], rgb[..., 1], rgb[..., 2]<br>    chroma = rgb.max(-1) - rgb.min(-1)<br>    luma = rgb @ np.array([0.299, 0.587, 0.114])<br>    # background = bright and neutral grey<br>    background = (chroma &lt; 14) &amp; (luma &gt; 150) &amp; ((b - r) &lt; 12)<br>    # pad so morphology doesn&#39;t eat into the body where it meets the frame<br>    pad = 8<br>    mask = np.pad(~background, pad, mode=&quot;edge&quot;)<br>    mask = ndimage.binary_opening(mask, iterations=2)<br>    mask = ndimage.binary_closing(mask, iterations=4)<br>    mask = ndimage.binary_fill_holes(mask)[pad:-pad, pad:-pad]<br>    labels, n = ndimage.label(mask)<br>    if n &gt; 1:<br>        sizes = ndimage.sum(mask, labels, range(1, n + 1))<br>        mask = labels == (1 + int(np.argmax(sizes)))<br>    return mask<br><br>def main(src: str) -&gt; None:<br>    photo = Image.open(src).convert(&quot;RGB&quot;)<br>    ASSETS.mkdir(parents=True, exist_ok=True)<br>    side = min(photo.size)<br>    photo = photo.crop((0, 0, side, side)).resize((960, 960), Image.LANCZOS)<br>    photo.save(ASSETS / &quot;portrait.jpg&quot;, quality=90)<br>    small = np.asarray(photo.resize((GRID, GRID), Image.LANCZOS), dtype=np.float32)<br>    mask = person_mask(small)<br>    luma = (small @ np.array([0.299, 0.587, 0.114])) / 255.0<br>    # Relief: a rounded &quot;pillow&quot; from the silhouette plus a little facial detail.<br>    # The quadratic falloff keeps the slope finite at the edge (no dark rim).<br>    dist = ndimage.distance_transform_edt(mask)<br>    relief = 1 - (1 - np.minimum(dist / 40.0, 1.0)) ** 2<br>    detail = ndimage.gaussian_filter(luma, 1.2) * mask<br><br>    # Normal map for the relight shader, computed in float at full resolution<br>    # so there is no 8-bit banding in the lighting.<br>    big = np.asarray(photo, dtype=np.float32) @ np.array([0.299, 0.587, 0.114]) / 255<br>    zoom = 960 / GRID<br>    mask_big = ndimage.zoom(mask.astype(np.float32), zoom, order=1)<br>    mask_big = ndimage.gaussian_filter(mask_big, 6) &gt; 0.5  # smooth jagged edge<br>    # the body continues past the frame, so pad with edge values before measuring<br>    pad = 200<br>    dist_big = ndimage.distance_transform_edt(np.pad(mask_big, pad, mode=&quot;edge&quot;))<br>    dist_big = dist_big[pad:-pad, pad:-pad]<br>    relief_big = 1 - (1 - np.minimum(dist_big / (40.0 * zoom), 1.0)) ** 2<br>    relief_big = ndimage.gaussian_filter(relief_big, 4, mode=&quot;nearest&quot;)<br>    mask_big = ndimage.gaussian_filter(mask_big.astype(np.float32), 3)<br>    height = relief_big + ndimage.gaussian_filter(big, 3) * mask_big * 0.04<br>    hy, hx = np.gradient(height)<br>    k = 60.0<br>    n = np.dstack([-hx * k, -hy * k, np.ones_like(height)])<br>    n /= np.linalg.norm(n, axis=2, keepdims=True)<br>    Image.fromarray(((n * 0.5 + 0.5) * 255).round().astype(np.uint8)).save(<br>        ASSETS / &quot;portraitNormals.png&quot;<br>    )<br>    # Normals of the relief surface (z points toward the camera = negative).<br>    depth = relief * 0.22 + detail * 0.04<br>    gy, gx = np.gradient(depth * GRID / WORLD)<br>    # Stippling: more letters where the photo is dark or has edges.<br>    dark = np.clip((0.85 - luma) / 0.7, 0, 1)<br>    edges = ndimage.gaussian_gradient_magnitude(luma, 1.0)<br>    edges = edges / max(edges.max(), 1e-6)<br>    outline = mask &amp; ~ndimage.binary_erosion(mask, iterations=3)<br>    weight = (0.1 + dark ** 1.4 + edges * 0.8 + outline * 1.2) * mask<br>    weight = weight.ravel() / weight.sum()<br>    rng = np.random.default_rng(7)<br>    picks = rng.choice(weight.size, size=POINTS, p=weight)<br>    ys, xs = np.unravel_index(picks, mask.shape)<br>    jx = rng.random(POINTS)<br>    jy = rng.random(POINTS)<br><br>    positions, normals, tones = [], [], []<br>    for x, y, ox, oy in zip(xs, ys, jx, jy):<br>        u = (x + ox) / GRID<br>        v = (y + oy) / GRID<br>        n = np.array([-gx[y, x], gy[y, x], -1.0])<br>        n /= np.linalg.norm(n)<br>        positions += [(u - 0.5) * WORLD, (0.5 - v) * WORLD, -depth[y, x]]<br>        normals += list(n)<br>        tones.append(dark[y, x])<br><br>    CLOUD.write_text(<br>        json.dumps(<br>            {<br>                &quot;positions&quot;: [round(float(p), 4) for p in positions],<br>                &quot;normals&quot;: [round(float(p), 3) for p in normals],<br>                &quot;tones&quot;: [round(float(p), 3) for p in tones],<br>            },<br>            separators=(&quot;,&quot;, &quot;:&quot;),<br>        )<br>    )<br>    print(f&quot;mask coverage {mask.mean():.0%}, wrote {POINTS} points&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    main(sys.argv[1])</pre><pre>.venv/bin/python scripts/portrait/build_portrait.py path/to/your-photo.jpg</pre><h3>Step 3: The relight shader on a photo</h3><p>This is a Skia runtime shader with two child shaders, the photo and its normal map, both drawn with fit=&quot;cover&quot; so they line up pixel for pixel. The light position comes from Reanimated shared values. When you&#39;re not touching the screen, a frame callback eases the light along a slow Lissajous path around the face. When you drag, it follows your finger.</p><pre>// src/skiaShowcase/relight/RelightPortrait.tsx<br>import React from &#39;react&#39;;<br>import { StyleSheet, useWindowDimensions } from &#39;react-native&#39;;<br>import {<br>  Canvas,<br>  Fill,<br>  ImageShader,<br>  Shader,<br>  Skia,<br>  useImage,<br>} from &#39;@shopify/react-native-skia&#39;;<br>import { Gesture, GestureDetector } from &#39;react-native-gesture-handler&#39;;<br>import {<br>  useDerivedValue,<br>  useFrameCallback,<br>  useSharedValue,<br>} from &#39;react-native-reanimated&#39;;<br><br>// Both generated from a photo by scripts/portrait/build_portrait.py.<br>const PHOTO = require(&#39;../assets/portrait.jpg&#39;);<br>const NORMAL_MAP = require(&#39;../assets/portraitNormals.png&#39;);<br><br>/**<br> * Reads a baked normal map (a rounded relief of the person plus facial<br> * detail) and shades every pixel of the photo with a moving point light<br> * (Blinn-Phong), so the flat photo picks up 3D lighting.<br> */<br>const source = Skia.RuntimeEffect.Make(`<br>uniform shader image;<br>uniform shader normalMap;<br>uniform float3 light;     // xy in canvas points, z = height above canvas<br>uniform float falloff;<br>uniform float orbRadius;<br>uniform float bump;<br><br>half4 main(float2 p) {<br>  float3 albedo = float3(image.eval(p).rgb);<br>  float3 nm = float3(normalMap.eval(p).rgb) * 2.0 - 1.0;<br>  float3 n = normalize(float3(nm.xy * bump, nm.z));<br>  float3 toLight = light - float3(p, 0.0);<br>  float dist = length(toLight);<br>  float3 l = toLight / dist;<br>  float att = 1.0 / (1.0 + (dist / falloff) * (dist / falloff));<br>  float diffuse = max(dot(n, l), 0.0);<br>  float3 h = normalize(l + float3(0.0, 0.0, 1.0));<br>  float spec = pow(max(dot(n, h), 0.0), 40.0);<br>  float3 warm = float3(1.0, 0.87, 0.7);<br>  float ambient = 0.1;<br>  float3 col = albedo * (ambient + warm * diffuse * att * 2.4)<br>             + warm * spec * att * 0.45;<br>  // the light source itself: a hot core with a soft halo<br>  float d = length(p - light.xy);<br>  float core = smoothstep(orbRadius, orbRadius * 0.6, d);<br>  float halo = exp(-d / (orbRadius * 2.5)) * 0.5;<br>  col += float3(1.0, 0.95, 0.86) * (core + halo);<br>  return half4(half3(col), 1.0);<br>}<br>`)!;<br><br>export function RelightPortrait() {<br>  const { width, height } = useWindowDimensions();<br>  const image = useImage(PHOTO);<br>  const normalMap = useImage(NORMAL_MAP);<br>  const size = Math.min(width, height);<br>  const rect = { x: 0, y: 0, width, height };<br>  const lightX = useSharedValue(width * 0.5);<br>  const lightY = useSharedValue(height * 0.45);<br>  const dragging = useSharedValue(false);<br>  // When nobody is touching the screen the light drifts around the face.<br>  useFrameCallback(({ timeSinceFirstFrame }) =&gt; {<br>    if (dragging.value) {<br>      return;<br>    }<br>    const t = timeSinceFirstFrame / 1000;<br>    const tx = width * (0.5 + 0.3 * Math.sin(t * 0.55));<br>    const ty = height * (0.42 + 0.16 * Math.sin(t * 0.9 + 1.2));<br>    lightX.value += (tx - lightX.value) * 0.05;<br>    lightY.value += (ty - lightY.value) * 0.05;<br>  });<br>  const uniforms = useDerivedValue(() =&gt; ({<br>    light: [lightX.value, lightY.value, size * 0.22],<br>    falloff: size * 0.55,<br>    orbRadius: size * 0.035,<br>    bump: 1.2,<br>  }));<br>  const pan = Gesture.Pan()<br>    .minDistance(0)<br>    .onBegin(e =&gt; {<br>      dragging.value = true;<br>      lightX.value = e.x;<br>      lightY.value = e.y;<br>    })<br>    .onChange(e =&gt; {<br>      lightX.value = e.x;<br>      lightY.value = e.y;<br>    })<br>    .onFinalize(() =&gt; {<br>      dragging.value = false;<br>    });<br><br>  return (<br>    &lt;GestureDetector gesture={pan}&gt;<br>      &lt;Canvas style={styles.canvas}&gt;<br>        &lt;Fill color=&quot;black&quot; /&gt;<br>        {image &amp;&amp; normalMap &amp;&amp; (<br>          &lt;Fill&gt;<br>            &lt;Shader source={source} uniforms={uniforms}&gt;<br>              &lt;ImageShader image={image} fit=&quot;cover&quot; rect={rect} /&gt;<br>              &lt;ImageShader image={normalMap} fit=&quot;cover&quot; rect={rect} /&gt;<br>            &lt;/Shader&gt;<br>          &lt;/Fill&gt;<br>        )}<br>      &lt;/Canvas&gt;<br>    &lt;/GestureDetector&gt;<br>  );<br>}<br>const styles = StyleSheet.create({<br>  canvas: {<br>    flex: 1,<br>  },<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*Id5wbt8RF99o_ds9otkypA.png" /><figcaption>frames of my relit photo with the light on different sides</figcaption></figure><p>Want to try it on the Vermeer painting instead? With no normal map, use the “brightness as height” trick. Sample a slightly blurred luminance around each pixel and take its gradient:</p><pre>float luma(float2 p) {<br>  return dot(float3(image.eval(p).rgb), float3(0.299, 0.587, 0.114));<br>}<br>float heightAt(float2 p) {<br>  return luma(p) * 0.2<br>    + (luma(p + float2(3, 0)) + luma(p - float2(3, 0))<br>     + luma(p + float2(0, 3)) + luma(p - float2(0, 3))) * 0.12<br>    + (luma(p + float2(5, 5)) + luma(p - float2(5, 5))<br>     + luma(p + float2(5, -5)) + luma(p - float2(5, -5))) * 0.08;<br>}<br>// inside main():<br>float e = 2.5;<br>float dx = heightAt(p + float2(e, 0)) - heightAt(p - float2(e, 0));<br>float dy = heightAt(p + float2(0, e)) - heightAt(p - float2(0, e));<br>float3 n = normalize(float3(-dx * 3.0, -dy * 3.0, 1.0));</pre><h3>Step 4: Live relighting on the front camera</h3><p>Now the fun part. VisionCamera v5 has an official Skia plugin, SkiaCamera. Each camera frame arrives as a GPU texture in a worklet on the camera thread, and you draw it with any Skia shader. The pixels never pass through JavaScript.</p><p>Install:</p><pre>npm install react-native-vision-camera react-native-vision-camera-worklets react-native-vision-camera-skia react-native-nitro-modules react-native-nitro-image</pre><pre>cd ios &amp;&amp; pod install &amp;&amp; cd ..</pre><p>Versions I used: VisionCamera, VisionCamera Worklets and VisionCamera Skia 5.2.3, react-native-nitro-modules 0.37.1, react-native-nitro-image 0.15.2. If you already have an older Nitro (I had 0.35), upgrade it: VisionCamera 5 is generated against 0.37.</p><p>Add the camera permission to ios/YourApp/Info.plist:</p><pre>&lt;key&gt;NSCameraUsageDescription&lt;/key&gt;<br>&lt;string&gt;The camera is used to relight your face live with a GPU shader.&lt;/string&gt;</pre><p>The design choices:</p><ul><li><strong>Physically rotated frames:</strong> enablePhysicalBufferRotation delivers frames upright and as displayed, so frame pixels map straight onto the screen with a simple &quot;cover&quot; conversion.</li><li><strong>Estimated shape:</strong> there’s no normal map, so the shape comes from smoothed brightness (shape-from-shading) plus a soft ellipsoid “face” relief near the top centre.</li><li><strong>Sharing the light position:</strong> the gesture runs on the JS thread and the frame worklet runs on the camera thread. A createSynchronizable from react-native-worklets shares the light position safely between the two.</li><li><strong>Front/back switch:</strong> a button flips between the front and back cameras.</li></ul><pre>// src/skiaShowcase/camera/CameraRelight.tsx<br>import React, { useMemo, useState } from &#39;react&#39;;<br>import {<br>  Pressable,<br>  StyleSheet,<br>  Text,<br>  View,<br>  useWindowDimensions,<br>} from &#39;react-native&#39;;<br>import {<br>  FilterMode,<br>  MipmapMode,<br>  Skia,<br>  TileMode,<br>} from &#39;@shopify/react-native-skia&#39;;<br>import { Gesture, GestureDetector } from &#39;react-native-gesture-handler&#39;;<br>import { useSafeAreaInsets } from &#39;react-native-safe-area-context&#39;;<br>import { useCameraPermission } from &#39;react-native-vision-camera&#39;;<br>import { SkiaCamera } from &#39;react-native-vision-camera-skia&#39;;<br>import { createSynchronizable } from &#39;react-native-worklets&#39;;<br><br>/**<br> * Live relighting of the camera feed, one GPU shader pass per frame.<br> *<br> * There is no depth or normal map for a live feed, so the surface shape is<br> * estimated from two cues:<br> *  - shape-from-shading: smoothed luminance gradients act as a bump map<br> *  - a soft ellipsoid &quot;face&quot; relief centred where a selfie face usually sits<br> */<br>const effect = Skia.RuntimeEffect.Make(`<br>uniform shader image;<br>uniform float3 light;     // xy in frame pixels, z = height above the image<br>uniform float falloff;<br>uniform float orbRadius;<br>uniform float2 size;      // frame size in pixels<br><br>float luma(float2 p) {<br>  return dot(float3(image.eval(p).rgb), float3(0.299, 0.587, 0.114));<br>}<br><br>// wide blur so sensor noise doesn&#39;t turn into sparkles<br>float heightAt(float2 p) {<br>  return (luma(p)<br>    + luma(p + float2(7, 0)) + luma(p - float2(7, 0))<br>    + luma(p + float2(0, 7)) + luma(p - float2(0, 7))) * 0.2;<br>}<br><br>half4 main(float2 p) {<br>  float3 albedo = float3(image.eval(p).rgb);<br><br>  float e = 4.0;<br>  float dx = heightAt(p + float2(e, 0)) - heightAt(p - float2(e, 0));<br>  float dy = heightAt(p + float2(0, e)) - heightAt(p - float2(0, e));<br><br>  float2 q = (p / size - float2(0.5, 0.42)) / float2(0.3, 0.24);<br>  float d = dot(q, q);<br>  float faceWeight = smoothstep(1.4, 0.5, d);<br>  float2 tilt = q * 0.9 * faceWeight - float2(dx, dy) * 5.0;<br>  float3 n = normalize(float3(tilt, 1.0));<br><br>  float3 toLight = light - float3(p, 0.0);<br>  float dist = length(toLight);<br>  float3 l = toLight / dist;<br>  float att = 1.0 / (1.0 + (dist / falloff) * (dist / falloff));<br><br>  float diffuse = max(dot(n, l), 0.0);<br>  float3 h = normalize(l + float3(0.0, 0.0, 1.0));<br>  float spec = pow(max(dot(n, h), 0.0), 32.0);<br><br>  float3 warm = float3(1.0, 0.86, 0.68);<br>  float3 col = albedo * (0.12 + warm * diffuse * att * 2.3)<br>             + warm * spec * att * 0.3;<br><br>  float r = length(p - light.xy);<br>  col += float3(1.0, 0.95, 0.86)<br>       * (smoothstep(orbRadius, orbRadius * 0.6, r) + exp(-r / (orbRadius * 2.5)) * 0.5);<br><br>  return half4(half3(col), 1.0);<br>}<br>`)!;<br>const paint = Skia.Paint();<br><br>type LightState = { x: number; y: number; dragging: boolean };<br><br>export function CameraRelight({ showChrome = true }: { showChrome?: boolean }) {<br>  const { hasPermission, canRequestPermission, requestPermission } =<br>    useCameraPermission();<br>  const [position, setPosition] = useState&lt;&#39;front&#39; | &#39;back&#39;&gt;(&#39;front&#39;);<br>  const { width, height } = useWindowDimensions();<br>  const insets = useSafeAreaInsets();<br><br>  // Shared between the gesture (RN thread) and the camera&#39;s frame thread.<br>  const target = useMemo(<br>    () =&gt; createSynchronizable&lt;LightState&gt;({ x: 0, y: 0, dragging: false }),<br>    [],<br>  );<br>  const current = useMemo(<br>    () =&gt; createSynchronizable({ x: width / 2, y: height * 0.4 }),<br>    [width, height],<br>  );<br><br>  const pan = Gesture.Pan()<br>    .runOnJS(true)<br>    .minDistance(0)<br>    .onBegin(e =&gt; target.setBlocking({ x: e.x, y: e.y, dragging: true }))<br>    .onChange(e =&gt; target.setBlocking({ x: e.x, y: e.y, dragging: true }))<br>    .onFinalize(() =&gt;<br>      target.setBlocking(prev =&gt; ({ ...prev, dragging: false })),<br>    );<br><br>  if (!hasPermission) {<br>    return (<br>      &lt;View style={styles.center}&gt;<br>        &lt;Text style={styles.message}&gt;Live relighting needs the camera.&lt;/Text&gt;<br>        {canRequestPermission ? (<br>          &lt;Pressable style={styles.button} onPress={requestPermission}&gt;<br>            &lt;Text style={styles.buttonText}&gt;Allow camera&lt;/Text&gt;<br>          &lt;/Pressable&gt;<br>        ) : (<br>          &lt;Text style={styles.hint}&gt;Enable it in Settings → FocusTimer.&lt;/Text&gt;<br>        )}<br>      &lt;/View&gt;<br>    );<br>  }<br><br>  return (<br>    &lt;View style={styles.root}&gt;<br>      &lt;GestureDetector gesture={pan}&gt;<br>        &lt;SkiaCamera<br>          style={styles.root}<br>          device={position}<br>          isActive={true}<br>          // Frames arrive upright and as displayed, so frame pixels map<br>          // directly onto the screen (the preview is drawn with fit=&quot;cover&quot;).<br>          enablePhysicalBufferRotation={true}<br>          onFrame={(frame, render) =&gt; {<br>            &#39;worklet&#39;;<br>            render(({ canvas, frameTexture }) =&gt; {<br>              const w = frameTexture.width();<br>              const h = frameTexture.height();<br>              // view (points) -&gt; frame (pixels) for a &quot;cover&quot; fit<br>              const scale = Math.max(width / w, height / h);<br>              const offX = (width - w * scale) / 2;<br>              const offY = (height - h * scale) / 2;<br>             // light: follow the finger, or drift around the face<br>              const t = Date.now() / 1000;<br>              const goal = target.getBlocking();<br>              const tx = goal.dragging<br>                ? goal.x<br>                : width * (0.5 + 0.32 * Math.sin(t * 0.55));<br>              const ty = goal.dragging<br>                ? goal.y<br>                : height * (0.4 + 0.15 * Math.sin(t * 0.9 + 1.2));<br>              const prev = current.getBlocking();<br>              const k = goal.dragging ? 0.5 : 0.06;<br>              const lx = prev.x + (tx - prev.x) * k;<br>              const ly = prev.y + (ty - prev.y) * k;<br>              current.setBlocking({ x: lx, y: ly });<br><br>              const size = Math.min(w, h);<br>              const image = frameTexture.makeShaderOptions(<br>                TileMode.Clamp,<br>                TileMode.Clamp,<br>                FilterMode.Linear,<br>                MipmapMode.None,<br>              );<br>              const shader = effect.makeShaderWithChildren(<br>                [<br>                  (lx - offX) / scale,<br>                  (ly - offY) / scale,<br>                  size * 0.3,<br>                  size * 0.6,<br>                  size * 0.04,<br>                  w,<br>                  h,<br>                ],<br>                [image],<br>              );<br>              paint.setShader(shader);<br>              canvas.drawRect(Skia.XYWHRect(0, 0, w, h), paint);<br>            });<br>            frame.dispose();<br>          }}<br>        /&gt;<br>      &lt;/GestureDetector&gt;<br>      {showChrome &amp;&amp; (<br>        &lt;Pressable<br>          style={[styles.flip, { top: insets.top + 12 }]}<br>          onPress={() =&gt; setPosition(p =&gt; (p === &#39;front&#39; ? &#39;back&#39; : &#39;front&#39;))}<br>        &gt;<br>          &lt;Text style={styles.flipText}&gt;<br>            {position === &#39;front&#39; ? &#39;Back camera&#39; : &#39;Front camera&#39;}<br>          &lt;/Text&gt;<br>        &lt;/Pressable&gt;<br>      )}<br>    &lt;/View&gt;<br>  );<br>}<br><br>const styles = StyleSheet.create({<br>  root: {<br>    flex: 1,<br>    backgroundColor: &#39;#000000&#39;,<br>  },<br>  center: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>    padding: 24,<br>    backgroundColor: &#39;#000000&#39;,<br>  },<br>  message: {<br>    color: &#39;#ffffff&#39;,<br>    fontSize: 16,<br>    textAlign: &#39;center&#39;,<br>  },<br>  hint: {<br>    marginTop: 8,<br>    color: &#39;#9a9a9a&#39;,<br>    fontSize: 13,<br>  },<br>  button: {<br>    marginTop: 16,<br>    paddingHorizontal: 20,<br>    paddingVertical: 10,<br>    borderRadius: 999,<br>    backgroundColor: &#39;#ffffff&#39;,<br>  },<br>  buttonText: {<br>    color: &#39;#000000&#39;,<br>    fontWeight: &#39;600&#39;,<br>  },<br>  flip: {<br>    position: &#39;absolute&#39;,<br>    right: 16,<br>    paddingHorizontal: 14,<br>    paddingVertical: 8,<br>    borderRadius: 999,<br>    backgroundColor: &#39;rgba(20,20,20,0.7)&#39;,<br>  },<br>  flipText: {<br>    color: &#39;#ffffff&#39;,<br>    fontSize: 13,<br>    fontWeight: &#39;600&#39;,<br>  },<br>});</pre><p>Uniforms are passed to makeShaderWithChildren as a flat number array, in the same order they&#39;re declared in the shader: light (3 numbers), falloff, orbRadius, size (2 numbers). The camera frame is the child shader.</p><p>Note: the simulator has no camera. Run this part on a real iPhone (open ios/YourApp.xcworkspace in Xcode, choose your Team, select your phone, and press Run).</p><h3>Step 5: Put the scenes behind tabs</h3><pre>// App.tsx<br>import React, { useState } from &#39;react&#39;;<br>import { Pressable, StyleSheet, Text, View } from &#39;react-native&#39;;<br>import { GestureHandlerRootView } from &#39;react-native-gesture-handler&#39;;<br>import { SafeAreaProvider } from &#39;react-native-safe-area-context&#39;;<br>import { RelightPortrait } from &#39;./src/skiaShowcase/relight/RelightPortrait&#39;;<br>import { CameraRelight } from &#39;./src/skiaShowcase/camera/CameraRelight&#39;;<br><br>export default function App() {<br>  const [tab, setTab] = useState&lt;&#39;photo&#39; | &#39;camera&#39;&gt;(&#39;photo&#39;);<br>  return (<br>    &lt;GestureHandlerRootView style={styles.root}&gt;<br>      &lt;SafeAreaProvider&gt;<br>        &lt;View style={styles.root}&gt;<br>          {tab === &#39;photo&#39; ? &lt;RelightPortrait /&gt; : &lt;CameraRelight /&gt;}<br>          &lt;View style={styles.bar}&gt;<br>            {([&#39;photo&#39;, &#39;camera&#39;] as const).map(t =&gt; (<br>              &lt;Pressable<br>                key={t}<br>                onPress={() =&gt; setTab(t)}<br>                style={[styles.pill, tab === t &amp;&amp; styles.active]}<br>              &gt;<br>                &lt;Text style={[styles.label, tab === t &amp;&amp; styles.activeLabel]}&gt;<br>                  {t === &#39;photo&#39; ? &#39;Relight&#39; : &#39;Camera&#39;}<br>                &lt;/Text&gt;<br>              &lt;/Pressable&gt;<br>            ))}<br>          &lt;/View&gt;<br>        &lt;/View&gt;<br>      &lt;/SafeAreaProvider&gt;<br>    &lt;/GestureHandlerRootView&gt;<br>  );<br>}<br><br>const styles = StyleSheet.create({<br>  root: { flex: 1, backgroundColor: &#39;#000&#39; },<br>  bar: {<br>    position: &#39;absolute&#39;,<br>    bottom: 40,<br>    alignSelf: &#39;center&#39;,<br>    flexDirection: &#39;row&#39;,<br>    gap: 6,<br>    padding: 5,<br>    borderRadius: 999,<br>    backgroundColor: &#39;rgba(20,20,20,0.82)&#39;,<br>  },<br>  pill: { paddingHorizontal: 16, paddingVertical: 8, borderRadius: 999 },<br>  active: { backgroundColor: &#39;#fff&#39; },<br>  label: { color: &#39;#bdbdbd&#39;, fontWeight: &#39;600&#39; },<br>  activeLabel: { color: &#39;#000&#39; },<br>});</pre><h3>Problems I hit</h3><ol><li><strong>Contour lines on my shirt:</strong> that’s 8-bit banding from differentiating a PNG height map in the shader. The fix was baking a float-precision normal map offline.</li><li><strong>A dark rim around my silhouette:</strong> a square-root falloff from the edge has infinite slope at the boundary. A quadratic falloff fixes it.</li><li><strong>A strange band at the bottom of the photo:</strong> morphology eats into the mask where my body meets the frame. Pad the mask before running it.</li><li><strong>Embossed “tin foil” look on the painting:</strong> I smoothed the brightness over a wider radius and cut the bump strength.</li><li><strong>Build issues with Xcode 27:</strong> see Part 1. Raise old pod deployment targets to 15.1, reset Watchman after big installs, and build with xcodebuild if run-ios can&#39;t find Simulator.app.</li></ol><h3>What’s next</h3><p>The iPhone’s front TrueDepth camera can stream real depth, and VisionCamera exposes it via useDepthOutput. With real depth, the light could truly wrap around the face and even pass behind the head, like the orb does in William&#39;s demo. That&#39;s my next experiment.</p><h3>Credits</h3><ul><li>Inspiration: William Candillon, React Native Skia 3.0 talk, <a href="https://youtube.com/watch?v=L-PNQi1nBSA">https://youtube.com/watch?v=L-PNQi1nBSA</a></li><li>React Native Skia: <a href="https://github.com/Shopify/react-native-skia">https://github.com/Shopify/react-native-skia</a></li><li>Skia: <a href="https://skia.org/">https://skia.org</a></li><li>VisionCamera (Marc Rousavy): <a href="https://github.com/mrousavy/react-native-vision-camera">https://github.com/mrousavy/react-native-vision-camera</a></li><li>Reanimated &amp; Worklets: Software Mansion</li><li>“Girl with a Pearl Earring”, Johannes Vermeer, c. 1665 (public domain)</li></ul><h3>Let’s work together</h3><p>I’m Gowtham, a React Native developer. I’m open to freelance work: animations, Skia shaders, camera features, performance, or full apps from idea to store. Message me here or on LinkedIn.</p><p>Follow me for more videos, breakdowns and source code on creative coding with React Native.</p><p>YouTube : <a href="https://www.youtube.com/@learn_with_gowtham">https://www.youtube.com/@learn_with_gowtham</a><br>LinkedIn : <a href="https://www.linkedin.com/in/gowthamjagan/">https://www.linkedin.com/in/gowthamjagan/</a><br>GitHub : <a href="https://github.com/Gowtham8940">https://github.com/Gowtham8940</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0258b1b73d4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Turned My Bio Into a Statue of Me: A Letters-to-Portrait Animation with React Native Skia]]></title>
            <link>https://medium.com/@gowthamjaganthan/i-turned-my-bio-into-a-statue-of-me-a-letters-to-portrait-animation-with-react-native-skia-d22b815bc726?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/d22b815bc726</guid>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react-native-skia]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[2d-animation]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Sat, 03 Oct 2026 17:22:27 GMT</pubDate>
            <atom:updated>2026-10-03T17:22:27.294Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Subtitle:</strong> Thousands of letters, one GPU canvas, a page of text that spins into a storm and settles into my face. Inspired by William Candillon’s React Native Skia 3.0 talk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sSHjRgOmChLhJPsyIlP2Cg.png" /></figure><h3>Where this started</h3><p>A few weeks ago I watched William Candillon introduce React Native Skia 3.0. One moment stuck with me: a page of printed text breaks apart letter by letter, swirls through an hourglass-shaped vortex, and settles into a 3D statue of the Venus de Milo built entirely from those letters.</p><p>I wanted to know if I could build that myself, in a normal React Native app, with today’s stable Skia release. Then I wanted to push it further: what if the statue was me, and the text was my own story?</p><p>This article walks through the whole thing from zero to working app, with every line of code.</p><p>[IMAGE: Reference: screenshot from William Candillon’s talk showing the text page breaking apart. Caption: “Inspiration: React Native Skia 3.0 talk by William Candillon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1G4GqWGJ1rgVH8ZcVR5icA.png" /></figure><h3>Credits first</h3><ul><li><strong>William Candillon</strong>, for the original idea and the talk that inspired this: <a href="https://youtube.com/watch?v=L-PNQi1nBSA">https://youtube.com/watch?v=L-PNQi1nBSA</a>. If you don’t follow his “Can it be done in React Native?” channel yet, you should.</li><li><strong>React Native Skia</strong> by Shopify and William Candillon: <a href="https://github.com/Shopify/react-native-skia">https://github.com/Shopify/react-native-skia</a>. Docs: <a href="https://shopify.github.io/react-native-skia">https://shopify.github.io/react-native-skia</a></li><li><strong>Skia</strong>, Google’s 2D graphics engine that powers Chrome, Android and Flutter: <a href="https://skia.org/">https://skia.org</a></li><li><strong>Reanimated &amp; Worklets</strong> by Software Mansion, which let all of this run on the UI thread.</li><li>The Venus de Milo lives in the Louvre. My version of it here is procedural; no 3D scan was used.</li></ul><p>All the code below is my own recreation. None of it is copied from the talk.</p><h3>What we’re building</h3><ol><li>A page of text (my bio) laid out like a printed page, tilting back in 3D.</li><li>The letters peel off and spin into an hourglass vortex.</li><li>They settle into a 3D point cloud, either a procedural Venus-style statue or a portrait generated from my photo, shaded like a pencil drawing.</li><li>An end card fades in: name, role, “Open to freelance · Follow for more”.</li><li>Then it all plays in reverse and loops. Tap to replay, drag to rotate.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*7SX_IettASTIGvjCytq8YA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*RG9fm-7n3JU3e-e6NeuH8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*oVxC-v2RXQnePYIfP35rZw.png" /></figure><p>“The input: one photo against a plain wall”</p><p>Prototype, three frames side by side: page, vortex, portrait</p><h3>The core idea in one paragraph</h3><p>Every letter is one sprite. I draw each character once into a small offscreen image (a “glyph atlas”), then render all ~4,800 letters in a single Skia Atlas draw call. Every frame, a Reanimated worklet on the UI thread computes each letter’s 3D position, projects it to the screen with simple perspective, and writes the result into two buffers: an RSXform (position, scale, rotation) and a sprite rectangle (which character, which shade). The React tree never re-renders; only the GPU buffers change.</p><h3>Step 1: Set up the project</h3><p>I used React Native 0.85, but any recent New Architecture app works.</p><pre>npm install @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler</pre><pre>cd ios &amp;&amp; pod install &amp;&amp; cd ..</pre><p>Versions I used: @shopify/react-native-skia 2.14.0, react-native-reanimated 4.3.1, react-native-worklets 0.8.3, react-native-gesture-handler 2.x.</p><p>Add the worklets Babel plugin (it must be last) in babel.config.js:</p><pre>module.exports = {<br>  presets: [&#39;module:@react-native/babel-preset&#39;],<br>  plugins: [&#39;react-native-worklets/plugin&#39;],<br>};</pre><p>Note: Skia 3.0 from the talk wasn’t on npm when I built this, so I used 2.14.0. Everything here (Atlas, buffers, runtime shaders) carries over.</p><p>Folder layout:</p><pre>src/skiaShowcase/letters/<br>  text.ts<br>  glyphAtlas.ts<br>  statueCloud.ts<br>  portraitCloud.ts<br>  portraitPoints.json   (generated in step 5)<br>  LettersToStatue.tsx<br>scripts/portrait/build_portrait.py</pre><h3>Step 2: The text</h3><p>Every non-space character becomes one glyph in the final point cloud. Change this to your own story.</p><pre>// src/skiaShowcase/letters/text.ts<br>// Every non-space character becomes one glyph in the point cloud.<br>export const TITLE = &#39;GOWTHAM&#39;;<br><br>export const BODY =<br>  &quot;Hi, I&#39;m Gowtham, a React Native developer who loves building smooth, &quot; +<br>  &#39;animated, pixel-perfect mobile apps. Everything you are watching right &#39; +<br>  &#39;now is drawn with React Native Skia: thousands of letters on a single GPU &#39; +<br>  &#39;canvas, moved every frame on the UI thread with Reanimated worklets. &#39; +<br>  &#39;These letters started as a page of text, spun into a storm, and settled &#39; +<br>  &#39;into a portrait built from my own photo. I build mobile apps end to end, &#39; +<br>  &#39;from gestures, animations and shaders to Firebase backends and store &#39; +<br>  &#39;releases. I am open to freelance work: if you need a React Native app &#39; +<br>  &#39;built, polished or made faster, send me a message and let us talk. &#39; +<br>  &#39;Follow me for more videos, breakdowns and source code on creative &#39; +<br>  &#39;coding with React Native. &#39;;<br><br>// End card shown once the portrait has formed.<br>export const END_CARD = {<br>  name: &#39;Gowtham&#39;,<br>  role: &#39;React Native Developer&#39;,<br>  cta: &#39;Open to freelance  ·  Follow for more&#39;,<br>};</pre><h3>Step 3: The glyph atlas</h3><p>Instead of drawing text 4,800 times per frame, I rasterize each unique character once into an offscreen Skia surface.</p><p>The trick: each character is drawn five times, in five ink opacities. Picking a row per letter per frame gives me lighting and depth fog with zero per-sprite colour work.</p><pre>// src/skiaShowcase/letters/glyphAtlas.ts<br>import { Platform } from &#39;react-native&#39;;<br>import { Skia, matchFont, type SkImage } from &#39;@shopify/react-native-skia&#39;;<br><br>// Glyphs are rasterised once at this size and scaled down per sprite.<br>export const ATLAS_FONT_SIZE = 40;<br>export const CELL_W = 48;<br>export const CELL_H = 56;<br>export const COLUMNS = 16;<br>// Ink opacity per shade row, darkest first. The renderer picks a row per<br>// glyph per frame to fake lighting + depth fog without per-sprite colors.<br>export const SHADES = [1, 0.74, 0.5, 0.3, 0.14];<br><br>export type GlyphAtlas = {<br>  image: SkImage;<br>  // char -&gt; cell index<br>  index: Map&lt;string, number&gt;;<br>  // advance width at ATLAS_FONT_SIZE, per cell index<br>  advances: number[];<br>};<br><br>export const atlasFontFamily = Platform.select({<br>  ios: &#39;Georgia&#39;,<br>  default: &#39;serif&#39;,<br>});<br><br>export function buildGlyphAtlas(chars: string[]): GlyphAtlas | null {<br>  const font = matchFont({<br>    fontFamily: atlasFontFamily,<br>    fontSize: ATLAS_FONT_SIZE,<br>  });<br>  const unique = Array.from(new Set(chars));<br>  const rows = Math.ceil(unique.length / COLUMNS);<br>  const width = COLUMNS * CELL_W;<br>  const height = rows * SHADES.length * CELL_H;<br><br>const surface = Skia.Surface.MakeOffscreen(width, height);<br>  if (!surface) {<br>    return null;<br>  }<br>  const canvas = surface.getCanvas();<br>  canvas.clear(Skia.Color(&#39;transparent&#39;));<br>  const paint = Skia.Paint();<br>  paint.setAntiAlias(true);<br><br>const index = new Map&lt;string, number&gt;();<br>  const advances: number[] = [];<br>  unique.forEach((ch, i) =&gt; {<br>    index.set(ch, i);<br>    const w = font.measureText(ch).width;<br>    advances.push(w);<br>    const col = i % COLUMNS;<br>    const row = Math.floor(i / COLUMNS);<br>    SHADES.forEach((alpha, s) =&gt; {<br>      paint.setColor(Skia.Color(`rgba(0,0,0,${alpha})`));<br>      const x = col * CELL_W + (CELL_W - w) / 2;<br>      const baseline = (row * SHADES.length + s) * CELL_H + CELL_H * 0.72;<br>      canvas.drawText(ch, x, baseline, paint, font);<br>    });<br>  });<br>  surface.flush();<br>  // A texture-backed image is tied to this thread&#39;s GPU context; copy it to<br>  // CPU memory so the UI-thread canvas can sample it safely.<br>  const image = surface.makeImageSnapshot().makeNonTextureImage();<br>  return image ? { image, index, advances } : null;<br>}</pre><p>makeNonTextureImage() matters. The offscreen surface lives on the JS thread&#39;s GPU context, while the canvas renders on the UI thread, so I copy the image to CPU memory to make it safe to share.</p><h3>Step 4: A procedural statue</h3><p>I didn’t have a 3D scan of the Venus de Milo, so I built a “statue” from maths. It’s a lathe surface: a profile curve of radius against height, with drapery folds below the hips, a head, a hair bun, arm stumps, and a plinth. Each point also stores a surface normal so it can be shaded.</p><pre>// src/skiaShowcase/letters/statueCloud.ts<br>/**<br> * Procedural, Venus-de-Milo-like point cloud.<br> *<br> * World space: y is up, the figure spans roughly y ∈ [-1, 0.92].<br> * Each point carries a surface normal so the renderer can shade it.<br> *<br> * Want the real statue? Export the vertices of a scanned model<br> * (e.g. a public-domain scan from Scan The World) into the same<br> * { positions, normals } layout and return it from `makeStatueCloud`.<br> */<br><br>export type PointCloud = {<br>  // xyz triplets, length = count * 3<br>  positions: number[];<br>  normals: number[];<br>  // optional ink darkness per point (0..1); when present it drives shading<br>  tones?: number[];<br>};<br><br>// Deterministic RNG so the statue looks identical on every run.<br>/* eslint-disable no-bitwise */<br>export function mulberry32(seed: number) {<br>  let a = seed;<br>  return () =&gt; {<br>    a |= 0;<br>    a = (a + 0x6d2b79f5) | 0;<br>    let t = Math.imul(a ^ (a &gt;&gt;&gt; 15), 1 | a);<br>    t = (t + Math.imul(t ^ (t &gt;&gt;&gt; 7), 61 | t)) ^ t;<br>    return ((t ^ (t &gt;&gt;&gt; 14)) &gt;&gt;&gt; 0) / 4294967296;<br>  };<br>}<br>/* eslint-enable no-bitwise */<br><br>// [y, radiusX, radiusZ, centerX, centerZ]<br>const PROFILE: [number, number, number, number, number][] = [<br>  [-0.9, 0.34, 0.27, 0.0, 0.0], // drapery pooling on the plinth<br>  [-0.62, 0.29, 0.23, 0.02, -0.01],<br>  [-0.34, 0.26, 0.22, 0.04, -0.03], // bent knee pushes forward<br>  [-0.05, 0.28, 0.21, 0.03, 0.0],<br>  [0.03, 0.3, 0.22, 0.02, 0.0], // rolled drapery at the hips<br>  [0.13, 0.24, 0.18, 0.01, 0.0],<br>  [0.26, 0.18, 0.14, 0.0, 0.0], // waist<br>  [0.42, 0.21, 0.15, -0.01, 0.0], // chest<br>  [0.53, 0.25, 0.14, -0.02, 0.0], // shoulders<br>  [0.6, 0.19, 0.12, -0.02, 0.0],<br>  [0.64, 0.075, 0.07, -0.03, 0.0], // neck<br>  [0.7, 0.07, 0.07, -0.04, 0.0],<br>];<br><br>const Y_MIN = PROFILE[0][0];<br>const Y_MAX = PROFILE[PROFILE.length - 1][0];<br><br>function profileAt(y: number) {<br>  for (let i = 0; i &lt; PROFILE.length - 1; i++) {<br>    const a = PROFILE[i];<br>    const b = PROFILE[i + 1];<br>    if (y &gt;= a[0] &amp;&amp; y &lt;= b[0]) {<br>      const t = (y - a[0]) / (b[0] - a[0]);<br>      // smoothstep between keyframes for softer anatomy<br>      const s = t * t * (3 - 2 * t);<br>      return {<br>        rx: a[1] + (b[1] - a[1]) * s,<br>        rz: a[2] + (b[2] - a[2]) * s,<br>        cx: a[3] + (b[3] - a[3]) * s,<br>        cz: a[4] + (b[4] - a[4]) * s,<br>      };<br>    }<br>  }<br>  const last = PROFILE[PROFILE.length - 1];<br>  return { rx: last[1], rz: last[2], cx: last[3], cz: last[4] };<br>}<br><br>function normalize(x: number, y: number, z: number): [number, number, number] {<br>  const l = Math.hypot(x, y, z) || 1;<br>  return [x / l, y / l, z / l];<br>}<br><br>export function makeStatueCloud(count: number, seed = 7): PointCloud {<br>  const rand = mulberry32(seed);<br>  const positions: number[] = [];<br>  const normals: number[] = [];<br>  const push = (<br>    p: [number, number, number],<br>    n: [number, number, number],<br>  ) =&gt; {<br>    positions.push(p[0], p[1], p[2]);<br>    normals.push(n[0], n[1], n[2]);<br>  };<br><br>  const plinth = Math.round(count * 0.1);<br>  const head = Math.round(count * 0.1);<br>  const arms = Math.round(count * 0.05);<br>  const body = count - plinth - head - arms;<br><br>// Body: lathe surface with drapery folds below the hips.<br>  const maxPerimeter = 0.34 + 0.27;<br>  let made = 0;<br>  while (made &lt; body) {<br>    const y = Y_MIN + rand() * (Y_MAX - Y_MIN);<br>    const { rx, rz, cx, cz } = profileAt(y);<br>    // rejection sample so density is uniform across the surface<br>    if (rand() &gt; (rx + rz) / maxPerimeter) {<br>      continue;<br>    }<br>    const theta = rand() * Math.PI * 2;<br>    const drape = y &lt; 0.06 ? 1 : 0;<br>    const fold =<br>      1 +<br>      drape * 0.07 * Math.sin(9 * theta + 7 * y) +<br>      0.03 * Math.exp(-(((y - 0.03) / 0.04) ** 2));<br>    const x = cx + Math.cos(theta) * rx * fold;<br>    const z = cz + Math.sin(theta) * rz * fold;<br>    push(<br>      [x, y, z],<br>      normalize(Math.cos(theta) / rx, 0.05, Math.sin(theta) / rz),<br>    );<br>    made++;<br>  }<br><br>// Head (slightly turned and tilted) plus a hair bun.<br>  for (let i = 0; i &lt; head; i++) {<br>    const bun = i &lt; head * 0.2;<br>    const u = rand() * 2 - 1;<br>    const phi = rand() * Math.PI * 2;<br>    const r = Math.sqrt(1 - u * u);<br>    const nx = r * Math.cos(phi);<br>    const ny = u;<br>    const nz = r * Math.sin(phi);<br>    const c = bun ? [-0.06, 0.87, 0.08] : [-0.05, 0.79, -0.01];<br>    const s = bun ? [0.055, 0.05, 0.055] : [0.095, 0.115, 0.1];<br>    push(<br>      [c[0] + nx * s[0], c[1] + ny * s[1], c[2] + nz * s[2]],<br>      normalize(nx, ny, nz),<br>    );<br>  }<br><br>// Arm stumps — she famously has none.<br>  const stumps = [<br>    { from: [0.24, 0.53, 0.0], to: [0.31, 0.41, -0.03], r: 0.055 },<br>    { from: [-0.24, 0.53, 0.0], to: [-0.28, 0.46, -0.04], r: 0.055 },<br>  ];<br>  for (let i = 0; i &lt; arms; i++) {<br>    const a = stumps[i % 2];<br>    const t = rand();<br>    const theta = rand() * Math.PI * 2;<br>    const cx = a.from[0] + (a.to[0] - a.from[0]) * t;<br>    const cy = a.from[1] + (a.to[1] - a.from[1]) * t;<br>    const cz = a.from[2] + (a.to[2] - a.from[2]) * t;<br>    const nx = Math.cos(theta);<br>    const nz = Math.sin(theta);<br>    push([cx + nx * a.r, cy, cz + nz * a.r], normalize(nx, 0, nz));<br>  }<br><br>// Plinth: top face + four sides.<br>  const hx = 0.4;<br>  const hz = 0.3;<br>  const top = -0.9;<br>  const bottom = -1.0;<br>  for (let i = 0; i &lt; plinth; i++) {<br>    if (rand() &lt; 0.45) {<br>      push(<br>        [(rand() * 2 - 1) * hx, top, (rand() * 2 - 1) * hz],<br>        [0, 1, 0],<br>      );<br>      continue;<br>    }<br>    const y = bottom + rand() * (top - bottom);<br>    const side = Math.floor(rand() * 4);<br>    const t = rand() * 2 - 1;<br>    if (side === 0) {<br>      push([hx, y, t * hz], [1, 0, 0]);<br>    } else if (side === 1) {<br>      push([-hx, y, t * hz], [-1, 0, 0]);<br>    } else if (side === 2) {<br>      push([t * hx, y, hz], [0, 0, 1]);<br>    } else {<br>      push([t * hx, y, -hz], [0, 0, -1]);<br>    }<br>  }<br><br>return { positions, normals };<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*Pxur1wJc3Gux2HXy64RMxg.png" /></figure><h3>Step 5: Turning my photo into a point cloud</h3><p>This is where it becomes personal. A small Python script reads my photo and does four things:</p><ol><li>Separates me from the background. My wall is neutral grey and my shirt is slightly blue, so a colour test is enough; no ML model needed.</li><li>Builds a soft 3D “relief” from the silhouette using a distance transform, so the portrait has volume and can sway.</li><li>Stipples the photo: it places more letters where the photo is dark (hair, eyes, beard) and along edges. Density alone draws my face.</li><li>Saves each point’s darkness (“tone”) so the renderer can pick darker or lighter ink.</li></ol><p>It also writes the photo and a normal map, which Part 2 (relighting) uses.</p><p>Install the dependencies once:</p><pre>python3 -m venv .venv &amp;&amp; .venv/bin/pip install numpy pillow scipy<br><br># scripts/portrait/build_portrait.py<br>&quot;&quot;&quot;<br>Turns a portrait photo into the assets used by the Skia showcase:<br><br>src/skiaShowcase/assets/portrait.jpg        the photo (relight scene)<br>  src/skiaShowcase/assets/portraitNormals.png a normal map (relight scene)<br>  src/skiaShowcase/letters/portraitPoints.json point cloud (letters scene)<br><br>Usage:<br>  python3 -m venv .venv &amp;&amp; .venv/bin/pip install numpy pillow scipy<br>  .venv/bin/python scripts/portrait/build_portrait.py path/to/photo.jpg<br>Works best with a plain, light, neutral background (a wall or backdrop).<br>&quot;&quot;&quot;<br>import json<br>import sys<br>from pathlib import Path<br>import numpy as np<br>from PIL import Image<br>from scipy import ndimage<br>ROOT = Path(__file__).resolve().parents[2]<br>ASSETS = ROOT / &quot;src/skiaShowcase/assets&quot;<br>CLOUD = ROOT / &quot;src/skiaShowcase/letters/portraitPoints.json&quot;<br>GRID = 260  # analysis resolution<br>POINTS = 7000  # candidates; the app uses the first N<br>WORLD = 1.4  # world-space height of the portrait<br><br>def person_mask(rgb: np.ndarray) -&gt; np.ndarray:<br>    r, g, b = rgb[..., 0], rgb[..., 1], rgb[..., 2]<br>    chroma = rgb.max(-1) - rgb.min(-1)<br>    luma = rgb @ np.array([0.299, 0.587, 0.114])<br>    # background = bright and neutral grey<br>    background = (chroma &lt; 14) &amp; (luma &gt; 150) &amp; ((b - r) &lt; 12)<br>    # pad so morphology doesn&#39;t eat into the body where it meets the frame<br>    pad = 8<br>    mask = np.pad(~background, pad, mode=&quot;edge&quot;)<br>    mask = ndimage.binary_opening(mask, iterations=2)<br>    mask = ndimage.binary_closing(mask, iterations=4)<br>    mask = ndimage.binary_fill_holes(mask)[pad:-pad, pad:-pad]<br>    labels, n = ndimage.label(mask)<br>    if n &gt; 1:<br>        sizes = ndimage.sum(mask, labels, range(1, n + 1))<br>        mask = labels == (1 + int(np.argmax(sizes)))<br>    return mask<br><br>def main(src: str) -&gt; None:<br>    photo = Image.open(src).convert(&quot;RGB&quot;)<br>    ASSETS.mkdir(parents=True, exist_ok=True)<br>    side = min(photo.size)<br>    photo = photo.crop((0, 0, side, side)).resize((960, 960), Image.LANCZOS)<br>    photo.save(ASSETS / &quot;portrait.jpg&quot;, quality=90)<br>   small = np.asarray(photo.resize((GRID, GRID), Image.LANCZOS), dtype=np.float32)<br>    mask = person_mask(small)<br>    luma = (small @ np.array([0.299, 0.587, 0.114])) / 255.0<br>    # Relief: a rounded &quot;pillow&quot; from the silhouette plus a little facial detail.<br>    # The quadratic falloff keeps the slope finite at the edge (no dark rim).<br>    dist = ndimage.distance_transform_edt(mask)<br>    relief = 1 - (1 - np.minimum(dist / 40.0, 1.0)) ** 2<br>    detail = ndimage.gaussian_filter(luma, 1.2) * mask<br>    # Normal map for the relight shader, computed in float at full resolution<br>    # so there is no 8-bit banding in the lighting.<br>    big = np.asarray(photo, dtype=np.float32) @ np.array([0.299, 0.587, 0.114]) / 255<br>    zoom = 960 / GRID<br>    mask_big = ndimage.zoom(mask.astype(np.float32), zoom, order=1)<br>    mask_big = ndimage.gaussian_filter(mask_big, 6) &gt; 0.5  # smooth jagged edge<br>    # the body continues past the frame, so pad with edge values before measuring<br>    pad = 200<br>    dist_big = ndimage.distance_transform_edt(np.pad(mask_big, pad, mode=&quot;edge&quot;))<br>    dist_big = dist_big[pad:-pad, pad:-pad]<br>    relief_big = 1 - (1 - np.minimum(dist_big / (40.0 * zoom), 1.0)) ** 2<br>    relief_big = ndimage.gaussian_filter(relief_big, 4, mode=&quot;nearest&quot;)<br>    mask_big = ndimage.gaussian_filter(mask_big.astype(np.float32), 3)<br>    height = relief_big + ndimage.gaussian_filter(big, 3) * mask_big * 0.04<br>    hy, hx = np.gradient(height)<br>    k = 60.0<br>    n = np.dstack([-hx * k, -hy * k, np.ones_like(height)])<br>    n /= np.linalg.norm(n, axis=2, keepdims=True)<br>    Image.fromarray(((n * 0.5 + 0.5) * 255).round().astype(np.uint8)).save(<br>        ASSETS / &quot;portraitNormals.png&quot;<br>    )<br>    # Normals of the relief surface (z points toward the camera = negative).<br>    depth = relief * 0.22 + detail * 0.04<br>    gy, gx = np.gradient(depth * GRID / WORLD)<br>   # Stippling: more letters where the photo is dark or has edges.<br>    dark = np.clip((0.85 - luma) / 0.7, 0, 1)<br>    edges = ndimage.gaussian_gradient_magnitude(luma, 1.0)<br>    edges = edges / max(edges.max(), 1e-6)<br>    outline = mask &amp; ~ndimage.binary_erosion(mask, iterations=3)<br>    weight = (0.1 + dark ** 1.4 + edges * 0.8 + outline * 1.2) * mask<br>    weight = weight.ravel() / weight.sum()<br>    rng = np.random.default_rng(7)<br>    picks = rng.choice(weight.size, size=POINTS, p=weight)<br>    ys, xs = np.unravel_index(picks, mask.shape)<br>    jx = rng.random(POINTS)<br>    jy = rng.random(POINTS)<br>    positions, normals, tones = [], [], []<br>    for x, y, ox, oy in zip(xs, ys, jx, jy):<br>        u = (x + ox) / GRID<br>        v = (y + oy) / GRID<br>        n = np.array([-gx[y, x], gy[y, x], -1.0])<br>        n /= np.linalg.norm(n)<br>        positions += [(u - 0.5) * WORLD, (0.5 - v) * WORLD, -depth[y, x]]<br>        normals += list(n)<br>        tones.append(dark[y, x])<br>    CLOUD.write_text(<br>        json.dumps(<br>            {<br>                &quot;positions&quot;: [round(float(p), 4) for p in positions],<br>                &quot;normals&quot;: [round(float(p), 3) for p in normals],<br>                &quot;tones&quot;: [round(float(p), 3) for p in tones],<br>            },<br>            separators=(&quot;,&quot;, &quot;:&quot;),<br>        )<br>    )<br>    print(f&quot;mask coverage {mask.mean():.0%}, wrote {POINTS} points&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    main(sys.argv[1])</pre><p>Run it with your photo:</p><pre>.venv/bin/python scripts/portrait/build_portrait.py path/to/your-photo.jpg</pre><p>Then a tiny loader. The points are already shuffled, so taking the first N keeps the same look at any density:</p><pre>// src/skiaShowcase/letters/portraitCloud.ts<br>import type { PointCloud } from &#39;./statueCloud&#39;;<br>import data from &#39;./portraitPoints.json&#39;;/**<br> * Point cloud generated from a photo by scripts/portrait/build_portrait.py.<br> * Points are already shuffled and stippled (denser where the photo is dark),<br> * so taking the first `count` keeps the same look at any density.<br> */<br>export function makePortraitCloud(count: number): PointCloud {<br>  const available = data.tones.length;<br>  const positions: number[] = [];<br>  const normals: number[] = [];<br>  const tones: number[] = [];<br>  for (let i = 0; i &lt; count; i++) {<br>    const j = i % available;<br>    positions.push(<br>      data.positions[j * 3],<br>      data.positions[j * 3 + 1],<br>      data.positions[j * 3 + 2],<br>    );<br>    normals.push(<br>      data.normals[j * 3],<br>      data.normals[j * 3 + 1],<br>      data.normals[j * 3 + 2],<br>    );<br>    tones.push(data.tones[j]);<br>  }<br>  return { positions, normals, tones };<br>}</pre><p>One gotcha that cost me a red screen: I first named the data file portraitCloud.json, next to portraitCloud.ts. Metro tries .json before .ts, so import &#39;./portraitCloud&#39; loaded the raw JSON and my function was undefined. Give data files a different name.</p><h3>Step 6: The animation, all on the UI thread</h3><p>This is the heart of it. Here’s what happens:</p><ul><li><strong>Layout (JS thread, once):</strong> I lay the text out like a printed page using real glyph widths, convert every letter’s screen position to 3D “world” coordinates, and give each letter a vortex slot and a statue slot. Everything goes into one flat array, 17 numbers per letter.</li><li><strong>Per frame (UI thread):</strong> a useDerivedValue reads Skia&#39;s useClock() and, for each letter:</li><li>eases from the page position to the vortex (a), then to the statue (b), with per-letter stagger so it feels organic;</li><li>spins the vortex faster at its narrow waist;</li><li>rotates the statue around Y (the portrait sways, because a relief can’t turn all the way round);</li><li>shades it with Lambert lighting, or with the photo tone for the portrait;</li><li>projects it with x&#39; = X · focal / (Z + distance).</li><li><strong>The buffers:</strong> useRSXformBuffer and useRectBuffer read that per-frame array and update Skia&#39;s buffers in place, with no React re-renders.</li></ul><pre>// src/skiaShowcase/letters/LettersToStatue.tsx<br>import React, { useMemo } from &#39;react&#39;;<br>import { StyleSheet, Text, View, useWindowDimensions } from &#39;react-native&#39;;<br>import {<br>  Atlas,<br>  Canvas,<br>  Fill,<br>  useClock,<br>  useRSXformBuffer,<br>  useRectBuffer,<br>} from &#39;@shopify/react-native-skia&#39;;<br>import { Gesture, GestureDetector } from &#39;react-native-gesture-handler&#39;;<br>import Animated, {<br>  useAnimatedStyle,<br>  useDerivedValue,<br>  useSharedValue,<br>} from &#39;react-native-reanimated&#39;;<br>import {<br>  ATLAS_FONT_SIZE,<br>  CELL_H,<br>  CELL_W,<br>  COLUMNS,<br>  SHADES,<br>  atlasFontFamily,<br>  buildGlyphAtlas,<br>} from &#39;./glyphAtlas&#39;;<br>import { makePortraitCloud } from &#39;./portraitCloud&#39;;<br>import { makeStatueCloud, mulberry32 } from &#39;./statueCloud&#39;;<br>import { BODY, END_CARD, TITLE } from &#39;./text&#39;;<br>// &#39;portrait&#39; = built from your photo, &#39;venus&#39; = procedural statue.<br>const SHAPE: &#39;portrait&#39; | &#39;venus&#39; = &#39;portrait&#39;;<br>const IS_PORTRAIT = SHAPE === &#39;portrait&#39;;<br>// world-space size of the shape, used to fit it on screen<br>const SHAPE_H = IS_PORTRAIT ? 1.4 : 1.92;<br>const SHAPE_W = IS_PORTRAIT ? 1.4 : 0.9;<br>// Camera: points are projected with x&#39; = X * FOCAL / (Z + DIST).<br>const DIST = 4;<br>const MAX_GLYPHS = 4800;<br>// Timeline (seconds). The scene plays forward, holds, then plays in reverse.<br>const PAGE_HOLD = 1.4;<br>const SCATTER_SPREAD = 1.6;<br>const SCATTER_DUR = 1.6;<br>const FORM_START = 5.0;<br>const FORM_SPREAD = 2.2;<br>const FORM_DUR = 1.8;<br>const CYCLE = 14;<br>// Per-glyph attributes, packed into one flat array.<br>const STRIDE = 17;<br>const PX = 0; // page position (world, untilted)<br>const PY = 1;<br>const PSCALE = 2; // page glyph scale relative to atlas size<br>const CELL = 3; // atlas cell<br>const ORDER1 = 4; // stagger key: page -&gt; vortex<br>const VH = 5; // vortex height<br>const VANGLE = 6; // vortex start angle<br>const VRAD = 7; // vortex radius<br>const SX = 8; // statue position<br>const SY = 9;<br>const SZ = 10;<br>const NX = 11; // statue normal<br>const NY = 12;<br>const NZ = 13;<br>const ORDER2 = 14; // stagger key: vortex -&gt; statue<br>const RND = 15;<br>const TONE = 16; // photo darkness, or -1 to shade by lighting only<br>// Per-glyph output each frame: x, y, scale, rotation, shade, cell.<br>const OUT = 6;<br>function layoutScene(width: number, height: number) {<br>  const chars = Array.from(new Set((TITLE + BODY).replace(/\s/g, &#39;&#39;)));<br>  const atlas = buildGlyphAtlas(chars);<br>  if (!atlas) {<br>    return null;<br>  }<br> const focal = Math.min(<br>    (height * 0.6 * DIST) / SHAPE_H,<br>    (width * 0.94 * DIST) / SHAPE_W,<br>  );<br>  const cx = width / 2;<br>  const cy = height / 2;<br>  const toWorldX = (px: number) =&gt; ((px - cx) * DIST) / focal;<br>  const toWorldY = (py: number) =&gt; (-(py - cy) * DIST) / focal;<br>  // 1. Lay the text out like a printed page, in screen pixels.<br>  type Glyph = { cell: number; x: number; y: number; size: number; line: number };<br>  const glyphs: Glyph[] = [];<br>  const margin = width * 0.06;<br>  const bodySize = Math.min(Math.max(width / 40, 8.5), 15);<br>  const titleSize = bodySize * 2.6;<br>  const advance = (ch: string, size: number) =&gt; {<br>    const cell = atlas.index.get(ch);<br>    return cell === undefined<br>      ? size * 0.3<br>      : (atlas.advances[cell] * size) / ATLAS_FONT_SIZE;<br>  };<br>// Title, centred, with wide tracking.<br>  const tracking = titleSize * 0.12;<br>  const titleWidth =<br>    TITLE.split(&#39;&#39;).reduce((w, ch) =&gt; w + advance(ch, titleSize) + tracking, 0) -<br>    tracking;<br>  let penX = cx - titleWidth / 2;<br>  let baseline = height * 0.1 + titleSize;<br>  for (const ch of TITLE) {<br>    const w = advance(ch, titleSize);<br>    const cell = atlas.index.get(ch);<br>    if (cell !== undefined) {<br>      glyphs.push({ cell, x: penX + w / 2, y: baseline - titleSize * 0.3, size: titleSize, line: 0 });<br>    }<br>    penX += w + tracking;<br>  }<br> // Body copy, word-wrapped, repeated until the page is full.<br>  const lineHeight = bodySize * 1.4;<br>  const words = BODY.split(&#39; &#39;).filter(Boolean);<br>  let line = 1;<br>  baseline += titleSize * 0.9;<br>  penX = margin;<br>  let w = 0;<br>  while (baseline &lt; height * 0.97 &amp;&amp; glyphs.length &lt; MAX_GLYPHS) {<br>    const word = words[w % words.length];<br>    w++;<br>    const wordWidth = word<br>      .split(&#39;&#39;)<br>      .reduce((acc, ch) =&gt; acc + advance(ch, bodySize), 0);<br>    if (penX + wordWidth &gt; width - margin) {<br>      penX = margin;<br>      baseline += lineHeight;<br>      line++;<br>    }<br>    for (const ch of word) {<br>      const a = advance(ch, bodySize);<br>      const cell = atlas.index.get(ch);<br>      if (cell !== undefined &amp;&amp; glyphs.length &lt; MAX_GLYPHS) {<br>        glyphs.push({ cell, x: penX + a / 2, y: baseline - bodySize * 0.3, size: bodySize, line });<br>      }<br>      penX += a;<br>    }<br>    penX += advance(&#39; &#39;, bodySize);<br>  }<br><br>  // 2. Build the statue with exactly one point per glyph.<br>  const count = glyphs.length;<br>  const statue = IS_PORTRAIT ? makePortraitCloud(count) : makeStatueCloud(count);<br>  const rand = mulberry32(42);<br>  // Shuffle statue slots so neighbouring letters scatter across the body.<br>  const slots = Array.from({ length: count }, (_, i) =&gt; i);<br>  for (let i = count - 1; i &gt; 0; i--) {<br>    const j = Math.floor(rand() * (i + 1));<br>    [slots[i], slots[j]] = [slots[j], slots[i]];<br>  }<br>  const data = new Array&lt;number&gt;(count * STRIDE);<br>  glyphs.forEach((g, i) =&gt; {<br>    const o = i * STRIDE;<br>    const s = slots[i] * 3;<br>    const vh = rand() * 2 - 1;<br>    data[o + PX] = toWorldX(g.x);<br>    data[o + PY] = toWorldY(g.y);<br>    data[o + PSCALE] = g.size / ATLAS_FONT_SIZE;<br>    data[o + CELL] = g.cell;<br>    data[o + ORDER1] = (g.line / line) * 0.75 + rand() * 0.25;<br>    data[o + VH] = vh;<br>    data[o + VANGLE] = rand() * Math.PI * 2;<br>    // hourglass: narrow waist, wide mouths<br>    data[o + VRAD] = (0.06 + 0.95 * Math.pow(Math.abs(vh), 1.5)) * (0.8 + rand() * 0.4);<br>    data[o + SX] = statue.positions[s];<br>    data[o + SY] = statue.positions[s + 1];<br>    data[o + SZ] = statue.positions[s + 2];<br>    data[o + NX] = statue.normals[s];<br>    data[o + NY] = statue.normals[s + 1];<br>    data[o + NZ] = statue.normals[s + 2];<br>    // the statue builds up from the plinth<br>    data[o + ORDER2] = ((statue.positions[s + 1] + 1) / 2) * 0.8 + rand() * 0.2;<br>    data[o + RND] = rand();<br>    data[o + TONE] = statue.tones ? statue.tones[slots[i]] : -1;<br>  });<br><br>return {<br>    atlas,<br>    data,<br>    count,<br>    focal,<br>    cx,<br>    cy,<br>    bodyScale: bodySize / ATLAS_FONT_SIZE,<br>    // statue glyph size in px, tuned so letters tile the surface<br>    statueScale: Math.max(4.5, (focal / DIST) * (IS_PORTRAIT ? 0.024 : 0.028)) / ATLAS_FONT_SIZE,<br>  };<br>}<br>type Scene = NonNullable&lt;ReturnType&lt;typeof layoutScene&gt;&gt;;<br>export function LettersToStatue() {<br>  const { width, height } = useWindowDimensions();<br>  const scene = useMemo(() =&gt; layoutScene(width, height), [width, height]);<br>  if (!scene) {<br>    return null;<br>  }<br>  // Remount on resize so the buffers are re-created with the new count.<br>  return &lt;LettersCanvas key={`${width}x${height}`} scene={scene} /&gt;;<br>}<br>function LettersCanvas({ scene }: { scene: Scene }) {<br>  const { atlas, data, count, focal, cx, cy, bodyScale, statueScale } = scene;<br>  const clock = useClock();<br>  const start = useSharedValue(0);<br>  const yawOffset = useSharedValue(0);<br><br> // Everything below runs on the UI thread, once per frame.<br>  const frame = useDerivedValue(() =&gt; {<br>    const t = (clock.value - start.value) / 1000;<br>    const loop = t % (CYCLE * 2);<br>    // transitions ping-pong; spin and rotation keep moving forward<br>    const te = loop &lt; CYCLE ? loop : CYCLE * 2 - loop;<br>    const ease = (x: number) =&gt; {<br>      const c = x &lt; 0 ? 0 : x &gt; 1 ? 1 : x;<br>      return c &lt; 0.5 ? 4 * c * c * c : 1 - Math.pow(-2 * c + 2, 3) / 2;<br>    };<br>    const tilt = 0.12 + 0.38 * ease(te / 3);<br>    const cosT = Math.cos(tilt);<br>    const sinT = Math.sin(tilt);<br>    // a relief can&#39;t turn all the way round, so the portrait sways instead<br>    const yaw =<br>      (IS_PORTRAIT ? Math.sin((t - 8) * 0.6) * 0.45 : (t - 8) * 0.42) +<br>      yawOffset.value;<br>    const cosY = Math.cos(yaw);<br>    const sinY = Math.sin(yaw);<br>    // key light from the upper left, slightly in front<br>    const lx = -0.55;<br>    const ly = 0.55;<br>    const lz = -0.63;<br>    const vortexScale = bodyScale * 0.7;<br>    const out = new Float32Array(count * OUT);<br>    for (let i = 0; i &lt; count; i++) {<br>      const o = i * STRIDE;<br>      const r = data[o + RND];<br>      const a = ease((te - PAGE_HOLD - data[o + ORDER1] * SCATTER_SPREAD) / SCATTER_DUR);<br>      const b = ease((te - FORM_START - data[o + ORDER2] * FORM_SPREAD) / FORM_DUR);<br>      // page: a sheet tilting away from the camera<br>      const py = data[o + PY];<br>      let x = data[o + PX];<br>      let y = py * cosT;<br>      let z = py * sinT;<br>      let scale = data[o + PSCALE];<br>      let rot = 0;<br>      let shade = z &gt; 0.4 ? Math.min((z - 0.4) * 4, 2) : 0;<br>      // vortex: an hourglass funnel that spins faster at the waist<br>      const vr = data[o + VRAD];<br>      const ang = data[o + VANGLE] + t * (0.8 + 0.45 / (vr + 0.12));<br>      const vx = vr * Math.cos(ang);<br>      const vz = vr * Math.sin(ang) * 0.75;<br>      const vy = data[o + VH] * 1.05;<br>      // letters peel off the page with a little upward kick<br>      const kick = Math.sin(a * Math.PI) * (r - 0.3) * 0.6;<br>      x += (vx - x) * a;<br>      y += (vy - y) * a + kick;<br>      z += (vz - z) * a - kick * 0.5;<br>      scale += (vortexScale - scale) * a;<br>      rot += ((r - 0.5) * 2 + t * (r - 0.5) * 1.5) * a;<br>      const vShade = Math.min(Math.max(((vz + 0.8) / 1.6) * 4, 0), 4);<br>      shade += (vShade - shade) * a;<br>     // statue: rotate the point and its normal around Y<br>      const sx0 = data[o + SX];<br>      const sz0 = data[o + SZ];<br>      const sx = sx0 * cosY - sz0 * sinY;<br>      const sz = sx0 * sinY + sz0 * cosY;<br>      const sy = data[o + SY];<br>      const nx0 = data[o + NX];<br>      const nz0 = data[o + NZ];<br>      const nx = nx0 * cosY - nz0 * sinY;<br>      const nz = nx0 * sinY + nz0 * cosY;<br>      const lambert = Math.max(nx * lx + data[o + NY] * ly + nz * lz, 0);<br>      // back faces stay faint so the form reads as a solid<br>      const tone = data[o + TONE];<br>      const sShade =<br>        tone &gt;= 0<br>          ? Math.min(Math.max(Math.pow(1 - tone, 1.4) * 3.8 + (0.5 - lambert) * 0.8, 0), 4)<br>          : nz &gt; 0.2<br>          ? 3<br>          : Math.min(lambert * 2.2 + Math.max(sz, 0), 3);<br>      x += (sx - x) * b;<br>      y += (sy - y) * b;<br>      z += (sz - z) * b;<br>      scale += (statueScale - scale) * b;<br>      rot += ((r - 0.5) * 0.5 - rot) * b;<br>      shade += (sShade - shade) * b;<br>      const persp = DIST / (z + DIST);<br>      const p = i * OUT;<br>      out[p] = cx + x * focal / (z + DIST);<br>      out[p + 1] = cy - y * focal / (z + DIST);<br>      out[p + 2] = scale * persp;<br>      out[p + 3] = rot;<br>      out[p + 4] = Math.round(shade);<br>      out[p + 5] = data[o + CELL];<br>    }<br>    return out;<br>  });<br>  const halfW = CELL_W / 2;<br>  const halfH = CELL_H / 2;<br>  const transforms = useRSXformBuffer(count, (xf, i) =&gt; {<br>    &#39;worklet&#39;;<br>    const f = frame.value;<br>    const p = i * OUT;<br>    const s = f[p + 2];<br>    const scos = s * Math.cos(f[p + 3]);<br>    const ssin = s * Math.sin(f[p + 3]);<br>    // rotate/scale about the sprite centre<br>    xf.set(<br>      scos,<br>      ssin,<br>      f[p] - (scos * halfW - ssin * halfH),<br>      f[p + 1] - (ssin * halfW + scos * halfH),<br>    );<br>  });<br>  const rows = SHADES.length;<br>  const sprites = useRectBuffer(count, (rect, i) =&gt; {<br>    &#39;worklet&#39;;<br>    const f = frame.value;<br>    const p = i * OUT;<br>    const cell = f[p + 5];<br>    const col = cell % COLUMNS;<br>    const row = Math.floor(cell / COLUMNS);<br>    rect.setXYWH(col * CELL_W, (row * rows + f[p + 4]) * CELL_H, CELL_W, CELL_H);<br>  });<br>  const gesture = Gesture.Exclusive(<br>    Gesture.Pan().onChange(e =&gt; {<br>      yawOffset.value += e.changeX * 0.01;<br>    }),<br>    // tap to replay from the printed page<br>    Gesture.Tap().onEnd(() =&gt; {<br>      start.value = clock.value;<br>      yawOffset.value = 0;<br>    }),<br>  );<br>  // End card fades in once every letter has landed, and out as it reverses.<br>  const formed = FORM_START + FORM_SPREAD + FORM_DUR;<br>  const endCardStyle = useAnimatedStyle(() =&gt; {<br>    const t = (clock.value - start.value) / 1000;<br>    const loop = t % (CYCLE * 2);<br>    const te = loop &lt; CYCLE ? loop : CYCLE * 2 - loop;<br>    const o = Math.min(Math.max(te - formed, 0), 1);<br>    return { opacity: o, transform: [{ translateY: (1 - o) * 12 }] };<br>  });<br>  return (<br>    &lt;View style={styles.canvas}&gt;<br>      &lt;GestureDetector gesture={gesture}&gt;<br>        &lt;Canvas style={styles.canvas}&gt;<br>          &lt;Fill color=&quot;#fbfaf7&quot; /&gt;<br>          &lt;Atlas image={atlas.image} sprites={sprites} transforms={transforms} /&gt;<br>        &lt;/Canvas&gt;<br>      &lt;/GestureDetector&gt;<br>      &lt;Animated.View pointerEvents=&quot;none&quot; style={[styles.endCard, endCardStyle]}&gt;<br>        &lt;Text style={styles.name}&gt;{END_CARD.name}&lt;/Text&gt;<br>        &lt;Text style={styles.role}&gt;{END_CARD.role}&lt;/Text&gt;<br>        &lt;Text style={styles.cta}&gt;{END_CARD.cta}&lt;/Text&gt;<br>      &lt;/Animated.View&gt;<br>    &lt;/View&gt;<br>  );<br>}<br>const styles = StyleSheet.create({<br>  canvas: {<br>    flex: 1,<br>  },<br>  endCard: {<br>    position: &#39;absolute&#39;,<br>    top: &#39;7%&#39;,<br>    left: 0,<br>    right: 0,<br>    alignItems: &#39;center&#39;,<br>  },<br>  name: {<br>    fontFamily: atlasFontFamily,<br>    fontSize: 34,<br>    letterSpacing: 6,<br>    color: &#39;#111111&#39;,<br>  },<br>  role: {<br>    marginTop: 4,<br>    fontSize: 13,<br>    letterSpacing: 2,<br>    textTransform: &#39;uppercase&#39;,<br>    color: &#39;#555555&#39;,<br>  },<br>  cta: {<br>    marginTop: 10,<br>    fontSize: 13,<br>    fontWeight: &#39;600&#39;,<br>    color: &#39;#111111&#39;,<br>  },<br>});</pre><p>A few details worth calling out:</p><ul><li><strong>One RSXform per letter:</strong> RSXform(scos, ssin, tx, ty) is a rotation plus uniform scale plus translation. I offset tx/ty so each sprite rotates around its centre rather than its top-left corner.</li><li><strong>Shading without colours:</strong> the shade value only picks a row in the atlas. Black ink at five opacities on an off-white background looks like a pencil drawing.</li><li><strong>The ping-pong timeline:</strong> transitions play forward, then backward, but the spin and sway keep moving forward. The reverse never looks like a rewound video.</li><li><strong>Venus or me:</strong> switch SHAPE to &#39;venus&#39; and the same pipeline builds the procedural statue.</li></ul><h3>Step 7: Render it</h3><pre>// App.tsx<br>import React from &#39;react&#39;;<br>import { StyleSheet } from &#39;react-native&#39;;<br>import { GestureHandlerRootView } from &#39;react-native-gesture-handler&#39;;<br>import { LettersToStatue } from &#39;./src/skiaShowcase/letters/LettersToStatue&#39;;<br>export default function App() {<br>  return (<br>    &lt;GestureHandlerRootView style={styles.root}&gt;<br>      &lt;LettersToStatue /&gt;<br>    &lt;/GestureHandlerRootView&gt;<br>  );<br>}<br>const styles = StyleSheet.create({<br>  root: { flex: 1 },<br>});</pre><p>Run it:</p><pre>npx react-native run-ios</pre><h3>Problems I hit (so you don’t have to)</h3><ol><li><strong>Xcode 27 rejects old pod deployment targets.</strong> Some Firebase/gRPC pods still target iOS 9–12. I added this inside post_install in the Podfile:</li></ol><pre>installer.pods_project.targets.each do |target|<br>  target.build_configurations.each do |build_config|<br>    current = build_config.build_settings[&#39;IPHONEOS_DEPLOYMENT_TARGET&#39;]<br>    if current.nil? || current.to_f &lt; 15.0<br>      build_config.build_settings[&#39;IPHONEOS_DEPLOYMENT_TARGET&#39;] = &#39;15.1&#39;<br>    end<br>  end<br>end</pre><ol><li><strong>“Unable to resolve module @babel/runtime/helpers/…” even though the file exists.</strong> Watchman dropped file events during a big npm install, so Metro couldn&#39;t see new files. The fix:</li></ol><pre>watchman watch-del &quot;$PWD&quot; &amp;&amp; watchman watch-project &quot;$PWD&quot;</pre><pre>npx react-native start --reset-cache</pre><ol><li><strong>run-ios can&#39;t find Simulator.app on Xcode 27.</strong> Build and install directly instead:</li></ol><pre>cd ios &amp;&amp; xcodebuild -workspace YourApp.xcworkspace -scheme YourApp -configuration Debug -destination &#39;name=iPhone 17 Pro&#39; -derivedDataPath build -quiet &amp;&amp; xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/YourApp.app</pre><ol><li><strong>JSON vs TS resolution in Metro:</strong> don’t put foo.json next to foo.ts (see Step 5).</li></ol><h3>What I learned</h3><ul><li>A single Atlas draw call can move thousands of animated sprites without React re-rendering anything.</li><li>“3D” doesn’t need a 3D engine: a perspective divide, a rotation and Lambert shading go a long way.</li><li>The most personal part, my own face, came from a 100-line Python script with no AI model.</li></ul><p>In Part 2, I use the same photo to build a relightable portrait, then relight my live selfie camera in real time with one Skia shader.</p><h3>Credits</h3><ul><li>Inspiration: William Candillon, React Native Skia 3.0 talk, <a href="https://youtube.com/watch?v=L-PNQi1nBSA">https://youtube.com/watch?v=L-PNQi1nBSA</a></li><li>React Native Skia: <a href="https://github.com/Shopify/react-native-skia">https://github.com/Shopify/react-native-skia</a></li><li>Skia: <a href="https://skia.org/">https://skia.org</a></li><li>Reanimated &amp; Worklets: Software Mansion</li></ul><h3>Let’s work together</h3><p>I’m Gowtham, a React Native developer. I’m open to freelance work: animations, Skia, performance, or full apps from idea to store. Message me here or on LinkedIn.</p><p>Follow me for more videos, breakdowns and source code on creative coding with React Native.</p><p>YouTube : <a href="https://www.youtube.com/@learn_with_gowtham">https://www.youtube.com/@learn_with_gowtham</a><br>LinkedIn : <a href="https://www.linkedin.com/in/gowthamjagan/">https://www.linkedin.com/in/gowthamjagan/</a><br>GitHub : <a href="https://github.com/Gowtham8940">https://github.com/Gowtham8940</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d22b815bc726" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Automated My LinkedIn Posts with Claude: The Complete Setup, My First Post, and Every Mistake…]]></title>
            <link>https://medium.com/@gowthamjaganthan/how-i-automated-my-linkedin-posts-with-claude-the-complete-setup-my-first-post-and-every-mistake-0c1411319fc9?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c1411319fc9</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 16:14:07 GMT</pubDate>
            <atom:updated>2026-09-27T16:14:07.913Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Automated My LinkedIn Posts with Claude: The Complete Setup, My First Post, and Every Mistake I Made</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eQREwYWvO_zbbtZJkz8MDg.jpeg" /></figure><h3>A step-by-step guide you can finish in about 30 minutes, even if you’ve never used an API</h3><p>I wanted Claude to write and publish my LinkedIn posts without me copying and pasting every time. It turned out to be very doable, but I made several mistakes along the way that cost me hours.</p><p>This guide covers the full setup, how I published my first automated post, and exactly what went wrong, so you can skip the painful parts.</p><h3>How It Works</h3><p>The setup has three parts:</p><ol><li><strong>A LinkedIn developer app</strong> gives you an access token that lets software post on your behalf.</li><li><strong>A Claude cloud environment</strong> stores that token securely and allows Claude to reach LinkedIn’s API.</li><li><strong>A Claude Code session</strong> running in that environment drafts your post, shows it to you, and publishes it only after you approve.</li></ol><p>You stay in control the whole time. Nothing goes live without your “approved.”</p><h3>What You Need</h3><ul><li>A <strong>Claude Pro or Max plan</strong>, which is required for Claude Code on the web</li><li>A <strong>LinkedIn account</strong></li><li>A <strong>LinkedIn Page</strong> (a Company or Showcase page). You can create one for free during setup.</li></ul><h3>Step 1: Create a LinkedIn Developer App</h3><ol><li>Go to <strong>linkedin.com/developers/apps</strong> and click <strong>Create app</strong>.</li><li><strong>App name:</strong> anything you like, for example “Your Name Social Automation.”</li><li><strong>LinkedIn Page:</strong> select a <strong>Company Page</strong>. This field doesn’t accept your personal profile URL. If you don’t have a page, click <strong>Create a new LinkedIn Page</strong>, choose Company or Showcase, and create one in about two minutes.</li><li><strong>App logo:</strong> upload any square image of at least 100px.</li><li>Tick the legal agreement and click <strong>Create app</strong>.</li></ol><h3>Step 2: Add the Two Required Products</h3><p>Open your app’s <strong>Products</strong> tab and click <strong>Request access</strong> on both of these:</p><ul><li><strong>Share on LinkedIn</strong>, which gives permission to post</li><li><strong>Sign In with LinkedIn using OpenID Connect</strong>, which gives permission to read your member ID, the author ID every post needs</li></ul><p>Both are usually approved straight away and move to the “Added products” list.</p><h3>Step 3: Generate Your Access Token</h3><ol><li>Open the <strong>Auth</strong> tab. Under <strong>Authorized redirect URLs</strong>, add:<br><a href="https://www.linkedin.com/developers/tools/oauth/redirect"><strong>https://www.linkedin.com/developers/tools/oauth/redirect</strong></a></li><li>Open the token generator at <strong>linkedin.com/developers/tools/oauth/token-generator</strong> and select your app.</li><li>Tick all three scopes together: <strong>openid</strong>, <strong>profile</strong> and <strong>w_member_social</strong>.</li><li>Click <strong>Request access token</strong>, then <strong>Allow</strong>.</li><li>Check that the <strong>Permissions</strong> line lists all three scopes, then click <strong>Copy access token</strong>.</li></ol><p>The token is valid for about <strong>60 days</strong>. Set a reminder to generate a new one before it expires.</p><h3>Step 4: Create a Claude Cloud Environment</h3><ol><li>Go to <strong>claude.ai/code</strong>.</li><li>Click the <strong>cloud icon</strong> above the message box, then <strong>Add cloud environment</strong>.</li><li><strong>Name:</strong> Social Automation</li><li><strong>Network access:</strong> choose <strong>Custom</strong> and add these domains, one per line:</li></ol><ul><li>api.linkedin.com</li><li>linkedin.com</li><li><a href="http://www.linkedin.com/">www.linkedin.com</a></li></ul><p>5. Tick <strong>Also include default list of common package managers</strong>.</p><p><strong>6. Environment variables:</strong> add one line: LINKEDIN_ACCESS_TOKEN=your-token-here</p><p>7. Click <strong>Create environment</strong>.</p><p><strong>Tip:</strong> on Pro and Max plans you can instead store the token under <strong>API credentials</strong>, which you’ll find when you edit the environment. That keeps the token out of the session completely. Set the allowed website to api.linkedin.com, the header to Authorization, and the prefix to Bearer.</p><h3>Step 5: Publish Your First Post</h3><ol><li>At claude.ai/code, start a <strong>new session</strong>.</li><li>Before you type anything, click the <strong>cloud icon</strong> and select <strong>Social Automation</strong>.</li><li>Send a message like this:</li></ol><p><em>“My LinkedIn token is stored as LINKEDIN_ACCESS_TOKEN. First verify it works by calling LinkedIn’s userinfo endpoint and tell me my name. Don’t post anything. Then draft a LinkedIn post about [your topic] in a professional tone with minimal emojis. Publish only after I reply ‘approved’.”</em></p><ol><li>Claude confirms your account name, then shows you the draft.</li><li>Edit anything you like, then reply <strong>approved</strong>.</li></ol><p>That’s how my first automated post went live. From there, every new post is one message and one approval.</p><h3>The Mistakes I Made (So You Don’t Have To)</h3><p><strong>1. I used my profile URL instead of a Company Page.</strong><br>The app form rejects personal profile URLs. You need a LinkedIn Page, and creating one takes two minutes.</p><p><strong>2. I generated the scopes as two separate tokens.</strong><br>My first token had only w_member_social, and my second had only openid and profile. Neither could do the whole job. All three scopes must be in <strong>one</strong> token.</p><p><strong>3. I shared screenshots showing my API keys.</strong><br>I sent screenshots of my developer console to get help, and they showed full keys and tokens. I had to regenerate every one. Blur or crop keys before sharing a screenshot, and never paste keys into a chat. Keys belong only in the environment settings.</p><p><strong>4. I changed the settings but kept using the old session.</strong><br>A session reads its environment once, when it starts. After you change a token or domain, <strong>start a new session</strong>, or Claude will keep using the old values.</p><p><strong>5. I lost hours on X (Twitter).</strong><br>I tried to automate X with the same setup. My keys kept returning <strong>401 “Could not authenticate you.”</strong> I regenerated them several times and even checked that the signing code was correct. It turned out to be a known issue on X’s side: many new <strong>Pay-Per-Use</strong> apps fail user login until X fixes their account setup. If you hit this, check the X Developer Community forum and report your App ID before spending hours on your keys.</p><h3>Keeping It Safe</h3><ul><li><strong>Keep a human approval step.</strong> Let Claude draft and publish, but you decide what goes live.</li><li><strong>Use only the official API.</strong> Browser bots that log in with your password break LinkedIn’s terms and can get your account restricted.</li><li><strong>You can revoke access at any time</strong> under LinkedIn Settings → Data privacy → Permitted services.</li><li><strong>Renew the token every 60 days</strong> by repeating Step 3 and updating the environment variable.</li></ul><h3>Useful Links</h3><ul><li>LinkedIn developer apps: <a href="https://www.linkedin.com/developers/apps">https://www.linkedin.com/developers/apps</a></li><li>LinkedIn token generator: <a href="https://www.linkedin.com/developers/tools/oauth/token-generator">https://www.linkedin.com/developers/tools/oauth/token-generator</a></li><li>LinkedIn Share API docs: <a href="https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin">https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin</a></li><li>Sign In with LinkedIn (OpenID Connect): <a href="https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2">https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2</a></li><li>Claude Code on the web: <a href="https://claude.ai/code">https://claude.ai/code</a></li><li>Configure cloud environments: <a href="https://code.claude.com/docs/en/cloud-environments">https://code.claude.com/docs/en/cloud-environments</a></li><li>X Developer Community: <a href="https://devcommunity.x.com/">https://devcommunity.x.com</a></li></ul><h3>Final Thoughts</h3><p>The whole setup takes about 30 minutes. Most of that is clicking through LinkedIn’s developer portal. Once it’s done, posting becomes a conversation: tell Claude what you want to share, review the draft, and approve it.</p><p>If you set this up, share how it went in the comments. And if you get stuck, the mistakes section above probably covers it.</p><p><em>If you found this useful, follow me for more practical guides on AI tools and developer productivity.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c1411319fc9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Claude’s Hidden “Reset for Free” Button: How to Restore Your Session and Weekly Limits Instantly]]></title>
            <link>https://medium.com/@gowthamjaganthan/claudes-hidden-reset-for-free-button-how-to-restore-your-session-and-weekly-limits-instantly-d1e293faac3b?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1e293faac3b</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[anthropic-claude]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 13:08:58 GMT</pubDate>
            <atom:updated>2026-09-27T13:08:58.599Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0o0Oq6UmeCx07hWkKsBvA.png" /></figure><h3>A setting worth checking before you wait five hours or five days for your usage to come back</h3><p>You are halfway through a coding session or a long document when Claude stops with a familiar message: <strong>“You’ve reached your usage limit.”</strong></p><p>Until recently you had two choices: wait or upgrade. Claude now offers a third: a <strong>free limit reset</strong> that restores your usage to full right away. Few users know about it. This guide explains how it works, where to find it and what to know before you use it.</p><h3>Understanding Claude’s Two Usage Limits</h3><p>Claude measures usage in two ways.</p><p><strong>Current session limit.</strong> This runs on a rolling five-hour window that starts with your first message. If your first message goes out at 9:47 AM, the window resets at 2:47 PM.</p><p><strong>Weekly limit.</strong> This resets at a fixed day and time each week, assigned to your account. It applies to Pro, Max and Team plans.</p><p>You can see both limits, and when each one resets, under <strong>Settings → Usage</strong>.</p><h3>What Is a Limit Reset?</h3><p>From time to time, Anthropic gives eligible plans a <strong>limit reset</strong>. Using it restores either your five-hour session limit or your weekly limit to full capacity, depending on the offer.</p><h3>How to Use It</h3><ol><li>Open Claude in your web browser at claude.ai, or open the Claude Desktop app.</li><li>Go to <strong>Settings → Usage</strong>.</li><li>Find the <strong>Resets</strong> section.</li><li>Click <strong>Reset for free</strong>.</li><li>Click <strong>Reset for free</strong> again to confirm.</li></ol><p>Your limit is restored to full right away.</p><p><em>[Insert screenshot: Settings → Usage → Resets section]</em></p><p><strong>Tip:</strong> You don’t have to reach your limit before using a reset. If a large task is coming up, reset first and start with full capacity.</p><h3>Important Details Before You Use It</h3><ul><li><strong>Availability varies.</strong> Resets go to eligible plans (Pro and Max) from time to time. You can’t request one. If the Resets section isn’t there, no reset is available on your account right now.</li><li><strong>It can’t be undone.</strong> Once confirmed, the reset is used.</li><li><strong>It expires.</strong> An unused reset expires on the date shown in Settings → Usage.</li><li><strong>Web and Desktop only.</strong> The option isn’t available yet in the Claude mobile app or in Claude Code (terminal or IDE).</li><li><strong>Your weekly schedule stays the same.</strong> Weekly limits still reset at their usual time.</li><li><strong>It doesn’t affect billing.</strong> Extra-usage charges you have already paid aren’t refunded, and your credit balance doesn’t change.</li></ul><h3>No Reset Available? Five Ways to Make Your Usage Last Longer</h3><ol><li><strong>Start new conversations regularly.</strong> Long threads send the full history with every message, which uses up your limit faster.</li><li><strong>Combine your questions.</strong> One detailed message costs less than several short follow-ups.</li><li><strong>Use Projects for files you use often.</strong> This saves you from uploading the same documents again and again.</li><li><strong>Choose the right model for the task.</strong> Save the most capable model for complex work.</li><li><strong>Plan around your reset time.</strong> Settings → Usage shows exactly when your session resets, so you can schedule demanding work for right after it.</li></ol><h3>Summary</h3><p>To reset your Claude usage for free, go to <strong>Settings → Usage → Resets</strong>, click <strong>Reset for free</strong> and confirm. Your session or weekly limit goes back to full at no cost, on the web or in Claude Desktop, whenever a reset is available on your account.</p><p>Check your Usage page today. You may already have a reset waiting.</p><p><em>Sources: Claude Help Center, “What is a limit reset?” and “How do usage and length limits work?” Features may change, so check the Claude Help Center for the latest information.</em></p><p><em>If you found this guide useful, follow me for more practical AI productivity tips.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1e293faac3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Cut My App’s Download Size by 44% Without Removing a Single Feature]]></title>
            <link>https://medium.com/@gowthamjaganthan/how-i-cut-my-apps-download-size-by-44-without-removing-a-single-feature-861c0f31984b?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/861c0f31984b</guid>
            <category><![CDATA[skia]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[google-play-store]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Thu, 03 Sep 2026 18:41:13 GMT</pubDate>
            <atom:updated>2026-09-03T18:41:13.780Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LGhKMBGBesjjeqaHW9FPIw.png" /></figure><h3>A React Native + Skia game, a 111 MB bundle that lied to me, and the pixel-level check that found 14 MB in three files.</h3><p>Google Play Console tells you exactly what a user downloads.</p><p>Mine said <strong>31.9 MB</strong>, with an estimated <strong>18-second</strong> download.</p><p>For a 2D game about flicking pens across a school desk, that felt indefensible.</p><p>And app size isn’t just a private engineering detail. It’s one of the numbers users see before deciding whether to install an app.</p><p>Google Play has published that install conversion can drop roughly <strong>1% for every 6 MB of app size</strong>. Treat that as a benchmark rather than a law, but the direction is clear:</p><blockquote><em>On a mid-range phone with a weak connection, size is friction — and friction can become churn.</em></blockquote><p>So I went looking for the weight.</p><p>First, the bundle lied to me</p><p>My release .aab was <strong>111 MB</strong>.</p><p>My first instinct was that something had gone catastrophically wrong.</p><p>It hadn’t.</p><p>An Android App Bundle is a <strong>superset of what users actually download</strong>.</p><p>I started by looking at what was inside the bundle:</p><pre>unzip -v app-release.aab | sort -k1 -nr | head -25</pre><p>Two things dominated the bundle, and <strong>neither ships directly to a user</strong>.</p><p><strong>BUNDLE-METADATA/debugsymbols — 171 MB uncompressed</strong></p><p>These are native debug symbols used by Google Play for crash symbolication. Play strips them before delivering the app.</p><p><strong>base/lib — 127 MB across four CPU architectures</strong></p><p>That included:</p><ul><li>arm64-v8a</li><li>armeabi-v7a</li><li>x86</li><li>x86_64</li></ul><p>A user’s device receives only the relevant architecture.</p><p>So the important lesson was:</p><blockquote><strong><em>Don’t optimise against the size of the </em></strong><strong><em>.aab. Optimise against the actual download size.</em></strong></blockquote><p>Once I calculated the compressed size of the relevant ABI plus the shared components, the real picture appeared.</p><p><strong>Arm64 download:</strong></p><ul><li>Native libraries — <strong>10.9 MB</strong></li><li>Images — <strong>16.0 MB</strong></li><li>DEX — <strong>2.1 MB</strong></li><li>JavaScript bundle — <strong>1.4 MB</strong></li></ul><p><strong>Images were larger than all the native code combined.</strong></p><p>I had assumed Skia’s librnskia.so at <strong>4.9 MB</strong> was my problem.</p><p>It wasn’t even close.</p><h3>Then I found the three files</h3><p>I profiled the assets individually.</p><p>Three files immediately stood out.</p><p><strong>desk_surface.png</strong></p><p>7.65 MB<br>1536 × 2752 pixels<br>Actually drawn at roughly 1000 × 2100</p><p><strong>app_icon.png</strong></p><p>3.58 MB<br>2048 × 2048 pixels<br>Actually displayed at roughly <strong>54 pt</strong></p><p><strong>classroom_bg.png</strong></p><p>2.94 MB<br>1200 × 2150 pixels<br>Used as a full-screen background</p><p>That’s roughly <strong>14 MB in just three files</strong>.</p><p>The app icon was especially painful.</p><p>A <strong>2048 × 2048</strong> image is four million pixels, shipped to every user, only to be rendered inside a circular avatar roughly the size of a thumbnail.</p><p>That made the next question obvious:</p><p><strong>Why were these assets PNGs?</strong></p><h3>The check that actually mattered</h3><p>The obvious suggestion would be:</p><blockquote><em>“Just convert the PNGs to JPEG.”</em></blockquote><p>But that’s not always safe.</p><p>JPEG doesn’t support transparency.</p><p>If an image contains transparent pixels and you flatten it incorrectly, you can end up with an ugly black or white box around your asset.</p><p>So I didn’t guess.</p><p>I checked the pixels.</p><p>PNG stores an alpha value for every pixel. If the minimum alpha value across the entire image is <strong>255</strong>, every pixel is fully opaque.</p><p>That means the image doesn’t actually need transparency.</p><p>I decoded the PNGs and scanned their alpha channels.</p><p>The results:</p><p><strong>classroom_bg.png</strong></p><p>Minimum alpha: <strong>255</strong><br>Transparent pixels: <strong>0.00%</strong></p><p><strong>desk_surface.png</strong></p><p>Minimum alpha: <strong>255</strong><br>Transparent pixels: <strong>0.00%</strong></p><p><strong>app_icon.png</strong></p><p>Minimum alpha: <strong>255</strong><br>Transparent pixels: <strong>0.00%</strong></p><p><strong>pen_classic.png</strong></p><p>Minimum alpha: <strong>0</strong><br>Transparent pixels: <strong>43.90%</strong></p><p>And there it was.</p><p>The three biggest files were <strong>completely opaque</strong>.</p><p>I was paying for lossless PNG compression and an alpha channel on artwork that didn’t actually use transparency.</p><p>The pen sprites were different.</p><p>They had <strong>43.9% transparent pixels</strong>, because they had been chroma-keyed from a solid background.</p><p>Those stayed PNG.</p><p>This distinction is important:</p><blockquote><strong><em>The right image format is a per-file decision, not a per-project decision.</em></strong></blockquote><h3>The fix</h3><p>I’m on macOS, so I didn’t need to install another tool.</p><p>Sips was already there.</p><h3>Opaque backgrounds → JPEG</h3><pre>sips -Z 2150 \<br>  -s format jpeg \<br>  -s formatOptions 80 \<br>  classroom_bg.png \<br>  --out classroom_bg.jpg<br>sips -Z 1900 \<br>  -s format jpeg \<br>  -s formatOptions 78 \<br>  desk_surface.png \<br>  --out desk_surface.jpg<br>sips -Z 256 \<br>  -s format jpeg \<br>  -s formatOptions 88 \<br>  app_icon.png \<br>  --out app_icon.jpg</pre><h3>Sprites → Keep PNG, reduce dimensions</h3><pre>for p in classic ruby reynolds marker gold; do<br>  sips -Z 800 pen_$p.png --out pen_$p.png<br>done</pre><p>There were actually <strong>two separate optimisations</strong> happening here.</p><h3>1. Format</h3><p>Opaque artwork doesn’t need PNG.</p><p>For photographic, painted, textured, or background-style assets, JPEG at a reasonable quality can dramatically reduce size.</p><p>For this game, JPEG quality around <strong>78–82</strong> was more than enough.</p><h3>2. Dimensions</h3><p><strong>Ship the size you actually draw.</strong></p><p>My desk texture was <strong>1536 px wide</strong>, while it rendered at roughly <strong>1000 px</strong>.</p><p>The icon was <strong>2048 × 2048</strong>, while the UI displayed it at around <strong>54 pt</strong>.</p><p>There is no reason to ship print-sized artwork for a small mobile UI element.</p><p>As a rule of thumb, sizing an asset around <strong>1.5–2× its maximum on-screen size</strong> gives you room for high-DPI displays without shipping unnecessary pixels.</p><h3>The results</h3><p>The difference was immediate.</p><p><strong>Images</strong></p><p>Before: <strong>15.96 MB</strong><br>After: <strong>2.54 MB</strong></p><p><strong>New install size</strong></p><p>Before: <strong>31.9 MB</strong><br>After: <strong>17.8 MB</strong></p><p><strong>Estimated download time</strong></p><p>Before: <strong>18 seconds</strong><br>After: <strong>10 seconds</strong></p><h3>Final result</h3><p><strong>14.1 MB removed.</strong></p><p><strong>44% smaller.</strong></p><p><strong>8 seconds faster to download.</strong></p><p>And I didn’t remove a single feature.</p><p>I didn’t redraw the artwork either.</p><p>I compared the screens side by side on a real device:</p><ul><li>Desk grain</li><li>Carved initials</li><li>Ink stains</li><li>Classroom backdrop</li><li>Avatar</li><li>Pen sprites</li></ul><p>I couldn’t tell the difference.</p><h3>Why I stopped at 17.8 MB</h3><p>At this point, the next obvious target was native code.</p><p>The remaining <strong>10.9 MB</strong> included:</p><p><strong>librnskia.so — 4.9 MB</strong></p><p><strong>libreactnative.so — 2.2 MB</strong></p><p><strong>Hermes — 1.0 MB</strong></p><p>That’s part of the cost of running a GPU-rendered React Native game with Skia.</p><p>I’m okay with that.</p><p>I’m not going to sacrifice the renderer just to chase another few megabytes.</p><h3>One optimisation I deliberately didn’t make</h3><p>I also considered removing:</p><ul><li>x86</li><li>x86_64</li></ul><p>from the Android build.</p><p>It sounds like an easy win.</p><p>But it isn’t.</p><p>Removing those architectures can reduce the size of your <strong>uploaded AAB</strong>, but it doesn’t reduce the download size for a typical Android user when Google Play is already serving architecture-specific splits.</p><p>In other words:</p><blockquote><strong><em>Smaller upload ≠ smaller user download.</em></strong></blockquote><p>And removing emulator architectures can make development and testing more painful for the team.</p><p>That’s a fake optimisation if your actual goal is reducing what users download.</p><h3>What I learned</h3><h3>1. Read your bundle, not just its file size</h3><p>A <strong>111 MB AAB</strong> became a <strong>31.9 MB user download</strong>.</p><p>Those are two different numbers describing two different problems.</p><h3>2. Check alpha before assuming you need PNG</h3><p>A single pixel-level check turned:</p><blockquote><em>“I think these images can become JPEGs.”</em></blockquote><p>into:</p><blockquote><em>“These three images contain zero transparent pixels.”</em></blockquote><p>That’s a much better optimisation decision.</p><h3>3. Ship the size you actually draw</h3><p>A <strong>2048 px asset rendered at 54 pt</strong> is a lot of pixels doing almost nothing.</p><p>Don’t ship artwork at dimensions designed for print when the user sees it as a tiny UI element.</p><h3>4. Optimise per asset</h3><p>Don’t decide:</p><blockquote><em>“Our project uses PNG.”</em></blockquote><p>or:</p><blockquote><em>“Our project uses JPEG.”</em></blockquote><p>Instead ask:</p><p><strong>Does this specific asset need transparency?</strong></p><p><strong>What resolution does this specific asset actually need?</strong></p><h3>5. App size is a product metric</h3><p>Size isn’t just an engineering metric buried somewhere in the build pipeline.</p><p>It’s part of the user’s experience.</p><p>A few megabytes can mean:</p><ul><li>Less download time</li><li>Less storage usage</li><li>Less friction on slow networks</li><li>A better first-install experience</li></ul><h3>The takeaway</h3><p>The biggest lesson wasn’t:</p><blockquote><strong><em>“Use JPEG.”</em></strong></blockquote><p>It was:</p><blockquote><strong><em>Measure what the user actually receives, then optimise the pixels you’re paying to ship.</em></strong></blockquote><p>My React Native + Skia game went from:</p><p><strong>31.9 MB → 17.8 MB</strong></p><p>without removing a feature, changing the renderer, or compromising the visual quality I could see on the device.</p><p>Sometimes the biggest performance optimisation isn’t hidden inside your native code.</p><p>Sometimes it’s sitting in an innocent-looking .png file.</p><p><strong>Pen Fight</strong> is a classic last-bench desk game, rebuilt for phones with real physics.</p><p>Free. No ads. No subscriptions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=861c0f31984b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Connected My Gmail to Claude Code.]]></title>
            <link>https://medium.com/@gowthamjaganthan/i-connected-my-gmail-to-claude-code-37349fdb99e7?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/37349fdb99e7</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[gmail]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Tue, 01 Sep 2026 15:43:30 GMT</pubDate>
            <atom:updated>2026-09-01T15:43:30.964Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>I Connected My Gmail to Claude Code. It Cleaned 4,300 Emails — Then Told Me Why My Job Applications Were Failing.</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TOgi-qHGRmiinpX5aTXt-Q.png" /></figure><p>A weekend with a Gmail MCP server: a label system, auto-filters, a brutal cold-email autopsy, and a follow-up bot that writes its own drafts.</p><p>I opened Gmail last Sunday and the unread count said <strong>4,891</strong>.</p><p>I’ve been job hunting for a few months — React Native roles — which means my inbox is now 90% job-board alerts, LinkedIn notifications, and a payment receipt that lands twice a day from a digital-gold app I forgot I subscribed to. Somewhere in that pile were actual recruiters I needed to reply to. I just couldn’t see them.</p><p>So instead of doing the sensible thing and spending an evening with Gmail filters, I did the developer thing: I gave an AI agent access to my mailbox and told it to fix everything.</p><p>Here’s what happened.</p><h3>First, the boring but important part: what’s an MCP server</h3><p>If you’ve used Claude or ChatGPT, you know they can’t <em>do</em> things by default — they can talk about your email, but they can’t touch it.</p><p><strong>MCP (Model Context Protocol)</strong> is the plumbing that changes that. An MCP server is a small program that exposes real capabilities — “search emails”, “create label”, “send draft” — as tools the AI can call. Point your AI client at the server, and suddenly the model can actually operate your Gmail instead of just describing it.</p><p>For Gmail I used an open-source one: @gongrzhe/server-gmail-autoauth-mcp. Setup is the usual Google Cloud song and dance — make a project, enable the Gmail API, create an OAuth client, run one npx command to authorize. Fifteen minutes, most of it clicking through Google consent screens.</p><p>Then I opened Claude Code and typed: <em>“check my mail.”</em></p><h3>The cleanup</h3><p>The agent started by actually reading the mailbox — not the whole thing, but enough to understand the shape of it. It pulled a breakdown of who emails me most:</p><pre>2,566  job-board alerts (Glassdoor, Naukri, foundit, Wellfound, Instahyre...)<br>  675  LinkedIn notifications<br>  319  &quot;Payment successful&quot; receipts<br>  533  newsletters<br>  151  security alerts going back to 2024</pre><p>Then it proposed a label system — nested, so it collapses nicely in the sidebar:</p><pre>Job Search/<br>  ├── Recruiters      (real humans — stays in inbox)<br>  ├── Interviews      (stays in inbox)<br>  ├── Applied         (portal confirmations — archived)<br>  ├── Job Alerts      (the firehose — archived)<br>  └── Rejected        (archived)<br>Finance/Receipts<br>Security &amp; Accounts<br>Newsletters<br>LinkedIn<br>Travel &amp; Docs</pre><p>The clever bit: <strong>it wrote a script</strong> to do the bulk work instead of moving emails one API call at a time. It listed every message matching a category, then batch-applied the label and removed the INBOX label (that&#39;s all &quot;archive&quot; means in Gmail — nothing is deleted, it just leaves the inbox). A few hundred at a time.</p><p>It also created ~17 <strong>filters</strong> so this keeps working. New job alert from Naukri? Labeled and archived before I ever see it.</p><p>Final tally: <strong>4,891 → 579.</strong> Twenty minutes. Nothing deleted — everything’s still one search away in <em>All Mail</em>.</p><p>That alone would’ve been a good afternoon. But then I got greedy.</p><h3>The plot twist: I asked it to look at my Sent folder</h3><p>“While you’re in there,” I said, “can you figure out why I’m not getting responses to my cold emails?”</p><p>It went through <strong>65 cold applications</strong> I’d sent over five months and came back with numbers I did not enjoy reading:</p><ul><li><strong>17% reply rate.</strong> (Not actually terrible for cold email — but almost none converted.)</li><li><strong>2 hard bounces</strong> — I’d been emailing scraped addresses that don’t exist.</li><li><strong>Zero follow-ups.</strong> 54 people never replied and I never nudged a single one.</li></ul><p>Then it got specific, and this is where it stung:</p><p><strong>My story kept changing.</strong> One email said “3.5 years of experience,” another said “3.6,” the June batch said “4.” My title flip-flopped between “React Native Developer” and “Mobile Team Lead.” My notice period was 15 days in one email and 30 in another. Any recruiter cross-checking my LinkedIn saw a moving target.</p><p><strong>I was putting my salary in cold emails.</strong> Current and expected CTC, right there in the first message. That’s just handing someone a reason to filter you out before a human reads a word.</p><p><strong>My email signature had nine image icons.</strong> LinkedIn, GitHub, YouTube, Medium, Stack Overflow, WhatsApp… Outlook was stripping them and showing “[image: Image removed by sender]” clutter, and the image weight was pushing me toward spam folders. One recruiter’s reply even had Microsoft’s “You don’t often get email from this address” warning quoted in it.</p><p><strong>I was blasting.</strong> 7 near-identical emails in 7 minutes. 12 in 40 minutes. Same body, just swap the city in the subject line. It <em>reads</em> like a mail merge because it is one.</p><p>Reading your own job hunt described back to you as a bulleted list of mistakes is a strange experience. Recommended, actually.</p><h3>The fix, and then the automation</h3><p>The agent rewrote my cold-email template — metrics-led instead of a keyword dump, one consistent set of facts, no salary, a real subject line, links instead of an attached PDF (better deliverability). It rewrote my resume summary to match. It drafted a follow-up email — the one I’d never been sending.</p><p>Then it built the part I actually wanted: <strong>a follow-up bot.</strong></p><p>The design constraint I gave it: <em>never send anything on its own.</em> Auto-sending job emails with no review is how you fire off a half-finished draft to a hiring manager with no undo. So it runs in <strong>draft mode</strong>:</p><ol><li>I send a cold email, then slap an Auto-Followup label on the thread — one click.</li><li>A script runs every morning at 9:15 (via launchd on my Mac). For each labeled thread:</li></ol><ul><li><strong>They replied</strong> → move it to Auto-Followup/Replied, done.</li><li><strong>No reply, 3+ business days</strong> → write a follow-up <em>draft</em> in the thread, move it to Auto-Followup/Done.</li><li><strong>Not 3 days yet</strong> → leave it, check tomorrow.</li></ul><ol><li>Each morning I skim Drafts, fix the name if it guessed wrong, and hit send on the ones I want.</li></ol><p>It figures out the recipient’s first name and company from the email address. It counts business days, so a Friday send doesn’t get chased on Sunday. One follow-up per thread — past that, best practice says stop anyway.</p><p>The whole thing is ~150 lines of JavaScript hitting the Gmail REST API with the OAuth token that was already sitting there from the MCP setup.</p><h3>The annoying part nobody mentions</h3><p>The Gmail OAuth app defaults to “Testing” mode, and in Testing mode <strong>the login expires every 7 days.</strong> Fine for a demo, useless for a bot.</p><p>Fixing it means publishing the app to “production” (unverified is fine for personal use), which now requires a real homepage URL <em>and</em> a privacy policy URL on a domain Google recognizes. So I ended up writing an actual /privacy page, committing it to my portfolio repo, letting Vercel deploy it, and pasting the URL into a Google consent-screen form that rejected my domain three times for three different reasons before it accepted it.</p><p>Twenty minutes of real work bookended by an hour of OAuth paperwork. Par for the course.</p><h3>What I’d tell someone starting</h3><ul><li><strong>The MCP server is the easy part.</strong> The value is in what you ask the agent to <em>do</em> with the access — and “look at my own data and tell me what’s wrong with it” turned out to be the killer use case.</li><li><strong>Draft mode, not auto-send.</strong> For anything that leaves your outbox, keep a human in the loop. The automation should do the tracking and the typing, not the deciding.</li><li><strong>Let it script the bulk work.</strong> An agent moving 2,000 emails through individual tool calls is slow and expensive. An agent <em>writing a script</em> that moves 2,000 emails is thirty seconds.</li><li><strong>Your Sent folder is an honest performance review.</strong> I’d been sending cold emails into a void for months. Fifteen minutes of analysis found five concrete reasons why. None of them were “the market is tough.”</li></ul><p>My inbox is quiet now. The follow-up bot drafted its first real nudge this week. And I finally have one version of how many years of experience I have.</p><p><em>If you’re doing this yourself: the Gmail MCP server is </em><em>@gongrzhe/server-gmail-autoauth-mcp, the client was Claude Code, and the scheduler was plain </em><em>launchd. Nothing exotic.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37349fdb99e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Rebuilt “Pen Fight” — the Last-Bench Classic — as a 60 FPS Mobile Game with React Native + Skia]]></title>
            <link>https://medium.com/@gowthamjaganthan/i-rebuilt-pen-fight-the-last-bench-classic-as-a-60-fps-mobile-game-with-react-native-skia-eab5efb2caaf?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/eab5efb2caaf</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 15:41:18 GMT</pubDate>
            <atom:updated>2026-08-19T15:41:18.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IMmPNKmB0mGrHNRkhkK_dQ.png" /></figure><p><em>Two pens, one desk, and the physics that decided friendships. Here’s how I turned the classic “pen fight” into a real cross-platform mobile game.</em></p><p>📺 <strong>Watch the demo:</strong> <a href="https://youtu.be/TKFmQ0K5B9A">https://youtu.be/TKFmQ0K5B9A</a></p><p>💻 <strong>Source code:</strong> <a href="https://github.com/Gowtham8940/pen-fight">https://github.com/Gowtham8940/pen-fight</a></p><h3>The game we all played (and pretended we didn’t)</h3><p>If you sat on the last bench, you know the rules without being told. Two pens on a desk. You flick yours; if you knock the other pen off the edge, you win. No board, no app, no referee — just a shared desk and questionable aim.</p><p>I wanted to bring that exact feeling to a phone: <strong>simple enough for a 5-year-old, nostalgic enough for a 40-year-old</strong>, and smooth on everything from a budget Android to an iPad. No ads. No subscriptions. Just the childhood memory, rebuilt properly.</p><p>This first milestone is a polished <strong>single-device “Pass &amp; Play”</strong> game — and the whole thing runs at <strong>60 FPS on both Android and iOS</strong> because the physics never touches React.</p><h3>The bigger idea behind it</h3><p>Pen Fight isn’t only a game. The long-term plan is a <strong>transparent charity model</strong>: players can donate, and the money goes <strong>directly to poor school students</strong> for pens, books, and stationery — no middlemen — with the weekly totals shown right inside the app. No ads, no subscription; the game stays pure, and the giving stays honest.</p><p>That mission shaped the engineering: it has to feel premium, run everywhere, and be built on foundations I can extend for years.</p><h3>The stack (and why)</h3><ul><li><strong>React Native CLI</strong> (JavaScript) — not Expo, because I want full control over native modules.</li><li><strong>@shopify/react-native-skia</strong> — a GPU-accelerated canvas. Pens, table, spin, effects are all drawn here.</li><li><strong>React Native Reanimated 4 + Worklets</strong> — the secret to 60 FPS: the physics simulation runs in a <strong>worklet on the UI thread</strong>, completely off the JS thread.</li><li><strong>React Native Gesture Handler</strong> — the slingshot “pull back and release” flick.</li><li><strong>Zustand</strong> for discrete game state, <strong>MMKV</strong> for instant persistence, <strong>i18next</strong> (with RTL) for languages, <strong>React Navigation</strong> for screens.</li></ul><p>The single most important decision was the <strong>physics + rendering</strong> approach. I rejected the usual matter-js route: it&#39;s a general-purpose engine, its render loop drives React re-renders, and it stutters on low-end Androids exactly when collisions happen. Instead I wrote a <strong>tiny custom physics engine that runs inside Reanimated worklets</strong> and renders with Skia. Two circular bodies on a frictioned plane don&#39;t need a 150 KB engine — they need a tight loop on the right thread.</p><h3>The core idea: separate “live motion” from “game facts”</h3><p>The trick that makes it smooth is a strict split of state:</p><ul><li><strong>A live shot lives entirely in a Reanimated shared value</strong> (world) on the UI thread. Each pen is just { x, y, vx, vy, angle, omega, radius, mass, alive }. This updates every frame, and <strong>React never sees it.</strong></li><li><strong>The discrete facts</strong> — whose turn it is, the score, the winner, the selected skins — live in a Zustand store. These change rarely, so a re-render is cheap.</li></ul><p>The physics loop only crosses back to JavaScript at <strong>three discrete moments</strong>: a hit, a settle, and a game-over. Never per frame.</p><pre>Gesture (UI thread)        Physics (UI thread worklet)         Render (UI thread)<br>  PanGesture ──aim,power──► world shared value (pos/vel) ────►  Skia useDerivedValue<br>      │                          fixed-step loop                      │<br>      ▼                          integrate→collide→boundary           ▼<br>   onEnd: set velocity      settle / off-edge → runOnJS ──► Zustand ──► HUD / win modal</pre><h3>The physics loop (fixed timestep, on the UI thread)</h3><p>Every frame, Reanimated’s useFrameCallback runs a <strong>fixed-timestep</strong> loop. Fixed steps mean the game feels identical at 60 or 120 FPS, and a single slow frame can&#39;t teleport a pen through another — critical for both low-end devices and future multiplayer.</p><pre>useFrameCallback((info) =&gt; {<br>  &#39;worklet&#39;;<br>  const w = world.value;<br>  if (w.status !== &#39;SIMULATING&#39;) return;<br><br>  let dt = (info.timeSincePreviousFrame ?? 16.6) / 1000;<br>  if (dt &gt; 1 / 30) dt = 1 / 30;          // clamp a hitch<br><br>  let remaining = dt, steps = 0, hit = false, fell = null;<br>  while (remaining &gt; 1e-5 &amp;&amp; steps &lt; 8) {<br>    const step = Math.min(1 / 120, remaining);<br>    integrateBody(w.a, step, tuning);     // Euler + friction<br>    integrateBody(w.b, step, tuning);<br>    if (resolveCollision(w.a, w.b, tuning)) hit = true;<br>    if (isOffTable(w.a, table)) { fell = &#39;a&#39;; break; }<br>    if (isOffTable(w.b, table)) { fell = &#39;b&#39;; break; }<br>    remaining -= step; steps += 1;<br>  }<br><br>  if (hit) runOnJS(onHit)();             // play a &quot;clack&quot;<br>  if (fell) { /* winner = other pen → runOnJS(onGameOver) */ }<br>  // else detect settle → swap turns<br>  world.value = { ...w };<br>});</pre><p>Friction is modeled as a clean, constant deceleration to a full stop (not an exponential drift), so pens actually <em>rest</em> — no eternal sliding:</p><pre>export function integrateBody(body, dt, tuning) {<br>  &#39;worklet&#39;;<br>  const speed = Math.hypot(body.vx, body.vy);<br>  if (speed &gt; 0) {<br>    const newSpeed = Math.max(0, speed - tuning.frictionDecel * dt);<br>    const scale = newSpeed / speed;<br>    body.vx *= scale; body.vy *= scale;<br>  }<br>  body.x += body.vx * dt;<br>  body.y += body.vy * dt;<br>  body.angle += body.omega * dt;         // spin<br>}</pre><h3>Collisions that feel right</h3><p>The whole game <em>is</em> the collision, so it has to feel physical. It’s a standard circle-vs-circle impulse resolution: find the contact normal, push the pens apart, then apply an impulse along the normal using relative velocity, mass, and a low restitution (pens aren’t bouncy). A glancing hit even imparts a bit of spin.</p><pre>const j = (-(1 + restitution) * velAlongNormal) / (invMassA + invMassB);<br>a.vx -= j * nx * invMassA;  a.vy -= j * ny * invMassA;<br>b.vx += j * nx * invMassB;  b.vy += j * ny * invMassB;</pre><p>“Off the table” is deliberately simple for v1: a pen is out the moment its <strong>center crosses the edge</strong> of the play rectangle. The surviving pen’s owner wins.</p><h3>The flick: a slingshot in a worklet</h3><p>Aiming is pure gesture-handler, also on the UI thread. You drag <em>away</em> from your pen to pull it back; release launches it in the opposite direction with power proportional to the pull distance — clamped so you can’t cheat with a monitor-length drag.</p><pre>Gesture.Pan()<br>  .onBegin((e) =&gt; { &#39;worklet&#39;; /* grab pen only if the touch starts near it */ })<br>  .onUpdate((e) =&gt; { &#39;worklet&#39;; /* live aim: update finger position */ })<br>  .onEnd(() =&gt; {<br>    &#39;worklet&#39;;<br>    const power = clamp(pull / tuning.maxDrag, 0, 1) * tuning.maxLaunchSpeed;<br>    body.vx = dir[0] * power;<br>    body.vy = dir[1] * power;<br>    world.value = { ...w, status: &#39;SIMULATING&#39; };<br>    runOnJS(onLaunch)(power);   // JS side plays a flick sound<br>  });</pre><p>A Skia overlay draws the aim line and a power indicator while you pull.</p><h3>Skins are just data</h3><p>Adding a new pen is one object — visuals <em>and</em> physics in the same place — so a designer never touches engine code:</p><pre>{<br>  id: &#39;graphite&#39;, nameKey: &#39;graphite&#39;,<br>  length: 104, radius: 28, mass: 1.15,   // heavier + slimmer → hits harder<br>  body: &#39;#334155&#39;, tip: &#39;#0F172A&#39;, cap: &#39;#94A3B8&#39;,<br>  unlock: &#39;default&#39;,<br>}</pre><p>Because mass and radius flow straight into the simulation, different pens genuinely <em>play</em> differently. The unlock field is already there as the hook for the future skins shop and donation unlocks.</p><h3>The unglamorous parts (that cost me the most time)</h3><p>A few real-world gotchas, in case they save you an afternoon:</p><ul><li><strong>React Native 0.87 was too new.</strong> Reanimated 4 only supported RN 0.83–0.86 and ships native code tightly coupled to RN internals — forcing it risks cryptic crashes. I <strong>pinned RN to 0.86</strong>, which the whole ecosystem (Reanimated, Skia, Worklets) supports.</li><li><strong>react-native-mmkv v4 changed its API.</strong> MMKV is now a <em>type-only</em> export; you create instances with createMMKV({ id }), not new MMKV(). It also needs the react-native-nitro-modules peer or pods won&#39;t resolve.</li><li><strong>CocoaPods + Unicode.</strong> pod install crashed until I ran it with a UTF-8 locale (LANG=en_US.UTF-8).</li></ul><p>Little things — but they’re the difference between “builds on my machine” and “builds.”</p><h3>What’s next</h3><p>This milestone is the foundation. The engine is <strong>deterministic by design</strong> (fixed timestep, seeded math), which turns the scariest future feature — <strong>WiFi multiplayer</strong> — into a “replay the same inputs on both devices” problem instead of a rewrite. Also on the roadmap:</p><ul><li>🔐 Firebase login + social sign-in and <strong>streaks</strong></li><li>🎨 A pen <strong>skins shop</strong></li><li>💚 The <strong>transparent donation</strong> feature — money straight to students, weekly totals in the app</li><li>🔔 Push notifications, offline/poor-connection handling, and more school-desk mini-games</li></ul><p>No ads. No subscriptions. Just the last bench, in your pocket.</p><h3>Try it / build it</h3><ul><li>📺 <strong>Demo:</strong> <a href="https://youtu.be/TKFmQ0K5B9A">https://youtu.be/TKFmQ0K5B9A</a></li><li>💻 <strong>Code:</strong> <a href="https://github.com/Gowtham8940/pen-fight">https://github.com/Gowtham8940/pen-fight</a></li></ul><pre>git clone https://github.com/Gowtham8940/pen-fight<br>cd pen-fight &amp;&amp; npm install<br>cd ios &amp;&amp; LANG=en_US.UTF-8 pod install &amp;&amp; cd ..<br>npm run ios   # or: npm run android</pre><p>If you’d like a deeper tutorial on the Skia rendering or the Reanimated physics engine, tell me in the comments — and if this hit your nostalgia, a clap (or a star on GitHub ⭐) means a lot.</p><p><em>Built with React Native, Skia, and a lot of last-bench nostalgia.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eab5efb2caaf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native 0.87: What’s New and How It Compares to 0.86]]></title>
            <link>https://medium.com/@gowthamjaganthan/react-native-0-87-whats-new-and-how-it-compares-to-0-86-297ba7188fa0?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/297ba7188fa0</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[updates]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 15:30:28 GMT</pubDate>
            <atom:updated>2026-08-12T15:30:28.225Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*aCR9KO84L-wp_fM60Og29g.png" /><figcaption>React Native 0.87</figcaption></figure><p>React Native 0.87 landed on August 11, 2026, and it’s a much bigger release than its predecessor. While 0.86 (June 2026) was a quiet, no-breaking-changes update focused on Android edge-to-edge support and DevTools, 0.87 makes several structural changes that most apps will eventually need to deal with. Here’s what changed, why it matters, and how to prepare.</p><h3>The Big Picture</h3><p>React Native 0.86 React Native 0.87 Released June 11, 2026 August 11, 2026 Breaking changes None Several (see below) Headline feature Edge-to-edge on Android 15+ Strict TypeScript API becomes default Metro version 0.84 0.87 iOS dependency manager CocoaPods only CocoaPods + experimental SwiftPM Android build tooling Existing AGP AGP 9 support added Node.js requirement Not raised 22.13.0+ required</p><p>In short: 0.86 was a “coast” release. 0.87 is a “pay down debt and modernize the toolchain” release.</p><h3>1. Strict TypeScript API Is Now the Default</h3><p>This is the headline change, and it’s been a long time coming. Previously, React Native shipped hand-maintained .d.ts type definitions that drifted from the actual implementation over time — you&#39;d get incorrect types, missing types, or types for internals that were never meant to be public.</p><p><strong>What changed in 0.87:</strong> Types are now generated directly from React Native’s own source code. This was available as an opt-in preview since version 0.80, but as of 0.87, it’s on by default for every project.</p><p>Two concrete benefits:</p><ul><li><strong>Accuracy.</strong> Since types come from source, there’s no more drift between what TypeScript tells you and what the code actually does. You’ll also notice doc comments now show up on hover for most symbols — something the old hand-maintained types never had.</li><li><strong>API stability.</strong> The public API is now explicitly scoped to whatever react-native exports at its root. Previously, changes to internal files could silently break your types even though nothing about the public API changed. That&#39;s no longer possible.</li></ul><p><strong>What breaks:</strong> Deep imports like react-native/Libraries/SomeInternal are now type errors — the fix is to migrate to the public exports. Some type names changed too; for example, refs now use dedicated types like ViewInstance and TextInputInstance instead of generic ones.</p><p><strong>If you’re not ready:</strong> There’s a temporary opt-out. Add &quot;react-native-legacy-deep-imports&quot; to customConditions in your tsconfig.json and you&#39;ll keep the old type behavior. This escape hatch is only available through 0.88 — the legacy types get removed after that, so treat it as a deadline, not a permanent option.</p><pre>{<br>  &quot;extends&quot;: &quot;@react-native/typescript-config&quot;,<br>  &quot;compilerOptions&quot;: {<br>    ...<br>+   &quot;customConditions&quot;: [&quot;react-native&quot;, &quot;react-native-legacy-deep-imports&quot;]<br>  }<br>}</pre><p>For teams doing an agent-assisted upgrade, the React Native community publishes a /migrate-to-strict-api skill with direct migration instructions layered on top of the existing ESLint auto-fixers.</p><h3>2. Metro Bundler: 0.84 → 0.87</h3><p>Metro (React Native’s JS bundler) jumped three minor versions in one release, bringing:</p><ul><li><strong>2x faster source map generation</strong> — this directly speeds up React Native DevTools load times, since DevTools relies on source maps to map bundled code back to your source.</li><li><strong>Half the memory usage</strong>, thanks to a more efficient internal representation for storing source maps.</li><li><strong>Stable TypeScript/ESM config files.</strong> You can now write metro.config.mts and have it just work, without the experimental flag from earlier versions.</li><li>Dropped support for .es6 config file extensions and YAML configs — if you&#39;re using either, you&#39;ll need to migrate to standard JS/TS config files.</li><li>A new resolver feature: package self-resolve, so a package can require() itself by its own package name.</li></ul><p>By comparison, 0.86 only bumped Metro to 0.84.2 as a routine dependency update with no user-facing changes. This is a much more substantial jump.</p><h3>3. Experimental Swift Package Manager Support (iOS)</h3><p>This is new territory for React Native. Historically, iOS dependency management has meant CocoaPods — and CocoaPods means Ruby, Bundler, and pod install.</p><p>0.87 introduces an <strong>experimental, opt-in</strong> path using Swift Package Manager (SwiftPM) instead. The pitch: you only need Xcode. No Ruby, no Bundler, no CocoaPods.</p><pre>cd ios<br>npx react-native spm -- deintegrate</pre><p>This command injects Swift package references directly into your existing .xcodeproj — it doesn&#39;t replace your project, and your signing, capabilities, and build phases are left untouched. Running npx react-native spm deinit reverses it cleanly.</p><p>One usability detail worth calling out: unlike CocoaPods, you don’t need to re-run the setup command every time your dependencies change. Install or remove a native package, then just build — autolinking re-runs automatically. The one exception is after a fresh clone or in CI, where you still run npx react-native spm once, analogous to pod install.</p><p><strong>Caveats:</strong></p><ul><li>A community library needs a Package.swift to work with this. If it doesn&#39;t have one, npx react-native spm scaffold can generate it from the library&#39;s podspec.</li><li>This is explicitly <strong>not production-ready</strong> — commands, flags, and the generated project layout may still change.</li><li>CocoaPods remains the default and the officially supported path for now.</li></ul><p>Under the hood, this required React Native to restructure how it ships precompiled binaries — you’ll now see two new XCFrameworks, ReactNativeHeaders.xcframework and ReactNativeDependenciesHeaders.xcframework. The practical impact for most developers: bare-form header imports need a namespace prefix now.</p><pre>- #import &lt;RCTAppDelegate.h&gt;<br>+ #import &lt;React/RCTAppDelegate.h&gt;</pre><p>0.86 had nothing comparable on the iOS tooling side — its iOS-relevant work was limited to edge-to-edge-adjacent fixes on Android, not iOS build tooling.</p><h3>4. Android Gradle Plugin (AGP) 9 Support</h3><p>0.87 is the first React Native release that works with AGP 9, which itself is a major release with its own breaking changes in Gradle builds. The recommended path is to opt out of AGP 9’s built-in Kotlin support and its new DSL API for now, by setting two flags in android/gradle.properties:</p><pre>android.builtInKotlin=false<br>android.newDsl=false</pre><p>These opt-outs are expected to go away starting with AGP 10.x, so this is a transitional step rather than a long-term configuration.</p><h3>Toolchain and Minimum Version Bumps</h3><p>0.87 raises the floor in a few places:</p><ul><li><strong>Node.js</strong>: now requires 22.13.0 or newer.</li><li><strong>Kotlin</strong>: minimum 2.0+ (the bundled version is 2.2.0).</li><li><strong>Android compileSdk</strong>: minimum compileSdk is now 34; the bundled compileSdk/buildTools bumped to 37.</li></ul><p>0.86, by contrast, didn’t raise any minimum toolchain versions — this is a meaningful difference if you’re maintaining CI pipelines or older development environments.</p><h3>What Got Removed in 0.87</h3><p>Beyond the Strict API’s deep-import restrictions, several long-deprecated APIs are gone for good:</p><ul><li>InteractionManager — replaced by requestIdleCallback.</li><li>The deprecated Modal animated prop.</li><li>Deprecated StatusBar props: backgroundColor, translucent, networkActivityIndicatorVisible, plus their setter methods.</li><li>Boolean values for ScrollView&#39;s keyboardShouldPersistTaps.</li><li>The useTurboModules feature flag — TurboModules are simply always on now.</li><li>useColorScheme() no longer returns &#39;unspecified&#39;; it now returns ColorSchemeName | null.</li><li>NativeDialogManagerAndroid and the undocumented Touchable root export (extend ViewProps instead).</li><li>NativeMethods / NativeMethodsMixin types — use HostInstance.</li></ul><p>None of this appeared in 0.86, which explicitly shipped <strong>zero user-facing breaking changes</strong> — only two minor deprecations (ViewUtil.getUIManagerType and an AppRegistry argument).</p><h3>Should You Upgrade Right Away?</h3><p>If you’re currently on 0.86, upgrading to 0.87 is a bigger lift than the 0.85 → 0.86 hop was, mainly because of the Strict TypeScript API becoming default. The good news: Meta says many apps should see few or no type errors, and there’s a one-line opt-out if you need breathing room until 0.88.</p><p>Recommended approach:</p><ol><li>Run the upgrade with the <a href="https://react-native-community.github.io/upgrade-helper/">React Native Upgrade Helper</a> to see the exact diff for your version jump.</li><li>Try upgrading without the legacy-imports opt-out first — see how many type errors surface.</li><li>If it’s too much for now, add the customConditions opt-out, but put a ticket on your backlog before 0.88 ships, since the legacy types are going away after that.</li><li>If you’re on iOS and curious, treat SwiftPM as something to experiment with in a side branch — not something to flip on in production yet.</li><li>If you’re using AGP 9, add the two opt-out flags in gradle.properties immediately to avoid friction from the new DSL/built-in Kotlin behavior.</li></ol><h3>Bottom Line</h3><p>0.86 was a maintenance release: no breaking changes, solid Android edge-to-edge fixes, and a DevTools quality-of-life feature. 0.87 is where React Native starts collecting on a year of groundwork — the Strict TypeScript API, an updated Metro, and initial groundwork for a CocoaPods-free iOS future via SwiftPM. It’s the more consequential release of the two, and the one that’s worth budgeting real migration time for.</p><p><em>React Native 0.87 was released August 11, 2026, and is now the latest stable version, with 0.84.x moving to unsupported status. Full release notes: </em><a href="https://reactnative.dev/blog/2026/08/11/react-native-0.87"><em>reactnative.dev/blog</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=297ba7188fa0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Upgraded React Native from 0.80.2 to 0.86 — And Nothing Caught Fire]]></title>
            <link>https://medium.com/@gowthamjaganthan/i-upgraded-react-native-from-0-80-2-to-0-86-and-nothing-caught-fire-795604af3be8?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/795604af3be8</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[migration]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 16:21:24 GMT</pubDate>
            <atom:updated>2026-08-03T16:21:24.600Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zmCvqdDzql-kJZ71bAjDvw.png" /></figure><h3>For years, “upgrade React Native” meant blocking off a week. This time it took an afternoon.</h3><p>If you’ve shipped React Native apps for a while, you know the warning by heart:</p><blockquote><em>“Don’t upgrade unless you absolutely have to.”</em></blockquote><p>It’s practically folklore at this point. Gradle breaks. CocoaPods breaks. Some native module you forgot existed suddenly stops compiling. You lose two days to a single dependency conflict, then lose your patience right after.</p><p>So when I sat down to upgrade one of our production apps from <strong>React Native 0.80.2 to 0.86</strong>, I braced for the usual fight.</p><p>It never came.</p><p>The Upgrade That Wasn’t a War</p><p>Here’s the entire list of what actually needed doing:</p><ul><li>A few mandatory Gradle config updates</li><li>A handful of iOS dependency bumps</li><li>Routine package version refreshes</li><li>A small number of native compatibility fixes</li></ul><p>No boilerplate rewrites. No multi-day native debugging spirals. No architecture overhaul.</p><p>Having sat through several React Native major upgrades over the years, I can say plainly: this was the smoothest one yet. It genuinely feels like the React Native team sat down and asked, “why is this so painful?” — and then fixed it.</p><p><strong>The most telling sign?</strong> You no longer need deep native Android/iOS expertise to pull this off. Follow the official upgrade docs and community guides, and you’re most of the way there.</p><h3>The Ecosystem Finally Grew Up</h3><p>A few years ago, upgrading React Native meant preparing for the unexpected. Now it feels almost… predictable. And predictable is underrated.</p><p>What changed:</p><ul><li><strong>Tooling</strong> is more reliable</li><li><strong>Documentation</strong> is genuinely useful, not an afterthought</li><li><strong>Package maintainers</strong> ship compatibility updates faster</li><li><strong>The upgrade path itself</strong> doesn’t feel like a gamble anymore</li></ul><p>That’s not a small thing. Predictability is what lets teams actually plan upgrades instead of dreading them.</p><h3>The New Architecture Is Paying Off</h3><p>We’d already migrated to the New Architecture in an earlier release, so I won’t rehash that process here. But it’s worth naming why it still matters:</p><ul><li>Faster app startup</li><li>Lower memory usage</li><li>Better rendering performance</li><li>Less bridge overhead</li><li>Cleaner native integrations</li><li>Noticeably less boilerplate</li></ul><p>If you’re still on the old architecture, this upgrade is a good excuse to finally make the jump. It’s quietly becoming the foundation everything else in the ecosystem builds on top of.</p><h3>AI Tools Have Actually Caught Up</h3><p>This surprised me more than anything else in the process.</p><p>Modern AI coding assistants are now trained on the New Architecture, current Gradle configs, and up-to-date ecosystem packages — not stale, two-versions-behind knowledge. In practice, that meant:</p><ul><li>Faster debugging when something did break</li><li>Migration suggestions that were actually accurate</li><li>Native fixes that didn’t need three rounds of trial and error</li><li>Dependency conflicts resolved in minutes, not hours</li></ul><p>Pair that with one of the most active mobile dev communities out there — GitHub Discussions, Stack Overflow, the React Native Community repos — and a fix is rarely more than a few minutes away.</p><h3>Navigation: v6 → v7 Without Drama</h3><p>We also migrated <strong>React Navigation from v6 to v7</strong> as part of this. Straightforward migration, cleaner API, and better alignment with the latest RN ecosystem overall.</p><p>Small tip: keeping navigation (and other core packages) current <em>between</em> major RN upgrades makes each future upgrade lighter. Debt compounds — so does staying current.</p><h3>Reanimated Feels Like a Different Library</h3><p>This is the part users will actually notice, even if they can’t articulate why.</p><p>We moved more animation logic off the JavaScript thread and onto the <strong>UI thread</strong> via Reanimated. The result:</p><ul><li>Smoother interactions</li><li>Better gesture responsiveness</li><li>Fewer dropped frames</li><li>A more consistent, polished feel overall</li></ul><p>Nobody’s going to open a support ticket saying “the animations feel great now.” But they’ll stop opening tickets about the app feeling janky — which is the real signal.</p><h3>The Number That Actually Impressed Me: 60%</h3><p>Our app is offline-first. Users bulk-download learning materials — video, PDFs, audio, images, encrypted content — often gigabytes at a time. Behind the scenes, that means simultaneous:</p><ul><li>Large dataset copying</li><li>Database writes</li><li>Encryption and decryption</li><li>File processing</li><li>Metadata generation</li></ul><p>After upgrading to 0.86 and tuning the surrounding libraries, bulk import performance improved by <strong>roughly 60%</strong>.</p><p>That’s not a marginal gain. For an offline-first product, import speed is a core part of the user experience — and this was, hands down, the most satisfying result of the entire upgrade.</p><h3>Small but Necessary: Android Target API Compliance</h3><p>We also updated our Android config to meet the latest <strong>target API requirements</strong> — clearing platform warnings and keeping the app compliant for Play Store releases. Not glamorous, but skipping it is how teams end up scrambling before a submission deadline.</p><h3>The Real Win Wasn’t Performance — It Was Confidence</h3><p>Here’s the thing I keep coming back to: the biggest win from this upgrade isn’t any single metric.</p><p>It’s that upgrading React Native finally felt <em>predictable</em> again.</p><p>We spent our time improving the product — not fighting the framework to a standstill just to stay current.</p><p>That’s exactly how a framework upgrade is supposed to feel.</p><h3>So, Should You Upgrade?</h3><p>Yes — there’s still real work involved. Gradle and CocoaPods still need attention. Native dependencies still need updating. This isn’t a one-click process.</p><p>But compared to a few years ago, the gap between “painful” and “manageable” has closed dramatically. The ecosystem is more mature, the tooling is better, the community is stronger, and AI assistants have genuinely started pulling their weight for migration work.</p><p>The nightmare isn’t fully gone. But it’s no longer the first thing I think of when someone says “let’s upgrade React Native.” And that shift, more than any benchmark, is the real story here.</p><h3>Your turn:</h3><ul><li>Which version did you last upgrade from?</li><li>What actually broke for you?</li><li>Did you see any performance wins worth sharing?</li></ul><p>Drop your experience below — the more of us compare notes, the easier this gets for everyone upgrading next.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=795604af3be8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“App Must Target Android 16” — The Google Play Warning Every RN Dev Will Eventually See]]></title>
            <link>https://medium.com/@gowthamjaganthan/app-must-target-android-16-the-google-play-warning-every-rn-dev-will-eventually-see-eaea5e226a91?source=rss-7c4883f81036------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaea5e226a91</guid>
            <category><![CDATA[google-play-store]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Gowtham J]]></dc:creator>
            <pubDate>Sun, 02 Aug 2026 13:54:51 GMT</pubDate>
            <atom:updated>2026-08-02T13:54:51.045Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hVaodeHZuIJT1pLPicGMpQ.png" /></figure><h3>A calm, step-by-step walkthrough for fixing it — no panic required</h3><p>I was prepping a routine release when Google Play Console hit me with this:</p><blockquote><strong><em>App must target Android 16 (API level 36) or higher</em></strong></blockquote><p>If you’re new to this: ignore it long enough, and Google Play simply stops letting you publish updates. Not a suggestion — a hard wall.</p><p>The instinct every React Native dev has at this point is the same:</p><p><em>“I’ll just bump </em><em>targetSdkVersion and move on.&quot;</em></p><p>If only. Let me walk you through what it actually takes — and why it’s much less scary than it looks.</p><h3>First, why does Google keep doing this?</h3><p>Quick context if you haven’t run into this before: Android ships a new major version every year. To keep the ecosystem secure and consistent, Google Play requires apps to target a <strong>recent</strong> API level — not the newest one, but nothing too far behind either.</p><p>The rule of thumb: if your app’s target API falls more than a year behind the latest Android release, Google Play blocks new updates until you catch up.</p><p>In my case:</p><ul><li><strong>Current target API:</strong> 35</li><li><strong>Required target API:</strong> 36</li><li><strong>Deadline:</strong> August 31, 2026</li></ul><p>Simple enough on paper. The real question is what “updating the target API” actually touches.</p><h3>Buying yourself time (if you need it)</h3><p>Not ready to migrate yet? Google gives you a safety valve.</p><ol><li>Open <strong>Google Play Console</strong></li><li>Go to <strong>Monitor and Improve → Policy Status</strong></li><li>Open the Target API warning</li><li>Click <strong>Request more time</strong></li></ol><p>Google may grant an extension depending on your app and account standing.</p><p><strong>One honest caveat:</strong> this buys you breathing room, not immunity. The upgrade is still coming. Treat the extension as a runway, not an exit.</p><h3>The good news: it’s mostly Android config, not app logic</h3><p>Here’s the part that surprised me. Because I’d already upgraded to <strong>React Native 0.86</strong> beforehand, most of the heavy lifting was already done — the newer RN version ships with Android tooling that’s already aligned with recent SDK requirements.</p><p>What was actually left was a handful of config updates. Here’s the full path, step by step.</p><h3>Step 1 — Bump compileSdk and targetSdk</h3><p>Depending on your RN version, this lives in android/build.gradle or gradle.properties:</p><pre>compileSdkVersion = 36<br>targetSdkVersion = 36</pre><p>This is the change everyone assumes is the <em>whole</em> fix. It’s just the starting point.</p><h3>Step 2 — Update the Android Gradle Plugin (AGP)</h3><p>Older AGP versions won’t know what to do with SDK 36:</p><pre>classpath(&quot;com.android.tools.build:gradle:8.x.x&quot;)</pre><p>Don’t guess the version — check the <a href="https://react-native-community.github.io/upgrade-helper/">React Native upgrade helper</a> or your RN release notes for the exact recommended version.</p><h3>Step 3 — Update the Gradle Wrapper</h3><p>In gradle-wrapper.properties, bump Gradle itself to match your AGP version:</p><pre>distributionUrl=...</pre><p>Think of AGP and Gradle as a matched pair — updating one without the other is a common source of cryptic build failures. Always cross-check the compatibility matrix rather than picking versions independently.</p><h3>Step 4 — Update your Java version</h3><p>Modern Android tooling generally expects <strong>Java 17</strong>. If you’re still on an older JDK, this is usually where builds start throwing confusing errors — worth checking early rather than after three other changes.</p><h3>Step 5 — Install Android SDK 36</h3><p>Open Android Studio and grab:</p><ul><li>Android SDK 36</li><li>Build Tools</li><li>Platform Tools</li></ul><p>No SDK installed, no compile. This one’s non-negotiable.</p><h3>Step 6 — Check your third-party dependencies</h3><p>SDK bumps have a way of exposing which libraries have kept up and which haven’t. Worth checking:</p><ul><li>Firebase</li><li>React Navigation</li><li>Reanimated</li><li>Vision Camera</li><li>Google Sign-In</li><li>Maps</li><li>Any custom native modules</li></ul><p>Update anything lagging behind to a version that officially supports API 36.</p><h3>Step 7 — Actually test before you ship</h3><p>This step gets skipped more than any other, and it’s the one that bites hardest. Target SDK changes can silently alter runtime behavior — permissions handling especially. Before you upload to production, run through:</p><ul><li>Login</li><li>Camera</li><li>Notifications</li><li>Storage</li><li>Permissions</li><li>Background tasks</li><li>Deep links</li><li>Purchases</li><li>Maps</li><li>Push notifications</li></ul><p>A build that compiles cleanly isn’t the same as a build that behaves correctly. Give yourself the buffer to actually verify this.</p><h3>If you’re already on React Native 0.86, here’s your shortcut</h3><p>Most of the Android tooling is already where it needs to be. My migration ended up being:</p><ul><li>Minimal Gradle changes</li><li>A few dependency bumps</li><li>One SDK install</li><li>Target API updated, done</li></ul><p>Compared to older RN upgrade cycles, this was noticeably painless.</p><h3>Errors you’ll probably hit (and the one-line fix for each)</h3><p><strong>Failed to find target with hash string android-36</strong> → You haven&#39;t installed Android SDK 36 yet. Do that first.</p><p><strong>Android Gradle Plugin requires newer Gradle</strong> → AGP and Gradle Wrapper versions are out of sync. Update both together.</p><p><strong>Unsupported class file major version</strong> → Classic Java version mismatch. Switch to Java 17.</p><p><strong>Random native library build failures</strong> → Some dependency hasn’t caught up to API 36 yet. Check for a newer release.</p><p>None of these are exotic — they’re the same handful of errors most developers hit, in roughly this order.</p><h3>The bottom line</h3><p>If you’re staring at:</p><blockquote><strong><em>App must target Android 16 (API level 36)</em></strong></blockquote><p>Take a breath. This isn’t a rewrite — it’s a checklist. Update your tooling, verify your dependencies, test the critical paths, and ship.</p><p>If you’re tight on time, use <strong>“Request more time”</strong> in Play Console. But don’t lean on it too long — starting early gives you room to actually test properly instead of scrambling the night before a deadline.</p><h3>Quick-reference checklist</h3><ul><li>Upgrade React Native (0.86 or later recommended)</li><li>Install Android SDK 36</li><li>Set compileSdkVersion = 36</li><li>Set targetSdkVersion = 36</li><li>Update Android Gradle Plugin</li><li>Update Gradle Wrapper</li><li>Switch to Java 17</li><li>Update third-party libraries</li><li>Test all critical app flows</li><li>Ship before the deadline</li></ul><p>Save this one — you’ll be back here again next year when Google moves the goalposts to API 37.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaea5e226a91" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>