Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Javascript] Rysowanie kółka, canvas
Dominator
post
Post #1





Grupa: Zarejestrowani
Postów: 565
Pomógł: 15
Dołączył: 11.10.2010

Ostrzeżenie: (20%)
X----


Witam
W osobnej funkcji rysuję sobie gradient, a w jeszcze innej kółko. Gradient rysuje się bezproblemowo, lecz problem tkwi w tym, że kółko pojawia się i po chwili znika. Co zrobić?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Dominator
post
Post #2





Grupa: Zarejestrowani
Postów: 565
Pomógł: 15
Dołączył: 11.10.2010

Ostrzeżenie: (20%)
X----


  1. function randomPoint() //kolko
  2. {
  3. var ctx = context;
  4. var a = Math.floor(Math.random() * plotno.height);
  5. var b = Math.floor(Math.random() * plotno.width);
  6. ctx.beginPath();
  7. ctx.arc(a,b,15,0,2*Math.PI);
  8. ctx.stroke();
  9. ctx.fillRect(10,10,1,1);
  10. ctx.fill();
  11. }
  12.  
  13. function rysuj()
  14. {
  15. context.clearRect(0, 0, plotno.width, plotno.height);
  16. context.rect(0, 0, plotno.width, plotno.height);
  17. var grd = context.createLinearGradient(0, 0, plotno.width, plotno.height);
  18. grd.addColorStop(0, '#8ED6FF');
  19. grd.addColorStop(1, '#004CB3');
  20. context.fillStyle = grd;
  21. context.fill();
  22.  
  23. var postac = document.getElementById('postac');
  24. context.drawImage(postac,x,y,32,32);
  25. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 09:42