# Möbius Strip Animation

**URL:** <https://discourse.processing.org/t/mobius-strip-animation/13273>\
**Category:** Gallery\
**Created:** [August 9, 2019, 12:28pm UTC](https://discourse.processing.org/t/mobius-strip-animation/13273 "2019-08-09T12:28:15Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 13, 2019, 2:39am UTC](https://discourse.processing.org/t/mobius-strip-animation/13273/6 "2019-08-13T02:39:40Z")

</div>

Seamless **Möbius** strip:

```auto
// Author: GLV
// Date: 2019-08-12 
// Description: Seamless Mobius strip
// 2 extra transparent QUAD_STRIPS added to acheive this

PShape m;
float thX, thY, thZ;
float x, y, z;
int steps;
int addStep = 2; // Change this to -1, 0, 1, 2

public void settings()
  {  
  size(1280, 1024, P3D);
  }

public void setup()
  {
  ortho();
  }

public void draw()
  {  
  background(0);
  lights();
  surface.setTitle(str(frameRate));
  
  thY += TAU/1000;
  thX += TAU/2000;
  thZ += TAU/1000; 
 
 pushMatrix();
  translate(width/2, height/2);
  rotateY(thY);
  rotateX(thX);
  rotateZ(thZ);  

  noStroke();
  mobius(100, 300, 80, 0);
  shape(m);   
 popMatrix();
  }
 
public void mobius(int steps, float r, float v, float u)
  { 
  m = createShape();
  m.beginShape(QUAD_STRIP);
  for (int step = 0; step < (steps+1) + addStep; step++) // 2 steps added for seamless mobius strip
    {
    u = step*(TAU/steps);  

    if (step > steps)
      m.fill(color(255, 128, 0, 0)); //100% transparent
    else
      m.fill(color(255, 128, 0, 255)); //100% opaque
     
    mobEq(r, -v, u);
    m.vertex(x, y, z);

    mobEq(r, v, u);
    m.vertex(x, y, z);
    }
  m.endShape();
  }

public void mobEq(float radius, float v, float u)
  { 
  x = (radius + v * cos(u/2)) * cos(u);
  y = (radius + v * cos(u/2)) * sin(u);
  z = v * sin(u/2);
  }

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/5dade73b04036b98dca30b1fb4e01d48e516fc1c.png)

---

_[View the full topic](https://discourse.processing.org/t/mobius-strip-animation/13273)._
