# Interpolation for Motion and Controls

Use interpolation to move between two values in a controlled way: animation, smoothing, servo targets, UI sliders, and parameter changes.

## Outcome
Explain what start value, end value, and progress value produce a smooth transition.

## Safe first step
Name the start, end, and progress value before choosing lerp, easing, or smoothing.

## Ladder steps
### 1. Name start and end
Interpolation is meaningless until the two endpoints are clear.

Check: The note names both values and their units.

### 2. Choose the progress value
A progress value such as 0.0 to 1.0 decides how far along the transition is.

Check: You can explain what 0, 0.5, and 1 mean.

### 3. Separate lerp from easing
Lerp gives the straight blend; easing changes how progress moves through time.

Check: The project note says whether the goal is exact blend or a feel curve.

### 4. Clamp when safety matters
Controls and parameters often need limits.

Check: The output cannot overshoot the safe range.

## Examples
### Compute a linear interpolation
```sh
value = start + (end - start) * t
```
Expected signal: t=0 returns start, t=1 returns end

### Smooth position toward a target
```sh
position = position.lerp(target, 0.1)
```
Expected signal: The value approaches the target without jumping instantly

### Keep a control output inside limits
```sh
output = clamp(output, min_value, max_value)
```
Expected signal: The result stays inside the stated safe range

## Common traps
- Forgetting what t means.
- Using frame-dependent smoothing without thinking about time step.
- Letting a control output overshoot because it was animated like a UI value.

## Practice task
Animate a number from 0 to 100 and write what t=0, t=0.25, t=0.5, and t=1 should produce before testing it.

## Next steps
- Use vectors when interpolating positions.
- Use trig when the motion follows a circle.
- Use control and sensor lessons when smoothing physical readings.

## Related
- [Vectors for maker projects](/learn/vectors-for-maker-projects/)
- [Electronics and controls](/topics/electronics/)
- [Games and interactive tools](/topics/games/)
- [Maker Math](/topics/math/)

## Obsidian backlinks

Use these wiki links to connect this note inside a local maker vault:

- [[TopicLadder]]
- [[Maker Learning]]
- [[Interpolation for Motion and Controls]]
- [[Maker Math]]
- [[math]]
- [[motion]]
- [[Name start and end]]
- [[Choose the progress value]]
- [[Separate lerp from easing]]
- [[Clamp when safety matters]]
- [[Vectors for maker projects]]
- [[Electronics and controls]]

## Source and next routes

Source: https://topicladder.com/learn/interpolation-for-motion-and-controls/

- [Vectors for maker projects](/learn/vectors-for-maker-projects/)
- [Electronics and controls](/topics/electronics/)
- [Games and interactive tools](/topics/games/)
- [Maker Math](/topics/math/)
