Guest User

Untitled

a guest
Dec 11th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. float mx = 0.0;
  2. float angulo = 0;
  3.  
  4. void setup()
  5. {
  6. size(950, 450);
  7. cursor(CROSS);
  8. }
  9.  
  10. void draw()
  11. {
  12. background(0);
  13.  
  14. //---------------------
  15. // aca inserte su codigo
  16.  
  17. for(int i=0; i<950; i=i+5){
  18. fill(255, 0, i);
  19. rect(i,i, 1, -mx);
  20. }
  21. for(int i=0; i<950; i=i+10){
  22. fill(0, 255, i);
  23. rect(i,i, 6, mx);
  24. }
  25.  
  26.  
  27. //---------------------
  28.  
  29.  
  30. // Actualiza a localizaci�n del marcador
  31. float dif = mouseX - mx;
  32. if(abs(dif) > 1.0) {
  33. mx = mx + dif/16.0;
  34. }
  35. // Mantiene el marcador en la pantalla
  36. mx = constrain(mx, 1, width-1);
  37. noStroke();
  38. // Dibuja el rect�ngulo inferior
  39. fill(255);
  40. rect(0, height-5, width, 5);
  41. // Dibuja el marcador de posici�n
  42. fill(204, 102, 0);
  43. rect(mx-2, height-5, 4, 5);
  44. }
Add Comment
Please, Sign In to add comment