# Don't understand what this code means (easing)

**URL:** <https://discourse.processing.org/t/dont-understand-what-this-code-means-easing/38588>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [August 31, 2022, 5:46pm UTC](https://discourse.processing.org/t/dont-understand-what-this-code-means-easing/38588 "2022-08-31T17:46:24Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [September 1, 2022, 11:08am UTC](https://discourse.processing.org/t/dont-understand-what-this-code-means-easing/38588/5 "2022-09-01T11:08:12Z")

</div>

Hello @EKEN ,

You can also do a search here for _easing_:  
[https://processing.org/](https://processing.org/)

Example on Processing site with description:  
[https://processing.org/examples/easing.html](https://processing.org/examples/easing.html)

Take a look at this example:

> [@Easing, don't get it fully](https://discourse.processing.org/t/easing-dont-get-it-fully/22154/2):
>
> 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. float x = 0.0; float easing = 0.5; float targetX; void setup() { size(500, 100); } void draw() { backgrou…

The _easing_ in example above is the same as yours except that it eases across the screen with a _keyPressed()_ and expanded below:

```auto
void keyPressed()
  {
  targetX = width;
  float dx = targetX-x;  
  x += dx*easing;
  println(x, easing, targetX); // Very useful to print values to console
  }

```

`:)`

---

_[View the full topic](https://discourse.processing.org/t/dont-understand-what-this-code-means-easing/38588)._
