Polar Grids: Intro to Generative Art 2.0 | Hadeel Alharthi | Skillshare
Drawer
Search

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Polar Grids: Intro to Generative Art 2.0

teacher avatar Hadeel Alharthi, Creative Coder and Artist

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction

      0:43

    • 2.

      Setting up

      2:39

    • 3.

      Trigonometry explained

      1:35

    • 4.

      A point on a circle

      5:19

    • 5.

      Points on a circle

      3:56

    • 6.

      Adding more circles

      3:12

    • 7.

      Coloring the design

      4:23

    • 8.

      Exploring another shape

      3:35

    • 9.

      Rotation explained

      1:11

    • 10.

      Exporting the design

      2:51

    • 11.

      Your turn!

      0:40

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

414

Students

9

Projects

About This Class

Join me in this class where we'll learn the basics needed to generate a polar grid. We'll use some math formulas in Processing to create a cool generative art piece that can be used as a digital background, or applied to any of your other design practices. By completing this course, you'll acquire the skills needed to create plenty of projects requiring a polar coordinate system. Namely, any projects that use a polar grid.

The class is designed mainly for Artists and Designers but a bit of programming knowledge is needed. If at any point, you're lost, you can check my Intro to Generative Art class where I delve deeper into the Processing programming language and some of the basic concepts of programming. It'll aid you in finishing this class.

Enjoy!

Meet Your Teacher

Teacher Profile Image

Hadeel Alharthi

Creative Coder and Artist

Teacher

ABOUT

Hi! I'm Hadeel, and this is my humble digital abode. I'm a creative coder and artist whose sole passion is to learn all there is to know about generative art — or rather the digital art world in general. I'm curious by nature, and I love to share my findings. So if you're interested in learning generative art, this is the place to be. Welcome!

 

HOW TO NAVIGATE THE COURSES

If you're new to generative art, I recommend starting with either Back to the Basics or Intro to Generative Art. The latter is a much shorter course for anyone with too little time on their hands. Next, I'd go with Switches since that showcases my whole process, from ideating to the final design. The rest you can follow in any order since yo... See full profile

Level: Intermediate

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: Hello, everyone. My name is video and this is polar grids. In this class, we leverage or trigonometry knowledge to create a fun generative artists like this one. I promise you learning about trigonometry and the polar fernet system to code and art is far more pleasant and easier to digest. We'll start by outlining what we need. Revising some of the trigonometry functions after it will learn how to convert the X and Y Cartesian coordinates to polar coordinates that can then be used to make April. Of course, now polar great one exist on our campus unless we implement treatment. Color, therefore, will next populate ER grid with shapes and colors and manipulated parameters to produce different variations of are generated Artie's. I hope that by now you're enticed to go through this tenet of our journey. Let's do this 2. Setting up: before he started any of my designs and planned them out to figure out the needed parameters. Whether it's on a piece of paper or on my computer directly, let's look at this design and figure out what we need. We'll start with one circle, and then we'll deal with the series of concentric circles for the one circle will require a radius, a number of slices and the sides of the slice. Then we'll repeat that for every consecutive circle, adjusting the parameters is needed inside the loop, since the circles radi I are getting bigger and the slices won't get the same. Okay, so for setting up for a project like this one where I don't have to really draw it on a piece of paper in order to understand what's happening, I will just do it. Definitely. The way to do this is by opening a file, setting up the main functions that I need and then trying to figure out what I need for that design. Sometimes, for a simple design like this one, I will just go and start creating. I will do it the same way actually planned for this class, so we will start with a point on a circle, and that's usually what I dio. I will just create the functions for that circle. And I will think, What is it that I need for that circle? What kind of variables do I need? And then I will just write them down over here so we'll just say, Okay, I need a radius. I needed to be afloat just to avoid, um, breaking the design. Because sometimes into jurors will round numbers and it will look her kid, especially for grids. And then I'll think, What else do I need inside of that radius? I know that I need slices. I know that I need angles and so I will just do Okay, I need a number of slices and I will need a size or an angle for each slice. And so that's how these other variables come in. And then I know I need an accent y coordinates. And now that I know that I need more rings or more circles for that polar grit to actually look like a grid, I will just adds another variable cult circles, and I know that that is going to encompass the number of circles. It's up to you how you want to name thes variables. I mean, some people don't do angle, and they will just do Fada. Some people will do angle. And for me, actually, it depends. I don't really think about it that much. As long as the variables air descriptive enough free to come back to the program and understand what is actually doing, then you're good to go. Now let's actually get into coding. 3. Trigonometry explained: a lot of the fantastic designs out there used trick functions mainly sign on co sign. After this lesson, you'll master the use of these functions to create a polar grid that will open a lot of possibilities. Design wise, every polar grid starts with a triangle and from math class. We know that in every right triangle relative to one of the two none right angles. There's an adjacent on opposite side and a cross from the right angle. There's the high pod news. We also know that we can produce the sign of an angle by dividing the opposite length by the high partners length and the co signed. By dividing be a day sent by the high pot news, we can utilize this knowledge to create our points position on a circle. Fortunately, in processing, we have a sign and co sign function that will do the calculation for us. Let's look at how using these functions can help us plot points on a circle and thus creating the polar grid. We can pass the desired angle inside of our function to get our X and Y values. Visualizing this on a circle. We can see that For an angle of zero degrees, we get a value of zero and one for signing Cosan, respectively. For 45 degrees, we get 450.7 for both and for 90 degrees we get one and zero. These are our X and Y coordinates for 90 degrees. We have a point at 01 for 45 degrees. We have a point at 450.0.7 point seven and 40 We have a point at one and zero. But if you notice the values air too small for our canvas, therefore we need to multiply the values in order to see them properly. That's where the radius comes in, multiplying the X and Y coordinates by the desired radius. We'll get us points on the edge of a circle with that radius, and that's her polar grid. 4. A point on a circle: before we start creating points on a circle and start creating the polar. Greg, I want to first explain how point on a circle is plotted using code. I'm going to start by creating an ellipse that is going to be positioned at X and Y I'm going to set that in a second. And I'm going to give this lips the size of eight. Now, ex God save zero and why it's zero, and you can see the point over here. Now we want to push this point to the middle of this crane, so I'm going to just do what? Divided by two and height divided by two. So you can see how we can easily push that circle around this cream, just using any parameters that we have with, um, hide our native parameters in the processing language, and they basically take from the size function. So the width is 500 the height is 500 I divided up by two to get the middle of the screen. So now we have, except 250 pixels and why is at 250 pixels? You know, from what we learned about the polar coordinates system. We know that in order to draw points on a circle, we need to use the co sign and sign functions. So we already figured out that for X we're going to use the coastline function and for why we're going to use the sine function. So let's remove what we have already. And let's set the X to co sign angle and then hear what's said it to sign of the ankle. And let's create the angle. Variable must make it zero. Let's see what happens now. It went back to zero Z or a position over here, but it's not actually at 00 because we know that the co sign of zero is one. So it is actually one pixel from the left and you're pixel from the top and we can see that is we multiply it by a bigger number. Let's say the radius of the circle that we want. So I'm going to just set this radius of the circle over here. 200 analysts see what happens now. You see how the Y value didn't change, and it's still zero to see how the X is now. 100 going over a fact that X waas one pixels because now it's at 100 pixels. And if you want to make sure even more, weaken, set the radius to 500 and see if it gets to the end of this crane. Now it's at the end of this queen. So now it's actually 500 and we can also to make sure print the accent, my cornice. We can see that it's 500 for X and zero for y, and if I change it to 100 it's 100 0 Now we can do one more thing, and that is change the center, which is the center of the circle, which is now 00 to the middle of the screen. We're going to do exactly what we just bad using with divided by two in height divided but you, But we're gonna add it to what we already have. And now we have a point on a circle with a radius of 100 pixels. If you want to make sure that it's on top of our circle that has a radius of 100 pixels weaken draw, this lifts I'm gonna do on the lips that with divided by two and height divided by two And I'm gonna give it the size for the radius multiplied by two and I'm gonna give it Ah, height of radius multiplied by two days. Well, since it's a perfect circle, you can see that the point is, in fact, on top of all right circle can change the stroke too white, and we can give it no Phil. And now we can see better. Next, we'll see how we can create multiple points on a circle using the same method that we just used. 5. Points on a circle: now, in order to create multiple points on the circle, we need to know the number of slices, and we also need to know the size of each slice. Let's first start by setting the number of slices, so I'm gonna just set it at six first and then in here. I'm going to sect the size of the slice to be 3 60 because that's thes some of the internal angles in a circle divided by the number of slices, which is going to give us the size of each slice in decrees. The only problem here is that we want to use this degree or this angle inside of our co sign and sign functions, and those only take radiance. We can convert the angle into radiance, but I don't like to nest too many functions. I'd rather just changed the 3 60 into two pike, which is a constant that is already set for you in processing. Now, if we print slice, we'll find that too pie divided by the slices or 3 60 divided by a slice, is gonna give us 60 degree angles in radiance. It's going to be different, of course, but now we're not using the slice or changing or making the angle dynamic. So in order to do that, I'm gonna have to create a four loop to use the loop or to use the variable inside of the loop to change the angle. So let's create the loop and inside of the loop. The condition is going to be the number of slices because I want a loop through each slice until I hit the last slice. So I'm going to just do eyes less than slices that I'm going to increment, and I'm going to encompass all of this on the side of my for loop. Just indented were clean. Look. Okay, now we have the slice size, but we still don't have the position of each point. Now we need another step in order to plot the points in the right position on the circle. If I set the slice as the angle inside of my coastline and sine function, it's still not going to be dynamic, mainly because the slice is going to have one size. So I'm going to use the I in the for loop to set the angle to be dynamic, and you can easily do that by multiplying the I value by the slice size. So for the 1st 1 it's going to be zero multiplied by 60 which is going to produce zero for the angle. So that's our first point, and then their second point is going to be at I one, and it's going to be multiplied by 60 again, and that's going to produce 60. So it's going to go to 60 degrees and plot another point. And then two multiplied by the slice again, which is 60 degrees is going to give us 1 20 And that's the third point, and so on and so forth. So let's just do that. I multiplied by slice. We should now get six points on our circle, and we can play around with number of slices now to see if our formula actually works and it works. You see the more points or the more slices we add, the better the circle looks In the next video, we'll talk about adding more circles to this 6. Adding more circles: now we'll be adding more circles. In order to do that, we're gonna need to know the number of circles. So I'm going to set the variable circles to 20. Next, we're going to create a four loop that encompasses will be already have because we wanna recreate this whole loop for every circle. And if I run this right now, we'll see the same thing that we had before. The only difference is there are 20 circles on top of each other for every point. So we need to increase the radius of each circle. We can do that by multiplying by J. However, now we have one in the middle over here and this is when Jay was zero. So it's set our X and R y to zero. So we'll need to multiply by Dre plus one. Just avoid zero. So we'll start with one every time. And now we got rid of the one in the middle at 00 Now we need to reduce the radius of the first circle because we can't see the other circles. I'm going to just decrease that to 10 and let's see what happens. Perfect. Now we have 20 circles. The only problem right now is that for each circle we have the same amount of slices. So we have six circles on each circle, even though the radius is much bigger and we need more slices for it to look nicer. We can do that by increasing the number of slices every time the circle or the radius gets bigger, and that means in the outer loop I'm going to just increase the number of slices by a certain amount. I'm going to do three and let's see what happens. And now we have or concentric circles. If you notice whenever I have a odd number. We have this strange looking circle, which is still cool, and that's why I have to add in even number because I want my slices toe. Always have an even number for it. Toe look even or symmetrical like this fun, isn't it? Now, in the next model, I'm going to add color to our circle, and we can see the different ways that we can change the pattern of the color in this circle. 7. Coloring the design: a. Each person can have their own palette of colors. So I'm gonna just add my palate over here. I'm gonna copy and paste it from another fire we have. Okay, so no, I haven't array of colors that I'm going to use inside of my for loop. So over here, we're going to set the fill before the Ellipse. I'm going to set it to the name of the variable, which is calls, and I'm going to make use of the I variable. The only problem with the I variable is going to go from is that it's going to go from Z about 25 and I only have five items in my array, which means it's going from 0 to 4, which is going to give me an error. So I'm going to make sure that I don't get that error by using the model a sign and using the number off the items in my array. Now I need to convert this into an integer, and we get our colors. It's pretty fun how using the different variables from your four loops or from the algorithm that you have can change the pattern of the coloring So let's use PJ and see how this looks. This is pretty cool as well. We can also use the X variable and see what that produces. That is quite fun. We can also use the Y variable and see what we get. It looks like a butterfly. Let's also use angle and see what that produces. You see how it goes around with the circle. Now I'm gonna show you a different way of using one of the variables inside of your loop to create a different pattern of colors. Let's just remove this and create a very well called C and we'll pass it in over here. And I'm going to create an integer called C and I'm going to map the why variable from 0 to 2 pi to zero before which is the last index in the array of our colors. And I'm going to use the module a sign again and used the colors that lengths. Or we can just use five. This is going to give us an error because map produces afloat and we haven't into dresses. Just gonna cast it into an integer and let's see what this producers it produced. A completely different pattern. We can do the same thing with X and see what happens. That is also cool. And of course, the more colors you have over here is going to produce a different design. So if I replicate this one or less, if I replicate this one over here that added over here and now we have six colors, right? So I'm gonna just do so. We have a more dynamic formula. I'm going to just do cause that length minus one and more colors, I have the difference. The shape is going to be. I'm gonna go back to my first design, feel free to choose whatever pattern you like. I enjoy them all, and I like to experiment with the variables that I have and different ways. I can use those variables to create a pattern or coloring pattern for my design. Next, we'll experiment with a different shape to see how can changing just the shape of the points plotted can change the whole design 8. Exploring another shape: Let's experiment with another shape. I'm going to choose a rectangle or a square, and I'm going to rotate it to kind of create a mosaic type of designs instead of the Ellipse. I'm going to use theoretic function, and you just used the X and Y coordinates again. And I'm going to set the size two eights, as it was with the Ellipse. Now, if I run it, just get a bunch of squares instead of the ellipses that we had before. But we can make this look even cooler by rotating. The square is a little bit. We're going to retake them by 1/4 of high, just about 45 degrees. But now this is going to produce something that is pretty horrible, and it broke her design. The reason for this is because it's rotating around the zeros. You're a point. So whenever this is like whenever square as being created inside of the four loops, it's being rotated around the zeros. You're a point which is going to break everything we need to encompass the rectangle or the square and the rotate function inside the push matrix and pop matrix functions. What this is going to do is create a different matrix for these rectangles. So for each rectangle, there's going to be a different layer on which we are going to rotate our shape. But now, even if we run this, it's still going to break. So the reason this is happening is because it's rotating around again. Zeros. You're a point, but for the whole thing, we need to translate the matrix to the center of each rectangle. So I'm going to just translate to the X and y points. And then I'm going to put the rectangle add 00 instead because now we're pushing the shapes by using the translate. So I'm pushing the whole matrix or the whole layer to that accent X and Y position on. Then I'm going to set the rectangle to the zeros, your point of that matrix. Now, if I run it, I'm just gonna get a bunch of squares that are rotated 45 decrees and just going to give me this mosaic. Look. In my design, this is pretty much all you need to know about polar grits. Feel free to experiment with other shapes and other functions from the processing language and also experiment with colors and color patterns. Maybe you wanna choose more colors or different colors that are going to create a look that we can all enjoy. I encourage you to be creative with it, and I'd love to see your work. 9. Rotation explained: going through. What we created in the previous lesson once more will help you understand how rotation work in processing on a square canvas. If we have a square 0.0 and rotated by 45 degrees, we get this. And if we have a square at the first point we created on the polar grid, using the coastline and sign functions for X and Y, and after rotate that square, we get this. That's why we got our jumble squares. This happens because rotations happen on the canvas level, meaning the campus itself is being rotated and the shape still of the same position on that canvas. In the previous lesson, we followed a few steps to fix it. Instead of moving the squares to the X and Y position, we created a new matrix for every square. We pushed that whole matrix to our X and Y positions, then rotated the matrix by 45 degrees. Through this whole process, are square is still at the origin of that matrix, which is the 00 point and because of the loop, will have multiple squares around your circle that are rotated 45 degrees. Since the squares by default, drawn from the top left corner. We need to change its origin to the center So he behaves like an ellipse by using the wreck mode function with the center arguments passed in and now we have our final design. 10. Exporting the design: finally to export the design so you can use it in your other projects. You can just to import the processing, pdf library. Anyone include everything and then in here. After setting the size, I'm going to use the begin record function to record a pdf file. I'm gonna put that in a folder called Output, and then I'm going to set it times Tom, which is a function that we're gonna create right now. And then we create the function timestamp down below. What time's temp does is that it gets an instance of the calendar for today's date and time and then formats it into a string that has the year, the month and the day and then another score. And then the hour, the minutes and the seconds and the calendar class is taking from the Java utility Cal Ah Calendar library. So now it's going to use date over here. The reason why I used times time or this function is because I want to just do different renders instead of changing the file name every now. Then I can just grab the date and time, which assures me that I will have a folder filled with every generation that I had every time it was saved and then to end the recording. After everything has been drawn, I'll just you and the corn and it should save the file. Now, after you run this program, you can go to the output folder inside of your actual programs holder and you'll find your pdf file. Now you can open this file inside of Adobe Illustrator, and once it's open, you can go to clipping mask. Release the mask. He can delete the mask. Now you have the design that it could manipulate however you want. 11. Your turn!: for your assignment, you're going to create something similar to what we created in this class. It's OK to submit exactly what you made as you went through this project with me, as it love to see your progress, however, encourage you that you push yourself further and use your creativity to come up with unique designs and use other shape functions and other matrix functions to create something that is more you. You can use the techniques used from this class or my previous generative art class. It's up to you how many colors and shapes to use in one project. As long as you're using a polar grit to demonstrate what you learned from this class. I hope you enjoyed this class and I can't wait to see your projects.