Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Learn programming 51: Convert float into int and animate a photo

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
172 views
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Sep 26, 2011

Fun programming with Processing, episode 51. We now continue with the program started in episode 49 where we copy() part of a photo and show this part on our screen. The idea is to animate it by moving which part of the loaded photo we show. If we randomly change the vertical position of the part we copy, we will have an interesting effect. But we encounter a little problem: copy accepts only integer values like 2, 5, 33 or 43, but random() and noise() return float values like 1.4325 or 38.4124. We solve this by converting the float value into an integer by using the int() function.


www.funprogramming.org

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (0)

Sign In or Sign Up now to post a comment!
Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more