Okay, so, “3 of 400” – sounds kinda mysterious, right? It’s actually just my super simple way of tracking my daily creative coding challenge. I decided to do 400 of these mini-projects, and this is just day three. Nothing fancy, I promise.
I started by firing up Processing. It’s this cool, free software thing that lets you draw stuff with code. I’ve been messing with it for a while, but I’m definitely no expert. Just a heads-up.
My goal for today was simple: make some circles move around. I know, I know, it’s not exactly groundbreaking, but you gotta start somewhere, right? I opened a new sketch and started with the basic setup.
- I set the size of my canvas – I think I went with 600×400 pixels. Just a random size, really.
- I picked a background color. Something dark, so the circles would pop.
- I declared a few variables,things to hold the circle’s position and speed.
Then, inside the draw()
function – this is the part that runs over and over, making the animation happen – I did the following:
- I created a circle using the
ellipse()
function. I gave it the x and y position that I defined before. - I updated the position of the circle by adding the speed to it. Think of it like, each time the
draw()
function runs, the circle moves a little bit. - I add condition, I made sure the circle bounced off the edges of the canvas. So, when it hit the side, the speed would reverse. Just some simple “if” statements.
Honestly, the first few tries were a mess. The circle was either too slow, too fast, or it just flew off the screen. It took some tweaking of the numbers to get it looking okay. I kept changing the speed values and the starting position until I was happy with it.
I spent quite a bit of time messing with the colors. Then, I made the circle change color every time it bounced off the edge of the canvas. Then I make the circle trail.
And that’s it, That’s my “3 of 400”. A super basic animation of a bouncing,color change and trail circle. I’m not gonna win any awards for it, but I learned a few things, and that’s the whole point of this challenge, right? Just keep practicing, keep making stuff, and see what happens. Tomorrow: something different. Maybe squares? Who knows!