Kayıtlar

Cancas Çizim Fonksiyonları

  //canvas elementini daha hızlı kontrol etmeye yarayan fonksiyonlar içerir //html dosyasında body etiketi kapatılmadan  önce eklenmesi doğru bi' karar olur //canvas etiketinin id bilgisi "c" olarak kabul edilmiştir //toplamda 8 tane const ile tutulmuş değişken içerir //6 fonksiyon barındırır fonksiyonlar const ile tutulmuştur const c = document. getElementById ( "c" ); const ctx = c . getContext ( '2d' ); const drawRect = ( x , y , w , h , color ) => {     ctx . fillStyle = color ;     ctx . fillRect ( x , y , w , h ); } const drawCircleF = ( x , y , r , color ) => { ctx . fillStyle = color ; ctx . beginPath (); ctx . arc ( x , y , r , 0 , 2 * Math. PI , false ); ctx . closePath (); ctx . fill (); } const drawCircleS = ( x , y , r , w , color ) => { ctx . strokeStyle = color ; ctx . lineWidth = w ; ctx . beginPath (); ctx . arc ( x , y , r , 0 , 2 * Math. PI ); ctx . closePath (); ctx . stroke (); } const drawText = ( ...