diff --git a/docs/docs/shaders/language.md b/docs/docs/shaders/language.md index f9a757583d..b761cde032 100644 --- a/docs/docs/shaders/language.md +++ b/docs/docs/shaders/language.md @@ -16,7 +16,10 @@ import {Skia} from "@shopify/react-native-skia"; const source = Skia.RuntimeEffect.Make(` vec4 main(vec2 pos) { - vec2 normalized = pos/vec2(256.0, 256.0); + // The canvas is 256x256 + vec2 canvas = vec2(256); + // normalized x,y values go from 0 to 1 + vec2 normalized = pos/canvas; return vec4(normalized.x, normalized.y, 0.5, 1); }`); @@ -43,6 +46,7 @@ import {Skia, Canvas, Paint, Shader, Fill} from "@shopify/react-native-skia"; const source = Skia.RuntimeEffect.Make(` vec4 main(vec2 pos) { + // normalized x,y values go from 0 to 1, the canvas is 256x256 vec2 normalized = pos/vec2(256); return vec4(normalized.x, normalized.y, 0.5, 1); }`)!;