Processing-Tutorial: A Grid of Arcs

YouTube

By loading the video, you agree to YouTube’s privacy policy.
Learn more

Load video

In this tutorial, you’ll learn how to create a grid-based, flexible visual system of quarter circles in Processing. I’ll show you how to use the wave functions in Processing to influence the rotation of the individual grid cells.

Again, some very important concepts come together in this video: Loops, Nested Loops, Variables, Functions, Wave Movements, Conditional Statements, and Partial Circles.

At this point I would like to thank my friend Martin Lorenz, who inspired me a lot with his input on this topic. Martin will soon publish his book on Flexible Visual Systems, which I highly recommend here.

https://martinlorenz.com/
https://www.instagram.com/martinlorenz/

Enjoy the journey!

Best,
Tim


The code

color bg = #000000;
color fg = #ff0000;

void setup() {
  size(900, 900);
}

void draw() {
  background(bg);
  fill(fg);
  noStroke();

  float tilesX = 4;
  float tilesY = tilesX;

  float tileW = width / tilesX;
  float tileH = height / tilesY;

  for (int x = 0; x < tilesX; x++) {
    for (int y = 0; y < tilesY; y++) {
      float posX = tileW * x;
      float posY = tileH * y;

      float wave = sin(radians(frameCount + x * 10 + y * 10));
      float mappedWave = map(wave,-1,1,0,5);
      
      int selector = int(mappedWave);

      pushMatrix();
      translate(posX, posY);
      if (selector == 0) {
        arc(0, 0, tileW*2, tileH*2, radians(0), radians(90));
      } else if (selector == 1) {
        arc(tileW, 0, tileW*2, tileH*2, radians(90), radians(180));
      } else if (selector == 2) {
        arc(tileW, tileH, tileW*2, tileH*2, radians(180), radians(270));
      } else if (selector == 3) {
        arc(0, tileH, tileW*2, tileH*2, radians(270), radians(360));
      } else {
        rect(0, 0, tileW, tileH);
      }

      popMatrix();
    }
  }
}

Published by Tim on Saturday June 12, 2021

Last modified on January 17th, 2022 at 8:45


Related

Exclusive

How to build the folder structure?

Processing Sessions Sketching Strategies

The best programming language for Creative Coding in 2022

Open Source Processing Tips Writings

I challenged Daniel Shiffman and here’s his response

Tutorials

A mockup-design-tool built with Processing

Apps Processing Projects Tools

Processing Community Day 2021 Recap

Community PCD Processing Writings
Exclusive

BlendModes in Processing

Processing Sessions
Exclusive

How to work with Layers in Processing?

Processing Sessions
Exclusive

Random Composition

Processing Sessions

New Course: Copy and Paste

Processing
Exclusive

Building a Poster Design Tool

Processing Sessions
Exclusive

Random Collage Generator

Processing Sessions

Processing Community Day 2021 – the recordings

Community PCD Processing Talks

PCD2021 – Sander Sturing

Community PCD Processing Talks

PCD2021 – Q&A with Casey Reas

Community PCD Processing Talks

Processing-Tutorial: Exploring Wave-Figures

Processing Tutorials

Interactive Grid System (Livestream)

Processing Tutorials

Processing-Tutorial: Render Videos with the Movie Maker

Processing Tutorials

Creative Coding Manifesto 2021

Films Philosophy Processing Stories Writings