Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0>
    <style> body {padding: 0; margin: 0;} </style>
   
  </head>
  <body>
    <div class="container">
    <div id="canvas" style="height: 100%;width: 100%">
      
    </div>
    
    
  
  </body>
</html>

              
            
!

CSS

              
                canvas {
    
    
    padding-left: 0;
    padding-right: 0;
    margin-left: auto;
    margin-right: auto;
    display: block;
    
}

@media (max-width: 700px){
  canvas {
    opacity: 0;
  }
  #solucoes {
    opacity:100;
  }
}

 
 div#canvas {
	 position: relative;
 }
 
              
            
!

JS

              
                var canvas;
var width = window.innerWidth;
var height = window.innerHeight;
let angle = 0;
var x = [];
var y = [];
var unitSize = [125,125,125,125,125,125,125,125,125];
var xoff = [0,1,2,3,4,5,6,7,8];
var a = [0,1,2,3,4,5,6,7,8];
var circles = [0,1,2,3,4,5,6,7,8];
var images = [0,1,2,3,4,5,6,7,8,9];

  function preload(){

  	images[0] = loadImage("http://farm2.staticflickr.com/1778/29160206027_abd087c675_b.jpg"); 
  	images[1] = loadImage("http://farm2.staticflickr.com/1794/44049465922_18ef9aa351_b.jpg");
  	images[2] = loadImage("http://farm2.staticflickr.com/1815/44098593551_87a10cbe19_b.jpg");
  	 images[3] = loadImage("http://farm2.staticflickr.com/1815/44049466172_fbb2a0a562_b.jpg");
  	 images[4] = loadImage("http://farm2.staticflickr.com/1817/44049466432_62baf96a12_b.jpg");
  	 images[5] = loadImage("http://farm2.staticflickr.com/1840/44049466632_cc4b91e6a8_b.jpg");
  	 images[6] = loadImage("http://farm2.staticflickr.com/1771/42289015110_4221bd5b28_b.jpg");
  	 images[7] =  loadImage("http://farm2.staticflickr.com/1791/44049466792_e34aa61a0d_b.jpg");
  	 images[8] = loadImage("http://farm2.staticflickr.com/1798/42289015190_0d2e038807_b.jpg");
  	 images[9] = loadImage("http://farm2.staticflickr.com/1838/44050916662_1987c28586_b.jpg");
 }
 

  function setup() {
    canvas = createCanvas(600, 600);       //use WEBGL when using texture()
    canvas.parent("canvas"); 
    
  }

  function windowResized() {
    resizeCanvas(windowWidth, windowHeight);
  }
    
  
document.getElementById( "canvas" ).onwheel = function(event){
    event.preventDefault();
};

document.getElementById( "canvas" ).onmousewheel = function(event){
    event.preventDefault();
};

function onPClick() {
  window.location.href = "http://p5js.org/";
}   

  function draw() {
    
    //delete this line when using WEBGL
    noStroke();
    background( 255 );
    translate(width/2,height/2);
    push();
    //rotate the black ellipses
     rotate(angle);
    //rotation speed
    
    //using noise() to get smooth random x values and using xoff to     get different random values for each black ellipse
     for (var i = a.length - 1; i >= 0; i--) {
      a[i] = map(noise(xoff[i]), 0 , 1 , 200 , 230);
      x[i] = a[i] * cos(i * TWO_PI/9.0);
      y[i] = a[i] * sin(i * TWO_PI/9.0);
      xoff[i] += 0.01;
    }
    
    //draw the black ellipses
    for( var i = 0; i < circles.length; i++) {

    //texture(images[i]);
     stroke(0);
     line( 0 , 0 , x[i] , y[i]);
     stroke(120);
     line( x[i] , y[i] , x[i+1] , y[i+1] );
     stroke(120);
     line( x[i] , y[i] , x[i-1] , y[i-1] );
     stroke(120);
     line( x[8] , y[8] , x[0] , y[0] );
    //stroke(0);
    //line( 0, 0,x,y);
    
    imageMode(CENTER);
    image(images[i], x[i] ,y[i], 125,125);
    
    // fill(0);
    //draw each ellipse with different x value
    noStroke();
    //ellipse( x[i], 0, unitSize[i], unitSize[i] ); 
    } 
    pop();
    
    //big central image
    imageMode(CENTER);
    image(images[9],0,0,260,260);
  }

	

              
            
!
999px

Console