i have stripped the code down, and yet it still black, can you now find culprit?
/**
- NeuroSurfaceSkia — final "Apple-style" blob
*/
import React, { useEffect } from 'react';
import { View, StyleSheet } from 'react-native';
import {
Canvas, Path, Skia, Group, vec,
RadialGradient, BlurMask, Paint, Image,
} from '@shopify/react-native-skia';
import Animated, {
useSharedValue, withTiming, withRepeat,
useDerivedValue,
} from 'react-native-reanimated';
import { Spacing, getClarityGradient, getClarityColor } from '@/constants/Colors';
import { CognitionLevel } from '@/types';
// ---------- tiny 512×512 monochrome noise bitmap, cached once ----------
// const createNoiseBitmap = () => { ... };
// const noiseBmp = createNoiseBitmap();
// ---------- organic path ------------------------------------------------
const makeBlobPath = (R: number, t: number, clarity: CognitionLevel) => {
'worklet';
const pts = 48;
const ampl = Math.min(0.08, Math.max(0.05, 0.18 - clarity * 0.02));
const p: [number, number][] = [];
for (let i = 0; i < pts; ++i) {
const a = (i / pts) * Math.PI * 2;
const n = Math.sin(a * 3 + t * 2) * 0.6 + Math.sin(a * 7 + t) * 0.4;
const r = R * (1 + ampl * n);
p.push([Math.cos(a) * r, Math.sin(a) * r]);
}
const path = Skia.Path.Make();
for (let i = 0; i < pts; ++i) {
const p0 = p[(i - 1 + pts) % pts], p1 = p[i], p2 = p[(i + 1) % pts], p3 = p[(i + 2) % pts];
if (i === 0) path.moveTo(...p1);
path.cubicTo(
p1[0] + (p2[0] - p0[0]) / 6, p1[1] + (p2[1] - p0[1]) / 6,
p2[0] - (p3[0] - p1[0]) / 6, p2[1] - (p3[1] - p1[1]) / 6,
...p2
);
}
path.close();
return path;
};
// ---------- component ---------------------------------------------------
export default function NeuroSurfaceSkia({ clarity, size = 300 }: {
clarity: CognitionLevel | null;
size?: number;
}) {
const prog = useSharedValue(0);
const level = clarity ?? 3;
const speed = {1:8000,2:7000,3:6000,4:5000,5:4500}[level]!;
useEffect(() => { prog.value = withRepeat(withTiming(1,{duration:speed}), -1, false); }, [level, prog]);
const σ = 50, pad = σ3;
const canvas = size + pad2, R = size*0.35;
const baseScale = {1:0.85,2:0.9,3:0.95,4:1,5:1.05}[level]!;
const transform = useDerivedValue(()=>{
const s = baseScale + 0.04Math.sin(prog.valueMath.PI*2);
return [ { translateX:canvas/2 }, { translateY:canvas/2 }, { scale:s } ];
}, [prog, baseScale, canvas]);
const blobPath = useDerivedValue(()=>{
'worklet';
return makeBlobPath(R, prog.valueMath.PI2, level);
}, [prog, level, R]);
return (
<View style={{ width: size, height: size, alignItems:'center',justifyContent:'center' }}>
<Canvas style={{ width: canvas, height: canvas, margin: -pad, backgroundColor: 'white' }}>
{/* ── STEP A ── simple solid fill ── */}
<Path path={blobPath}>
<Paint color={Skia.Color('#00FF00')} />
</Path>
{/* ── STEP B ── core radial gradient only ── */}
{/*
<Path path={blobPath}>
<RadialGradient
c={vec(0,0)} r={R}
colors={[
Skia.Color('#A8E6CF'),
Skia.Color('#C6F6D5'),
Skia.Color('#F7F7FF'),
]}
positions={[0, 0.6, 1]}
/>
</Path>
*/}
{/* ── STEP C ── full pipeline ── */}
{/*
<Group blendMode="screen">
<Path path={blobPath}>
<RadialGradient
c={vec(0,0)} r={R}
colors={[
Skia.Color('rgba(198,246,213,0.8)'),
Skia.Color('rgba(240,253,244,0)'),
]}
/>
<BlurMask blur={σ} style="outer" />
</Path>
</Group>
<Path path={blobPath}>
<RadialGradient
c={vec(0,0)} r={R}
colors={[
Skia.Color('#A8E6CF'),
Skia.Color('#C6F6D5'),
Skia.Color('#F7F7FF'),
]}
positions={[0,0.6,1]}
/>
</Path>
<Path path={blobPath}>
<Paint style="stroke" strokeWidth={1.2} color="rgba(255,255,255,0.18)" />
<BlurMask blur={6} style="solid" />
</Path>
*/}
</Group>
</Canvas>
</View>
);
}
/* ---------------- styles ---------------- */
// const styles = StyleSheet.create({ ... });