# Easing, don't get it fully

**URL:** <https://discourse.processing.org/t/easing-dont-get-it-fully/22154>\
**Category:** Beginners\
**Created:** [June 25, 2020, 10:39am UTC](https://discourse.processing.org/t/easing-dont-get-it-fully/22154 "2020-06-25T10:39:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [June 25, 2020, 11:15am UTC](https://discourse.processing.org/t/easing-dont-get-it-fully/22154/2 "2020-06-25T11:15:07Z")

</div>

Hello,

Work through this program.  
You move 1/2 way with each key press.  
And then modify the easing value and try it.  
I used a fixed destination (width) instead of a moving one (mouseX).

The default frameRate is 60 fps so things move quickly each frame.  
[https://processing.org/reference/frameRate\_.html](https://processing.org/reference/frameRate_.html)

I slowed it down to only advance with a key press.

```auto
float x = 0.0;
float easing = 0.5;

float targetX;

void setup() 
  {
  size(500, 100);
  }
                 
void draw()   
  {
  background(0);
  targetX = width;

  
  ellipse(width, 30, 40, 40);
  ellipse(x, 70, 40, 40);
  }
  
  
void keyPressed()
  {
  x += (targetX - x) * easing;
  println(x, easing, targetX);
  }

```

println() is your friend when it comes to understanding and troubleshooting.  
[https://processing.org/reference/println\_.html](https://processing.org/reference/println_.html)

Processing website example:  
[https://processing.org/examples/easing.html](https://processing.org/examples/easing.html)

`:)`

---

_[View the full topic](https://discourse.processing.org/t/easing-dont-get-it-fully/22154)._
