# To stop part of drawings from being removed at update

**URL:** <https://discourse.processing.org/t/to-stop-part-of-drawings-from-being-removed-at-update/8017>\
**Category:** Coding Questions\
**Created:** [February 1, 2019, 7:01am UTC](https://discourse.processing.org/t/to-stop-part-of-drawings-from-being-removed-at-update/8017 "2019-02-01T07:01:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ismaiel\_Ahmed](https://avatars.discourse-cdn.com/v4/letter/i/da6949/32.png) [@Ismaiel\_Ahmed](https://discourse.processing.org/u/Ismaiel_Ahmed)\
**Post date:** [February 1, 2019, 7:01am UTC](https://discourse.processing.org/t/to-stop-part-of-drawings-from-being-removed-at-update/8017/1 "2019-02-01T07:01:52Z")

</div>

I’m trying to simulate DDMR (Differential Drive Mobile Robot)  
However, draw() method makes update to all the shape and erase the previous frame  
I need to draw a specific shape and prevent it from being updated or removed at next frame, in the same time the rest of shapes normally updated and erased.

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [February 1, 2019, 7:33am UTC](https://discourse.processing.org/t/to-stop-part-of-drawings-from-being-removed-at-update/8017/2 "2019-02-01T07:33:48Z")

</div>

Don’t rely on what was drawn in the previous frame.

Redraw everything you want to see every single frame.

Then, if you don’t want something to be drawn, just don’t draw it!

---

<div class="post-metadata">

**Author:** ![Ismaiel\_Ahmed](https://avatars.discourse-cdn.com/v4/letter/i/da6949/32.png) [@Ismaiel\_Ahmed](https://discourse.processing.org/u/Ismaiel_Ahmed)\
**Post date:** [February 6, 2019, 4:50am UTC](https://discourse.processing.org/t/to-stop-part-of-drawings-from-being-removed-at-update/8017/3 "2019-02-06T04:50:52Z")

</div>

I was using MATLAB there was a function called hold();  
I’m searching for something like this in processing.  
Why shall i save all points in an Array and reshape it every loop !!!

---

<div class="post-metadata">

**Author:** ![Ismaiel\_Ahmed](https://avatars.discourse-cdn.com/v4/letter/i/da6949/32.png) [@Ismaiel\_Ahmed](https://discourse.processing.org/u/Ismaiel_Ahmed)\
**Post date:** [February 6, 2019, 5:07am UTC](https://discourse.processing.org/t/to-stop-part-of-drawings-from-being-removed-at-update/8017/4 "2019-02-06T05:07:40Z")

</div>

I tried to make a loop and draw every loop everything … it makes the executing process too slow, I don’t think this is effective way.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [February 6, 2019, 6:03am UTC](https://discourse.processing.org/t/to-stop-part-of-drawings-from-being-removed-at-update/8017/5 "2019-02-06T06:03:42Z")

</div>

not clear we talk same thing, but where you loose the speed?  
do you use shapes?

```auto
PShape head, body, arm;
float ang,speed=0.2;

void setup() {
  size(200, 200);
  frameRate(120);
  // Make shapes
  ellipseMode(CORNER);
  head = createShape(ELLIPSE, -25, 0, 50, 50);
  head.setFill(color(0,0,200));
  body = createShape(RECT, -25, 45, 50, 40);
  body.setFill(color(0,200,0));
  arm = createShape(ELLIPSE, -5, 0, 50, 5);
  arm.setFill(color(200,0,0));
  println("use: mouseX for speed");
}

void draw() {
  background(200,200,0);
  push();
  translate(width/2,50);
  shape(head);
  shape(body);
  translate(20,50);
  ang += speed;
  rotate(ang);
  shape(arm);
  pop();
  text(nf(frameRate,1,1)+" FPS; speed "+nf(speed,1,1),20,height-10);
}

void mouseMoved() {
 speed = map(mouseX,0,width,0,PI); 
}

```
