# How to delay a display Python Processing

**URL:** <https://discourse.processing.org/t/how-to-delay-a-display-python-processing/37438>\
**Category:** Processing.py\
**Created:** [June 9, 2022, 10:26pm UTC](https://discourse.processing.org/t/how-to-delay-a-display-python-processing/37438 "2022-06-09T22:26:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)\
**Post date:** [June 12, 2022, 7:37am UTC](https://discourse.processing.org/t/how-to-delay-a-display-python-processing/37438/2 "2022-06-12T07:37:43Z")

</div>

I didn’t read through all your code. Maybe you could accomplish this with a ‘tween’ library? For Processing, there’s [Ani](http://www.looksgood.de/libraries/Ani/). I don’t _think_ it supports 3D, but it might adapt okay –

```python
add_library('Ani')
import jycessing.primitives.PrimitiveFloat as Float
y_rot = Float(0.0)

def setup():
    size(500, 500, P3D)
    Ani.init(this)

def draw():
    background(200)
    translate(width/2, height/2, 0)
    rotateY(y_rot.value)
    box(100)

def mouseReleased():
    # rotate box to 0° when pointer clicked at left edge,
    # and to 360° (τ rad) for pointer click at right edge
    rad = map(mouseX, 0, width, 0, TAU)
    Ani.to(y_rot, 1, 'value', rad)
    print(degrees(rad))

```

In the `Ani.to(y_rot, 1, 'value', rad)` line –

- the _y\_rot_ is your current rotation value
- _rad_ is the new/target _y\_rot_ value
- _1_ is the number of seconds to animate between _y\_rot_ and _rad_

Because of some Python-to-Java wierdness, you have to use `jycessing.primitives.PrimitiveFloat` for your Ani variables – hence the `Float()` to define `y_rot`, and accessing it with `y_rot.value`.

---

_[View the full topic](https://discourse.processing.org/t/how-to-delay-a-display-python-processing/37438)._
