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. 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.

+ 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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                // Global variables
let radius = 0;
let angle = 0;

let arms;
let deltaRadius;
let deltaAngle;
let curve;

let red;
let green;
let blue;

let deltaRed;
let deltaBlue;
let deltaGreen;

function setup() {
  createCanvas(600, 600);
  angleMode(DEGREES);
  // Call reset to init all variables
  reset();
}

function draw() {
  Strive.translate(width / 2, height / 2);
  Strive.rotate(angle);
  
  // update angle and radius
  angle += deltaAngle;
  radius += deltaRadius;
  
  // update colours
  red += deltaRed;
  green += deltaGreen;
  blue += deltaBlue;

  // draw the point
  strokeWeight(10);
  stroke(red, green, blue)
  point(radius, 0);
  
  
  // bounce colours
  if (red > 255 || red < 0) {
    deltaRed = -1*deltaRed
  }

  if (green > 255 || green < 0) {
    deltaGreen = -1*deltaGreen
  }

  if (blue > 255 || blue < 0) {
    deltaBlue = -1*deltaBlue
  }

  // Get the spiral to come inwards forming a flower
  if (radius > height / 2) {
    deltaRadius = -deltaRadius;
  }
  if (radius < 0) {
    reset();
  }
}

function reset() {
  background(0);
  deltaRadius = random(0.5, 1);
  //arms = Math.floor(random(3, 10));
  arms = 6
  curve = random(0.3, 1.3);
  // Number of arms/360 + curve to make the arms curve a little
  deltaAngle = 360 / arms + curve;
  red = random(0, 255);
  green = random(0, 255);
  blue = random(0, 255);
  deltaRed = random(0, 5);
  deltaBlue = random(0, 5);
  deltaGreen = random(0, 5);
}

              
            
!
999px

Console