Is Creative Coding with ChatGPT possible?

Introduction

Everyone is talking about ChatGPT right now. Everyone.

In recent years, artificial intelligence technology has grown at a fast pace, and one of its main representatives is ChatGPT, a language model developed by OpenAI.

This model has become a real celebrity in the world of artificial intelligence and has drawn the attention of many people, including researchers, developers, and simple users.

ChatGPT has been used in many different fields, from answering customer support questions, to automatic translation, to text generation and much more. This artificial intelligence model is very flexible and can be trained on a wide range of tasks, making it a very useful tool for many companies and organizations.

In addition to personal use, I have also started to use ChatGPT in my work as a website developer: I have used the model to generate code and documentation more quickly and accurately, saving a lot of time and effort.

Continue to read or watch my experiments with AI and creative coding in my last YouTube video!

Using ChatGPT for write Processing code

After basic uses for my work, I wondered: could it write code to create visuals and interactive designs with Processing? And its results have impressed me a lot! Here are some examples of conversations with the AI and the generated code:

Output:

Then added:

Output:

And then:

Output:

And last request:

Output:

This could have been summarized in a single prompt, and I asked ChatGPT to show me how:

Here’s the final code in Processing, feel free to use it and customize it as you want!

int side = 20; // adjust this value for the size of grid

void setup() {
  size(600, 600);
  background(255);
  noStroke();
}

void draw() {
  if (mousePressed) {
    fill(random(255), random(255), random(255));
    int x = (int) (mouseX / side) * side;
    int y = (int) (mouseY / side) * side;
    rect(x, y, side, side);
  }
}

Try it yourself: click and draw on this blank canvas

Incredible, right? And all this could be rewrite or converted in p5.js too!


I then further explored other aspects of creative coding with the help of AI, and you can find other artworks on my profile @octopusgardenden.

Conclusion

As you can see, ChatGPT can be used to learn the basics of creative coding by asking it questions and receiving clear and concise answers. This allows you to quickly understand specific concepts or syntax for different programming languages, such as Processing, without having to sift through lengthy documentation or tutorials.

In conclusion, ChatGPT is a truly amazing and versatile AI model that can be used in many different situations. Whether you are a casual user, a developer, or a designer, this model can help you perform many tasks more efficiently and accurately. If you haven’t tried it yet, I recommend giving it a shot: you might discover many interesting things and grow in your field!