Otter
Snippets
Otter
Upstream Otter 1.0.1 Tested
Linear Interpolation (Lerp)
Calculate linear interpolation between start and end values by factor t.
Architecture & Runtime Preview
Otter 1.0.1Zero-dependency Otter 1.0.1 snippet (Math & Numbers). Copy the parameterized template or run the self-contained example.
- 1Category: Math & Numbers
- 2Attribution: Otter Reusable Library (Official)
- 3Zero external pack dependencies — paste directly into any .ot file
Source Code (2 files)
to lerp startVal endVal t
diff is endVal minus startVal
offset is diff times t
return startVal plus offset
.
to lerp startVal endVal t
diff is endVal minus startVal
offset is diff times t
return startVal plus offset
.
mid is lerp 10 20 0.5
say "Midpoint:" mid
if mid is not 15
fail with "lerp midpoint mismatch: expected 15"
.
Installation & Usage
otter snippet inspect math-lerp
Copy template.ot directly into your .ot source file, or run example.ot with 'otter run example.ot'.