# Morph from one position to another - animation

**URL:** <https://discourse.processing.org/t/morph-from-one-position-to-another-animation/21112>\
**Category:** Coding Questions\
**Created:** [May 20, 2020, 7:53pm UTC](https://discourse.processing.org/t/morph-from-one-position-to-another-animation/21112 "2020-05-20T19:53:55Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 21, 2020, 8:31pm UTC](https://discourse.processing.org/t/morph-from-one-position-to-another-animation/21112/10 "2020-05-21T20:31:51Z")

</div>

Check out list-based interpolations

> [@Varying scale at frameCount](https://discourse.processing.org/t/varying-scale-at-framecount/17896/3):
>
> One method is to use list-based interpolations float lerps( float amt, float... vals) { if(vals.length==1){ return vals[0]; } float unit = 1.0/(vals.length-1); return lerp(vals[floor(amt / unit)], vals[ceil(amt / unit)], amt%unit/unit); } So my time / vals will be like this: 0 1.5 100 1.5 200 1.5 300 1.5 400 1.5 500 2.0 So my amt, which ranges 0-1.0, will be time/500.0 and my vals will be new float[] {1.5, 1.5, 1.5, 1.5, 1.5, 2.0} With that, lerps() will return the correct result…

…and a related discussion using PVector

> [@\[Processing\] Unfolding columns](https://discourse.processing.org/t/processing-unfolding-columns/610/4):
>
> Thanks @dan850 + @jeremydouglass Yes. They’re all 3D shapes. They’re essentially two lists of vertices: one that is flattened onto a 3D plane, and one that has depth. I’m using shear, rather than rotate, to show the depth of the unflattened shape. That way, the top side of the shapes maintain the 90 degree angles, and when combined with ortho() mode, keeps lines parallel in an oblique projection. What I meant by 2D to 3D is the perceptual sense, that one state looks like it’s a 2D pattern and …

---

_[View the full topic](https://discourse.processing.org/t/morph-from-one-position-to-another-animation/21112)._
