Playing with code

Learning code is really useful. Lots of employers are looking for people who can code their own websites and so learning basic skills is a very important thing. With this in mind, I have been asked to create some designs using an app called Processing. The Processing software is used by thousands of visual designers, artists, and architects to create their works.

Projects created with Processing have been featured at the Museum of Modern Art in New York, the Victoria and Albert Museum in London, the Centre Georges Pompidou in Paris, and many other prominent venues. Processing is used to create projected stage designs for dance and music performances; to generate images for music videos and film; to export images for posters, magazines, and books; and to create interactive installations in galleries, in museums, and on the street.

Some prominent projects include the House of Cards video for Radiohead, the MIT Media Lab’s generative logo, and the Chronograph projected software mural for the Frank Gehry-designed New World Center in Miami. But the most important thing about Processing and culture is not high-profile results – it’s how the software has engaged a new generation of visual artists to consider programming as an essential part of their creative practice.

void setup() {
  size(1920, 1080);
}

void draw() {
  if (mousePressed) {
    fill(0);
  } else {
    fill(255);
  }
  ellipse(mouseX, mouseY, 80, 80);
}

This program creates a window that is 1920 pixels wide and 1080 pixels high, and then starts drawing white circles at the position of the mouse. When a mouse button is pressed, the circle color changes to black.

Interactive programs are drawn as a series of frames, which you can create by adding functions titled setup() and draw() as shown in the code below. The setup() block runs once, and the draw() block runs repeatedly. Because the background() function is used only once, the screen will fill with lines as the mouse is moved.

void setup() {
 size(1920, 1080);
 stroke(255);
 background(192, 64, 0);
 }

void draw() {
 line(150, 25, mouseX, mouseY);
 }

The Processing variables mouseX and mouseY (note the capital X and Y) store the x-coordinate and y-coordinate of the cursor relative to the origin in the upper-left corner of the display window. When a program starts, the mouseX and mouseY values are 0. If the cursor moves into the display window, the values are set to the current position of the cursor. The mouse position is most commonly used to control the location of visual elements on screen.

void setup() {
 size(1920, 1080);
}

void draw() {
 background(204);
 if (mousePressed == true) {
 cursor(HAND); // Draw cursor as hand
 } else {
 cursor(CROSS);
 }
 line(mouseX, 0, mouseX, height);
 line(0, mouseY, width, mouseY);
}

The pmouseX and pmouseY variables store the cursor coordinates from the previous frame, but there is no built-in way to access the cursor values from earlier frames. At every frame, the mouseX, mouseY, pmouseX, and pmouseY variables are replaced with new numbers and their previous numbers are discarded. Creating an array is the easiest way to store the history of these values.

int num = 50;
int[] x = new int[num];
int[] y = new int[num];

void setup() { 
 size(1920, 1080);
 noStroke();
 fill(255, 102);
}

void draw() {
 background(0);
 // Shift the values to the right
 for (int i = num-1; i > 0; i--) {
 x[i] = x[i-1];
 y[i] = y[i-1];
 }
 
 x[0] = mouseX;
 y[0] = mouseY;
 // Draw the circles
 for (int i = 0; i < num; i++) {
 ellipse(x[i], y[i], i/2.0, i/2.0);
 }
}


		
Follow:
Share:

132 Comments

  1. 27/09/2018 / 4:39 pm

    My family every time say that I am wasting my time here at web,
    except I know I am getting knowledge daily by reading thes pleasant articles or reviews.

  2. 02/10/2018 / 1:53 pm

    I studied in a few faculties for performing.

  3. 04/10/2018 / 4:46 am

    I simply couldn’t go away your site prior to suggesting that
    I actually enjoyed the usual info a person supply on your
    guests? Is going to be again continuously in order to investigate cross-check new
    posts

  4. 04/10/2018 / 1:08 pm

    Very nice blog post. I absolutely love this site. Continue
    the good work!

  5. 04/10/2018 / 7:00 pm

    I have read so many posts concerning the blogger lovers however this paragraph is
    truly a pleasant article, keep it up.

  6. 05/10/2018 / 1:41 am

    What’s Going down i am new to this, I stumbled upon this I’ve discovered It absolutely useful and it has helped me out loads.
    I hope to give a contribution & assist other customers like its helped
    me. Good job.

  7. 05/10/2018 / 3:43 pm

    Hmm is anyone else encountering problems with the images on this blog loading?
    I’m trying to figure out if its a problem on my end or if it’s the blog.

    Any suggestions would be greatly appreciated.

  8. 06/10/2018 / 4:07 pm

    I believe everything published was actually very reasonable.
    But, what about this? suppose you were to create a
    awesome post title? I am not saying your information is not
    good., but what if you added something that makes people
    desire more? I mean Playing with code –
    tea and a pencil is a little plain. You could look at Yahoo’s front page and
    note how they create post headlines to grab viewers to click.
    You might try adding a video or a related picture or two to
    grab readers interested about what you’ve got to say.
    Just my opinion, it would bring your posts
    a little livelier.

  9. 07/10/2018 / 6:49 am

    What’s up, the whole thing is going sound here and ofcourse every one is sharing data, that’s in fact excellent, keep up writing.

  10. 07/10/2018 / 6:38 pm

    I would like to thank you for the efforts you have put in penning this website.
    I really hope to see the same high-grade content from you later on as well.

    In fact, your creative writing abilities has encouraged me to get my own, personal website now
    😉

  11. 07/10/2018 / 10:42 pm

    If some one wants to be updated with most up-to-date
    technologies therefore he must be go to see this web page and be up to date every day.

  12. 08/10/2018 / 2:50 am

    I like the helpful information you provide in your articles.
    I will bookmark your blog and check again here regularly. I
    am quite sure I’ll learn plenty of new stuff right here!

    Good luck for the next!

  13. 09/10/2018 / 3:50 am

    Thank you for some other informative web site. The place else may just I get that
    kind of information written in such a perfect approach?
    I have a undertaking that I am just now operating on, and I’ve been at
    the glance out for such information.

  14. 09/10/2018 / 3:36 pm

    Your way of telling everything in this article is really good, all be capable of without difficulty understand it, Thanks a lot.

  15. 09/10/2018 / 5:47 pm

    That is really fascinating, You’re a very skilled blogger.
    I’ve joined your rss feed and look forward to looking for more of your fantastic post.
    Also, I’ve shared your site in my social networks

  16. 09/10/2018 / 9:36 pm

    6. New York Academy for Performing and Film.

  17. 10/10/2018 / 8:11 am

    Wonderful items from you, man. I have take into accout your stuff prior to and you
    are simply too fantastic. I actually like what you have acquired
    right here, certainly like what you are saying and the way
    through which you say it. You’re making it entertaining and you
    continue to care for to keep it sensible. I can’t wait to
    learn much more from you. That is really a great website.

  18. 10/10/2018 / 8:16 am

    Undeniably consider that which you stated. Your favourite justification appeared to be on the net the easiest thing to understand
    of. I say to you, I definitely get annoyed at the same time as other people consider worries that they
    just do not recognize about. You controlled to hit the nail upon the top and also defined out the whole thing without having
    side-effects , other folks can take a signal.

    Will likely be again to get more. Thank you

  19. 10/10/2018 / 9:28 am

    Excellent site you have got here.. It’s hard to find high quality writing like yours nowadays.
    I seriously appreciate people like you! Take care!!

  20. 10/10/2018 / 9:44 am

    I love what you guys are usually up too. Such clever work and
    reporting! Keep up the good works guys I’ve added you guys to my blogroll.

  21. 19/10/2018 / 9:38 pm

    I read this article fully concerning the resemblance of most up-to-date
    and earlier technologies, it’s awesome article.

  22. 21/10/2018 / 5:15 pm

    My brother recommended I might like this web site. He was entirely right.
    This post truly made my day. You can not imagine just how
    much time I had spent for this information! Thanks!

  23. 22/10/2018 / 10:26 pm

    If you wish for to take a great deal from this piece of writing then you have to apply
    such strategies to your won webpage.

  24. 24/10/2018 / 1:27 pm

    Hi! Would you mind if I share your blog with my zynga group?
    There’s a lot of people that I think would really appreciate your content.
    Please let me know. Thank you

  25. 25/10/2018 / 4:28 am

    You really make it seem so easy with your presentation however I in finding this topic to be really something
    that I believe I would by no means understand.
    It seems too complex and very vast for me. I’m taking a look
    ahead in your next publish, I’ll attempt to get the dangle
    of it!

  26. 25/10/2018 / 8:47 pm

    I like the helpful information you provide in your articles.
    I will bookmark your blog and check again here frequently.
    I’m quite sure I will learn lots of new stuff right here!
    Good luck for the next!

  27. 27/10/2018 / 3:56 pm

    At this moment I am ready to do my breakfast, later than having my breakfast coming over again to read
    more news.

  28. 02/11/2018 / 10:15 pm

    It is the best time to make some plans for the long run and it is time to
    be happy. I have learn this post and if I may I desire
    to suggest you few fascinating things or advice. Perhaps you could write next articles referring to
    this article. I wish to read even more things about it!

  29. 03/11/2018 / 5:33 pm

    Fantastic site. Lots of useful info here.
    I am sending it to a few pals ans additionally sharing in delicious.
    And obviously, thank you on your effort!

  30. 03/11/2018 / 5:40 pm

    Hello very cool web site!! Man .. Beautiful .. Wonderful ..
    I will bookmark your blog and take the feeds also? I am satisfied to search out numerous helpful info right here in the submit,
    we need develop extra strategies in this regard, thanks for sharing.
    . . . . .

  31. 05/11/2018 / 1:10 am

    Quest bars cheap fitnesstipsnew1 quest bars cheap 516999410492780544
    quest bars cheap
    Good day! Do you use Twitter? I’d like to follow you if that would be okay.
    I’m definitely enjoying your blog and look forward
    to new posts. Quest bars cheap fitnesstipsnew1 quest bars cheap 516999410492780544 quest bars cheap

  32. 06/11/2018 / 4:43 pm

    You need to be a part of a contest for one of the highest quality blogs
    online. I’m going to recommend this blog!

  33. 09/11/2018 / 12:33 pm

    It is perfect time to make some plans for the future and it’s time to
    be happy. I’ve read this post and if I could I want to suggest you some interesting things or advice.
    Maybe you could write next articles referring to this article.
    I want to read more things about it!

  34. What’s up, this weekend is pleasant in favor
    of me, as this moment i am reading this wonderful informative
    piece of writing here at my home.

  35. 10/11/2018 / 10:17 pm

    Post writing is also a fun, if you know then you can write if not it is complicated to write.

  36. 11/11/2018 / 7:19 pm

    My coder is trying to convince me to move to .net from PHP.

    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using Movable-type on numerous websites for
    about a year and am concerned about switching to
    another platform. I have heard excellent things about
    blogengine.net. Is there a way I can import all my wordpress content into it?
    Any kind of help would be greatly appreciated!

  37. 12/11/2018 / 5:01 am

    I am sure this post has touched all the internet people, its
    really really nice piece of writing on building up new blog.

  38. Hello, i think that i saw you visited my blog so i came to “return the favor”.I’m attempting to find things to improve my website!I suppose its ok to
    use some of your ideas!!

  39. 15/11/2018 / 8:15 pm

    Wow that was odd. I just wrote an really long
    comment but after I clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyways, just wanted to say superb blog!

  40. My brother suggested I would possibly like this web site. He used to be entirely
    right. This publish actually made my day. You cann’t consider simply how
    a lot time I had spent for this information! Thank you!

  41. Heya! I’m at work browsing your blog from my new iphone 3gs!

    Just wanted to say I love reading through your blog and look
    forward to all your posts! Keep up the great work!

  42. 20/11/2018 / 11:50 am

    Excellent blog here! Also your web site loads
    up very fast! What host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as quickly as yours lol

  43. I don’t even know the way I ended up here, but I assumed this publish was great.
    I do not recognise who you’re however definitely you
    are going to a well-known blogger when you are not already.
    Cheers!

  44. 21/11/2018 / 2:09 pm

    Howdy! This post could not be written any better! Reading this post reminds me of my old
    room mate! He always kept talking about this.
    I will forward this page to him. Fairly certain he will have
    a good read. Thanks for sharing!

  45. 22/11/2018 / 6:12 pm

    An interesting discussion is worth comment. I do believe that you should publish
    more about this subject matter, it may not be a taboo subject
    but typically people don’t speak about such subjects.
    To the next! Kind regards!!

  46. 24/11/2018 / 1:10 am

    Investments in most securities contain risks.

  47. 01/12/2018 / 1:58 am

    Heya i am for the first time here. I found
    this board and I find It really useful & it helped me out much.
    I hope to give something back and aid others like you helped me.

  48. 01/12/2018 / 1:52 pm

    Certified Monetary Planner Board of Standards
    Inc.

  49. 02/12/2018 / 4:43 pm

    Hi, just wanted to tell you, I loved this blog post. It was helpful.

    Keep on posting!

  50. 02/12/2018 / 11:47 pm

    Just desire to say your article is as astonishing.
    The clearness to your put up is simply nice and
    that i can suppose you are an expert on this subject.
    Well along with your permission let me to snatch your RSS feed
    to keep updated with forthcoming post. Thanks a million and please keep up
    the rewarding work.

  51. Dany
    04/12/2018 / 3:18 am

    Heya! I’m at work browsing your blog from my new iphone 3gs!

    Just wanted to say I love reading through your blog and look
    forward to all your posts! Keep up the great work! fun games for girls dress up

  52. 05/12/2018 / 1:54 pm

    Somebody necessarily help to make seriously posts I might
    state. This is the first time I frequented your web page and
    to this point? I surprised with the research you made to create
    this particular submit incredible. Wonderful process!

  53. 06/12/2018 / 1:09 pm

    Hi, I do think this is an excellent website.
    I stumbledupon it 😉 I may come back once again since I book marked it.
    Money and freedom is the greatest way to change, may you
    be rich and continue to guide others.

  54. 16/12/2018 / 1:40 pm

    Right now it sounds like Drupal is the top blogging platform out there right now.
    (from what I’ve read) Is that what you’re using on your blog?

  55. 16/12/2018 / 3:41 pm

    Every weekend i used to visit this site, because i want enjoyment, since this this web site conations genuinely pleasant funny stuff too.

  56. 16/12/2018 / 6:00 pm

    I know this web site offers quality based posts and other data,
    is there any other website which gives such things in quality?

  57. 17/12/2018 / 3:03 am

    I delight in, lead to I discovered exactly what I used to be
    having a look for. You have ended my 4 day lengthy hunt!

    God Bless you man. Have a great day. Bye

  58. 17/12/2018 / 4:39 am

    This is very interesting, You are a very skilled blogger.
    I’ve joined your feed and look forward to seeking more
    of your magnificent post. Also, I’ve shared your website in my
    social networks!

  59. 17/12/2018 / 6:21 am

    Excellent beat ! I would like to apprentice even as you amend your website, how can i subscribe
    for a blog website? The account helped me a acceptable deal.
    I were a little bit acquainted of this your broadcast
    provided bright clear idea

  60. 17/12/2018 / 6:54 am

    Thanks very interesting blog!

  61. 17/12/2018 / 10:16 am

    I used to be able to find good advice from your blog articles.

  62. 17/12/2018 / 4:29 pm

    I’m amazed, I have to admit. Seldom do I come across a blog that’s equally educative and entertaining,
    and let me tell you, you have hit the nail on the
    head. The issue is something too few men and women are speaking intelligently about.
    I’m very happy that I found this in my search for something regarding this.

  63. 17/12/2018 / 8:35 pm

    Whoa! This blog looks just like my old one!

    It’s on a totally different subject but it has pretty much the same
    layout and design. Great choice of colors!

  64. 21/12/2018 / 3:44 pm

    Hi there, just became alert to your blog through Google, and found that it is really informative.
    I am going to watch out for brussels. I will appreciate if you continue this in future.

    Many people will be benefited from your writing. Cheers!

  65. 21/12/2018 / 4:21 pm

    Hello I am so delighted I found your site, I really found you by error, while I was searching on Askjeeve for something else, Anyhow I am here now and would just like to say thank you for
    a marvelous post and a all round exciting blog (I
    also love the theme/design), I don’t have time to browse it all at the minute but
    I have saved it and also included your RSS feeds, so when I have time I will be
    back to read more, Please do keep up the superb work.

  66. 21/12/2018 / 5:21 pm

    Hello my friend! I want to say that this article is amazing, great written and come with almost all vital infos.

    I would like to peer more posts like this .

  67. 22/12/2018 / 4:28 am

    The suitable recommendation can save you money and time.

  68. 22/12/2018 / 9:43 pm

    The precise advice can save you money and time.

  69. 23/12/2018 / 3:37 am

    The suitable recommendation can prevent time and money.

  70. 23/12/2018 / 4:23 am

    The appropriate recommendation can save you money and time.

  71. 23/12/2018 / 10:52 am

    hello!,I like your writing so so much! percentage we keep
    in touch extra about your article on AOL? I need an expert in this
    space to solve my problem. May be that’s you!
    Having a look ahead to look you.

  72. 23/12/2018 / 11:21 pm

    WOW just what I was searching for. Came here by searching for brazil flag

  73. 24/12/2018 / 4:29 pm

    Hi it’s me, I am also visiting this website regularly, this site is actually good and the visitors are in fact sharing
    good thoughts.

  74. 24/12/2018 / 5:14 pm

    Article writing is also a fun, if you be familiar with then you can write
    or else it is complex to write.

  75. 24/12/2018 / 9:30 pm

    The correct recommendation can save you time and money.

  76. 25/12/2018 / 12:31 am

    Hey there! Would you mind if I share your blog with my myspace group?
    There’s a lot of people that I think would really appreciate your content.
    Please let me know. Thanks

  77. 25/12/2018 / 1:36 am

    The right advice can save you money and time.

  78. 25/12/2018 / 4:05 am

    The precise advice can save you time and money.

  79. 25/12/2018 / 4:23 am

    The suitable recommendation can prevent time and money.

  80. 25/12/2018 / 8:44 am

    Fantastic site you have here but I was wanting to know if you knew of
    any user discussion forums that cover the same topics talked about in this article?

    I’d really like to be a part of online community where I
    can get suggestions from other experienced people that
    share the same interest. If you have any suggestions, please let me know.
    Many thanks!

  81. 25/12/2018 / 9:09 am

    The best recommendation can prevent money and time.

  82. 25/12/2018 / 3:58 pm

    After I originally commented I appear to have clicked on the -Notify
    me when new comments are added- checkbox and from now on every
    time a comment is added I get 4 emails with the same comment.
    Is there an easy method you can remove me from that service?
    Thanks a lot!

  83. 26/12/2018 / 12:31 am

    It’s going to be finish of mine day, however before end I am reading this
    wonderful article to improve my knowledge.

  84. 26/12/2018 / 2:45 am

    The best recommendation can save you money
    and time.

  85. 28/12/2018 / 6:31 am

    Hi, this weekend is fastidious for me, for the reason that this occasion i am reading
    this impressive educational article here at my house.

  86. 29/12/2018 / 7:35 am

    Hi. I have checked your teaandapencil.com and i see you’ve got some
    duplicate content so probably it is the reason that
    you don’t rank high in google. But you can fix this issue fast.

    There is a tool that creates articles like human, just search in google: miftolo’s tools

  87. 02/01/2019 / 12:46 am

    My partner and I stumbled over here from a different website and thought I should
    check things out. I like what I see so i am just following
    you. Look forward to going over your web page repeatedly.

  88. 02/01/2019 / 7:43 am

    Hi mates, its enormous piece of writing on the topic of cultureand entirely defined, keep it up all the time.

  89. 02/01/2019 / 1:41 pm

    I every time emailed this weblog post page to all my friends, for the reason that if like to read it then my links will too.

  90. 04/01/2019 / 2:44 am

    You can certainly see your expertise within the article you write.
    The world hopes for more passionate writers like you who aren’t afraid to mention how they believe.
    Always follow your heart.

  91. 04/01/2019 / 9:41 am

    Hurrah! At last I got a webpage from where I know how to
    really get helpful facts concerning my study and knowledge.

  92. 05/01/2019 / 2:57 am

    It’s awesome in support of me to have a site, which is valuable designed for my know-how.

    thanks admin

  93. 05/01/2019 / 8:06 pm

    Thanks for sharing your thoughts. I really appreciate your efforts and I
    will be waiting for your further post thanks once again.

  94. 07/01/2019 / 3:34 am

    I read this post completely on the topic of the resemblance of most recent and previous technologies, it’s awesome article.

  95. 07/01/2019 / 10:39 pm

    I know this website gives quality based articles and other stuff,
    is there any other website which provides such data in quality?

  96. 10/01/2019 / 9:40 am

    Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your blog?

    My blog is in the exact same area of interest as yours and my users would really
    benefit from some of the information you provide here. Please let me know if this alright with you.
    Appreciate it!

  97. 13/01/2019 / 6:34 am

    Attractive component of content. I just stumbled upon your weblog and in accession capital to assert that I
    get actually loved account your weblog posts.
    Anyway I will be subscribing to your augment or
    even I success you access constantly fast.

  98. 15/01/2019 / 5:39 pm

    whoah this weblog is magnificent i really like reading your posts.

    Stay up the good work! You understand, lots of individuals
    are looking around for this info, you could aid them greatly.

  99. 15/01/2019 / 7:56 pm

    I am really impressed with your writing skills and also with the layout on your blog.
    Is this a paid theme or did you customize it yourself? Anyway keep up
    the nice quality writing, it’s rare to see a nice blog like this one nowadays.

  100. 15/01/2019 / 8:38 pm

    You’re so awesome! I do not suppose I’ve read anything like that before.
    So wonderful to find someone with genuine thoughts on this topic.
    Really.. many thanks for starting this up. This website is something
    that is required on the internet, someone with
    some originality!

  101. 15/01/2019 / 10:27 pm

    Actually when someone doesn’t be aware of then its up
    to other visitors that they will assist, so here it takes place.

  102. 15/01/2019 / 11:01 pm

    Hello! Someone in my Facebook group shared this website with us so I
    came to give it a look. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers!
    Great blog and excellent style and design.

Leave a Reply

Your email address will not be published.