Assignment #5

I’m keeping working on my existing random painting. Today I tried to add something related to image into it.

I adopted the idea similar to pointillism. I want create random moving shapes whose color is that of the image at their positions. The first part of code I need to add is the preload function that loads the image.

Then in the Ball() function that controls the ball. I need to change the parameter of the fill() function that set the color of the shape. Thus I added a variable c = img.get() to get the color of the image at the certain position. And then change the fill() function.

Next I needed to change the size of the canvas to accommodate the whole image. Fortunately I have already modulated the width and height of the canvas so I only need to change it to image.width and image.height.

So I can create pictures like this:

屏幕快照 2016-01-13 上午10.45.48

屏幕快照 2016-01-13 上午10.47.11

Leave a Reply

Your email address will not be published. Required fields are marked *