SHARE
TWEET

Untitled

a guest Apr 25th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var book = [
  2.     {title: "The Giver",
  3.     author: "Lois Lowry",
  4.     stars: 3,
  5.     color: color(214, 255, 219)},
  6.     {title: "Alchemist",
  7.     author: "Paulo Coelho",
  8.     stars: 3,
  9.     color: color(224, 208, 208)},
  10.    {title: "Lord of the Flies",
  11.    author: "William Golding",
  12.    stars: 4,
  13.    color: color(238, 237, 242)},
  14.  
  15. ];
  16.  
  17.  
  18. // draw shelf
  19. fill(173, 117, 33);
  20. rect(0, 120, width, 10);
  21.  
  22. for( var i = 0; i < book.length; i ++)
  23. {
  24.   // draw one book
  25. //fill(214, 255, 219);
  26. fill(book[i].color);
  27. rect(10 + i * 100, 20, 90, 100);
  28. fill(0, 0, 0);
  29. text(book[i].title, 15 + i *100, 29, 70, 100);
  30. text(book[i].author, 15 + i *100, 60, 70, 100);
  31. for (var s = 0; s < book[i].stars; s++) {
  32. image(getImage("cute/Star"), 11 +s*20 + i* 100, 90, 20, 30);
  33. }  
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top