# Help in Slit-Scan

**URL:** <https://discourse.processing.org/t/help-in-slit-scan/14195>\
**Category:** Libraries\
**Created:** [September 25, 2019, 4:50am UTC](https://discourse.processing.org/t/help-in-slit-scan/14195 "2019-09-25T04:50:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![royal96](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@royal96](https://discourse.processing.org/u/royal96)\
**Post date:** [September 25, 2019, 4:50am UTC](https://discourse.processing.org/t/help-in-slit-scan/14195/1 "2019-09-25T04:50:19Z")

</div>

hello 🙂

i have written this code for Slit-Scan,

```auto
import processing.video.*;

Capture video;

int x = 0;

void setup() {
 size(2000, 720);
 frameRate(120);

video = new Capture(this, 1280, 720);

// Start capturing the images from the camera
   video.start();  

  background(0);
}

void captureEvent(Capture video) {
  video.read();
  
}

void draw() {
 
  int w = video.width;
  int h = video.height;
  copy(video, w/2, 0, 1, h, x, 0, 1, h);

  x = x + 1;
  //panning

  if (x > width) {
    x = 0;
   //panning cycles back to beginning
  }

}

```

but i need start the capture from the center of screen, it will be like the circle or the clock (rotate it ) like this :

 ![screen](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c93217b594c233af8e22301a717382b73928e271.jpeg)

---

<div class="post-metadata">

**Author:** ![raetrakt](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@raetrakt](https://discourse.processing.org/u/raetrakt)\
**Post date:** [September 29, 2019, 10:05am UTC](https://discourse.processing.org/t/help-in-slit-scan/14195/2 "2019-09-29T10:05:52Z")

</div>

cool sketch! here’s how you can make the circular effect work:

```auto
import processing.video.*;

Capture video;

//changed to float
float x = 0;

void setup() {
  size(960, 960);
  frameRate(120);

  video = new Capture(this, 640, 480);

  // Start capturing the images from the camera
  video.start();  

  background(0);
}

void captureEvent(Capture video) {
  video.read();
}

void draw() {

  int w = video.width;
  int h = video.height;

  x += 1; //you can change this to e.g. 0.5 to make it less choppy
  //panning

  //new center in the middle of the sketch
  translate(width / 2, height / 2);

  //use x to rotate around the new center
  float rotation = map(x, 0, width, 0, TWO_PI);
  rotate(rotation);

  //copy always to the same place, while the canvas is being rotated
  //copied slits are a bit bigger now to avoid black stripes inbetween (and moiree)
  copy(video, w/2, 0, 10, h, 0, -height/2, 10, h);

  if (x > width) {
    x = 0;
    //panning cycles back to beginning
  }
}

```

---

<div class="post-metadata">

**Author:** ![royal96](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@royal96](https://discourse.processing.org/u/royal96)\
**Post date:** [September 29, 2019, 11:58pm UTC](https://discourse.processing.org/t/help-in-slit-scan/14195/3 "2019-09-29T23:58:04Z")

</div>

Mr- retrakt, Thank you very much i appreciate it . 💐
