cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              html,
body {
  padding: 0;
  margin: 0;
  background-color: black;
  overflow: hidden;
}
            
          
!
            
              // based on code by Keith Peters: https://bit101.github.io/lab/dailies/170329.html

var theta = 0;
var frms = 180;

function setup() {
  createCanvas(windowWidth, windowHeight);
}

function draw() {
  background(243, 134, 48);
  // moving the axis to the center
  translate(width/2, height/2);
  // rotating around the center of the image
  rotate(theta);
  // calculate the time, the y-location of both arcs and their radii
  var t = map(sin(theta), -1, 1, 0.15, 0.85);
  var y0 = -200 + 200 * t;
  var r0 = 400 * t;
  var y1 = 200 - 200 * (1 - t);
  var r1 = 400 * (1 - t);
  //background circle  
  fill(238);
  noStroke();
  ellipse(0, 0, 400, 400);
  // black part  
  fill(34);
  arc(0, 0, 400, 400, PI / 2, TWO_PI-PI / 2);
  arc(0, y0, r0, r0, -PI / 2, PI / 2);
  // white part
  push();
  translate(0, 400-r1);
  rotate(PI);
  fill(238);
  arc(0, y1, r1, r1, -PI / 2, PI / 2);
  pop();
  // white dot in black part
  fill(238);
  ellipse(0, y0, r0 * 0.1, r0 * 0.1);
  // black dot in white part
  fill(34);
  ellipse(0, y1, r1 * 0.1, r1 * 0.1);
  // calculating the angle of rotation
  theta += TWO_PI/frms;
}
function windowResized() {
  resizeCanvas(windowWidth, windowHeight);
}
            
          
!
999px
Loading ..................

Console