Svg.transfer.apply: def of gralha-svg-render@0.1.0.1 Import: import gralha-svg-render@0.1.0.1/svg.bend as Svg Lines 4514-4522 of gralha-svg-render@0.1.0.1/svg.bend: https://jend.leeeet.dev/read.txt?path=gralha-svg-render@0.1.0.1/svg.bend&start_line=4514&end_line=4522 import Base import gralha-text-scan@0.1.0.1/scan.bend as U def transfer.apply(+t: Transfer, +x: F32) -> F32: Transfer{kind, vs, count, a, b, c} = t +last = U.choose(U32, U32.is_eq(count, 0), 0, (count - 1 : U32)) +position = (U.clamp(x, 0.0, 1.0) * U32.to_f32(last) : F32) +index = F32.to_u32(F32.floor(position)) +left = U.nth(vs, U32.to_nat(index), x) U.branch(F32, U32.is_eq(kind, 1) && U32.is_gt(count, 0), _ => (left + (U.nth(vs, U32.to_nat(U32.inc(index)), left) - left) * (position - U32.to_f32(index)) : F32), _ => U.branch(F32, U32.is_eq(kind, 2) && U32.is_gt(count, 0), _ => U.nth(vs, U32.to_nat(F32.to_u32(U.min(U32.to_f32(last), F32.floor((U.clamp(x, 0.0, 1.0) * U32.to_f32(count) : F32))))), x), _ => U.branch(F32, U32.is_eq(kind, 3), _ => (a * x + b : F32), _ => U.branch(F32, U32.is_eq(kind, 4), _ => (a * F32.pow(U.max(x, 0.0), b) + c : F32), _ => x)))) Uses (22): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.floor https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.pow https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.to_u32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.inc https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_gt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_f32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=Transfer https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=choose https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=clamp https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=max https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=min https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=nth