Coding (Sessions 4 & 5)
November 7, 2013 § Leave a comment
Thinking & Practice Tutorials
In session four we went back and visited some of the stuff we did in the first session with the rotating line. The line moved around the composition without exiting the boundaries, and as the line was opaque it made a trail as it moved. We edited the position on the axis so that we could control the point at which the line moved around, and then the speed. Then, by using codes similar to this one:
This determined the boundaries that the line would not be able to move across. This meant as the line moved around it would stop when it reached the edge of the composition and move to the other side.
In session five we tried something new. We created a code that would enable a small shape to bounce around the composition. We then added multiple shapes however the code that restricted the shapes from leaving the canvas was left out; this was our challenge – to see if we could work out which part of the code would keep the shapes inside the composition.
The codes we used included co-ordinates for the shapes as well as the speed settings and position again for the x and y axis. By changing the float position and duplicating previous codes we could alter the shape’s path. The final composition and it’s code looked like this: