# Trying to rec a frame of my animation to SVG file

**URL:** <https://discourse.processing.org/t/trying-to-rec-a-frame-of-my-animation-to-svg-file/18516>\
**Category:** Coding Questions\
**Created:** [March 8, 2020, 10:23pm UTC](https://discourse.processing.org/t/trying-to-rec-a-frame-of-my-animation-to-svg-file/18516 "2020-03-08T22:23:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JakeCodeNewbie](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@JakeCodeNewbie](https://discourse.processing.org/u/JakeCodeNewbie)\
**Post date:** [March 8, 2020, 10:23pm UTC](https://discourse.processing.org/t/trying-to-rec-a-frame-of-my-animation-to-svg-file/18516/1 "2020-03-08T22:23:20Z")

</div>

I am new to coding and I am working with this code to create a unique poster design using lines. I cannot successfully record a frame to an SVG file so I can use a pen plotter. I am sure I have a couple things out of order but I am too unfamiliar to identify the issue. If anyone has any suggestions, please help!!

```auto
//import svg library
import processing.svg.*;
//set up record boolean
boolean record;
//setup function runs only once
float x = 400;

void setup() {
  size(600, 600);
  frameRate(5);
  //noLoop();
  background(255);
  smooth();
  noCursor();
}

void draw(){
  // check if recording
  if (record) {
    //begin recording and call the file frame-framenumber
    beginRecord(SVG, "frame-###.svg");
  }

  translate(mouseY, mouseX);
  x = x+1; 
  rotate(radians(x));
 
  line(300, 150, 300, 120-x); 
  stroke(26);
  
 
 //check if recording
  if(record){
    endRecord();
    record = false;
  }
}

//check for keypress
void keyPressed(){
  if (key == 'b'){
    record = true;
  }
}

```

---

<div class="post-metadata">

**Author:** ![debxyz](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@debxyz](https://discourse.processing.org/u/debxyz)\
**Post date:** [March 9, 2020, 8:01pm UTC](https://discourse.processing.org/t/trying-to-rec-a-frame-of-my-animation-to-svg-file/18516/2 "2020-03-09T20:01:56Z")

</div>

Hello and welcome to the forum @JakeCodeNewbie !

Please note, unformatted code is hard to read. 🧐

**Increase your chances for a faster response to your question**. Please format your code. To learn how: [https://discourse.processing.org/faq#format-your-code](https://discourse.processing.org/faq#format-your-code)

**For example, this:**

```auto
import processing.svg.*; // import svg library

boolean record; // set up record boolean

float x = 400; // setup function runs only once

```

**Is easier to read, than this:**

//import svg library  
import processing.svg.\*;  
//set up record boolean  
boolean record;  
//setup function runs only once  
float x = 400;

Thank you!  
🙂
