My photo
Sydney, Australia
portfolio | precedents | process [since 2012]

Labels

Showing posts with label Hello World. Show all posts
Showing posts with label Hello World. Show all posts

Saturday, November 22, 2014

DSDN 142 | Book: Chapter 3 & 4

Drawing Order

I have changed the size of my screen so as to force me to think about the x, y coordinates again.

The first exercise is straightforward and shows us how the order of the code dictates the position of the object as demonstrated below (figs 1 & 2):


Figure 1 rectangle over ellipse

Figure 2 rectangle under ellipse
Shape Properties

Stroke weight and smoothing (AKA anti-aliasing) are both properties that can alter the stroke appearance.

Smoothing - the upper circle in the duo below has been smoothed with the smooth function which was turned off for the lower of the two:

Smooth vs. Non-smooth
Set stroke weight - the four circles below each have different stroke weights and the smooth function is in operation only for the top three - it was turned off for the lower one.

Various stroke weights  
Set stroke attributes - the upper rectangle has bevelled corners, the line below it has squared ends, the rectangle below that has rounded corners, as do the ends of the line at the bottom.


Various stroke attributes
Also completed the tutorial about the coordinate system on Processing. This is the final example with a dash of colour.

coordinate system & shapes

Started with this:


Ended with this:


Chapter 4

Change values - if you set up a rule that defines one element (such at the point of the object on the y axis or the diameter of an ellipse) as one constant value - then you can avoid having to change the value multiple times. Below in Figure 1 the four ellipses are 100 pixels in diameter and this can be changed easily using the variable rule "int d = 100" - all you need to do is change the value of d (to 50 for example) and the changes observed in Figure 2 can be observed.

Fig. 1

Fig. 2

Processing Variables
Processing has some special variables. i.e the width and height of the window are stored in variables called width and height. These values are set by the
size() function. They can be used to draw elements relative to the size of the window, even if the size() line changes. Note changes in size of screen below (Figures 3 and 4) are handled by the 'width' and 'height' variables. 
Fig. 3

Fig. 4

For Loop

OK - here we go - this is where it gets interesting. Having read the chapter in the text I then watched the explanation by Doug Easterly on Blackboard about 'for Loops' and basically copied the code he used so I can try to get a feel for it. He has shown us how to do a for Loop (Figure 5), then a nested for Loop (Figure 6) which basically is how you make a grid in coding.

Fig. 5
Fig. 6
Doug then revealed the following image (Figure 7) through his manipulation of the code which is closer to where we need to be for the first assignment. It is a little intimidating because although I have successfully copied it from the screen, I am not really sure how he got to the final step. All to be revealed in the fullness of time I guess.

Fig. 7
Birgit's tutorials x 3

02 Draw with Code - 1: Coordinate Space in Processing



02 Draw with Code - 2: Variables


02 Draw with Code - 3: For-Loops


Example B


Friday, November 21, 2014

dsdn 142 | creative coding | chapter 3 - draw

OK - I need to go back to basic trig for this. x,y coordinates etc - I cannot even begin to remember when it was that I last thought about this stuff. My old maths teacher, Obsie, would be proud.

So First we are thinking about sizing the screen and I am continuing on with 600 x 600 pixels.

I have located the centre and drawn a point there - it's there, I promise. There's also a point, one pixel in, in each of the four corners:

© luckiestwomanalive 2014

Then I drew a line:

© luckiestwomanalive 2014
Then a line on a 45 degree angle:
© luckiestwomanalive 2014
Then an equidistant triangle:
© luckiestwomanalive 2014

...and a quadrangle.
© luckiestwomanalive 2014
Now a rectangle:
© luckiestwomanalive 2014
And an ellipse:
© luckiestwomanalive 2014
Then finally an arc (which uses the value of pi for construction).

© luckiestwomanalive 2014
© luckiestwomanalive 2014
With the arc creation, I prefer to use degree measurements,so - as per the instructions, I converted to radians with the radians() function"

© luckiestwomanalive 2014


Monday, November 17, 2014

dsdn 142 | creative coding | first foray into Processing

So I downloaded the book 'Getting Started With Coding'. I also downloaded Processing (the software) and have made my first programme - an ellipse - from page 9 of the text. Note (hopefully) correct referencing:

© luckiestwomanalive 2014
And then I did exercise two - Make Circles
© luckiestwomanalive 2014
Then I adjusted the size of the project (to 600 x 600) and put it into 'present' mode. No more Bon Iver wallpaper.
© luckiestwomanalive 2014
And then I changed the fill the colour specified in the example given to us in the studio
© luckiestwomanalive 2014
Then experimented with the colour selector - I found a nice pink and then copied the hex code into my code as opposed to using the RGB code.
© luckiestwomanalive 2014
NB Birgit reminded us to go to color.adobe.com for some awesome colour schemes. She also showed us how to change the background with the addition of some simple code:
© luckiestwomanalive 2014
Then finally the size of the ellipse:
© luckiestwomanalive 2014
...and the colour of the stroke (now white on the pink ellipse).
© luckiestwomanalive 2014
For extra fun - it is possible to vary the ellipse size relative to where the mouse moves...
© luckiestwomanalive 2014
And to halve the size of the ellipse:
© luckiestwomanalive 2014
Even to change the size of the shape to a rectangle:

© luckiestwomanalive 2014
And the stroke weight:

© luckiestwomanalive 2014

And no fill:

© luckiestwomanalive 2014