Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float mx = 0.0;
- float angulo = 0;
- void setup()
- {
- size(950, 450);
- cursor(CROSS);
- }
- void draw()
- {
- background(0);
- //---------------------
- // aca inserte su codigo
- for(int i=0; i<950; i=i+5){
- fill(255, 0, i);
- rect(i,i, 1, -mx);
- }
- for(int i=0; i<950; i=i+10){
- fill(0, 255, i);
- rect(i,i, 6, mx);
- }
- //---------------------
- // Actualiza a localizaci�n del marcador
- float dif = mouseX - mx;
- if(abs(dif) > 1.0) {
- mx = mx + dif/16.0;
- }
- // Mantiene el marcador en la pantalla
- mx = constrain(mx, 1, width-1);
- noStroke();
- // Dibuja el rect�ngulo inferior
- fill(255);
- rect(0, height-5, width, 5);
- // Dibuja el marcador de posici�n
- fill(204, 102, 0);
- rect(mx-2, height-5, 4, 5);
- }
Add Comment
Please, Sign In to add comment