# Record your programm?

**URL:** <https://discourse.processing.org/t/record-your-programm/27175>\
**Category:** Coding Questions\
**Created:** [January 18, 2021, 8:00pm UTC](https://discourse.processing.org/t/record-your-programm/27175 "2021-01-18T20:00:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NumericPrime](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/numericprime/32/16318_2.png) [@NumericPrime](https://discourse.processing.org/u/NumericPrime)\
**Post date:** [January 18, 2021, 8:00pm UTC](https://discourse.processing.org/t/record-your-programm/27175/1 "2021-01-18T20:00:58Z")

</div>

I have written a programm, that paints images using epicycles and now I want to record it.  
However everything I managed to find was recording videos using a cam.  
Could you help me with this?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 18, 2021, 8:06pm UTC](https://discourse.processing.org/t/record-your-programm/27175/2 "2021-01-18T20:06:08Z")

</div>

you can use saveFrame() command and then make a movie from the many images, see processing Menu Tools | Movie Maker

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [January 18, 2021, 8:11pm UTC](https://discourse.processing.org/t/record-your-programm/27175/3 "2021-01-18T20:11:47Z")

</div>

for reference here is a program I made a few weeks back.

```auto
ArrayList<star> stars = new ArrayList<star>();
ArrayList<particle> particles = new ArrayList<particle>();
float globalG = 0.1, colorOffset = 50, minStarSpeed = 2, maxStarSpeed = 6, minParticleSpeed = 2, maxParticleSpeed = 3, starSize = 8, killAt = 1.05;
void setup() {
  fullScreen();
  //size(600,600);
  colorMode(HSB);
}
void draw() {
  background(0);
  for(int i = 0; i < stars.size(); i++) {
    stars.get(i).move();
    stars.get(i).display();
    //checking for stars to delete
    if(stars.get(i).x > width*killAt || stars.get(i).y > height*killAt) {
      stars.remove(i);
    }
  }
  for(int i = 0; i < particles.size(); i++) {
    particles.get(i).move();
    particles.get(i).display();
    //deleting particels
    if(particles.get(i).age > particles.get(i).maxAge) {
      particles.remove(i);
    }
  }
  if(random(100) > 80) {
    addStar(random(width/2),random(height/2),random(minStarSpeed,maxStarSpeed),random(minStarSpeed,maxStarSpeed),color(random(255),255,255));
  }
  //Saveframe();
}
void mousePressed() {
  addStar(mouseX,mouseY,5,5,color(random(255),255,255));
}
void addStar(float x, float y, float xs, float ys, color clrFill) {
  stars.add(new star(x,y,xs,ys,clrFill));
}

class star {
  float xs,ys, x,y, r = starSize;
  color clr;
  star(float x_, float y_, float xs_, float ys_, color clr_) {
    x = x_;
    y = y_;
    xs = xs_;
    ys = ys_;
    clr = clr_;
  }
  void display() {
    fill(clr);
    noStroke();
    circle(x,y,r*2);
  }
  void move() {
    x += xs;
    y += ys;
    float rep = random(2,10);
    for(int i = 0; i < rep; i++) {
      float dir = random(TWO_PI), speed = random(minParticleSpeed,maxParticleSpeed);
      addParticle(x,y,cos(dir)*speed,sin(dir)*speed,0,20, color(hue(clr)+random(-colorOffset/2, colorOffset/2),255,255));
    }
  }
}
class particle {
  float x,y,xs,ys,age,maxAge;
  int id;
  color clr;
  particle(float x_, float y_, float xs_, float ys_, int startAge_, int maxAge_, color clrFill) {
    x = x_;
    y = y_;
    xs = xs_;
    ys = ys_;
    age = startAge_;
    maxAge = maxAge_;
    clr = clrFill;
  }
  void display() {
    fill(clr, map( age,0,maxAge,255,0));
    noStroke();
    circle(x,y,5);
  }
  void move() {
    ys+=globalG;
    x += xs;
    y += ys;
    age++;
  }
}
void addParticle(float x, float y, float xs, float ys, int startAge, int maxAge, color clrFill) {
  particles.add(new particle(x,y,xs,ys,startAge,maxAge, clrFill));
}
void Saveframe() {
  if(frameCount < 6000) {
    saveFrame("pictures/meteorShower-######.png");
  } else exit();
}

```

just uncomment //Saveframe(); in draw() to do so

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 18, 2021, 8:17pm UTC](https://discourse.processing.org/t/record-your-programm/27175/4 "2021-01-18T20:17:49Z")

</div>

there is also a lib

**before setup()**

```auto
import com.hamoid.*;

// ***************************************************************************
boolean videoExportIsOn=true;// *************************************************************************** 
// ***************************************************************************

VideoExport videoExport;

```

**in setup()**

```auto
  // hamoid video export
  if (videoExportIsOn) {
    videoExport = new VideoExport(this);
    videoExport.startMovie();

    println( "Use # for videoExport.endMovie");
  } else {
    println( "videoExport IS OFF +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
  }

```

**in draw()**

```auto
  // hamoid video export
  if (videoExportIsOn) {
    videoExport.saveFrame();
    // saveFrame();
  }

```

**TWO EXTRA FUNCTIONS**

```auto
void keyPressed() {
switch(key){
case 'e':
 endSketch(); 
break; 
}
}

void endSketch() {

  // hamoid video export 
  if (videoExportIsOn) {
    videoExport.endMovie();
    exit();
  }
}

```
