Web Programming with html5, css, and JavaScript



Download 18,68 Mb.
Pdf ko'rish
bet81/98
Sana28.10.2022
Hajmi18,68 Mb.
#857632
1   ...   77   78   79   80   81   82   83   84   ...   98
Bog'liq
Web Programming with HTML5, CSS, and JavaScript

FIGUre 12.23B 
JavaScript file for Solar Shadowing web page
function drawOneArray(y0) {
var scaleFac; // horizontal projection of sloping surface
var width; // image width
scaleFac = Math.cos(slope);
width = image.width;
// Scale vertically to represent top view of sloping panels
context.scale(1.0, scaleFac);
if (slope >= 0) {y0 
-= length * scaleFac;}
context.drawImage(image, 50, y0 / scaleFac);
context.scale(1.0, 1.0 / scaleFac);
// Apply white line to brighten sunlit higher end
context.strokeStyle = "white";
context.lineWidth = 3;
context.beginPath();
if (slope < 0) {y0 += length * scaleFac;}
context.moveTo(X0, y0);
context.lineTo(X0 + width, y0);
context.stroke();
} // end drawOneArray
616
Chapter 12
 
Canvas


positive, when 
slope
is positive, 
drawOneArray
must reduce 
y0
by the 
y
-extent of the image 
before using it to specify the image’s location.
After depositing the scaled image, 
drawOneArray
draws a white line along the upper edge 
of this scaled image to represent sunlight reflected off the upper edge of the array. This helps the 
user see the direction of slope. Because the white line needs to be on the upper edge, whereas 
y0
(a copy of 
Y0
) initially specifies the location of the lower edge, 
y0
must change. When the slope is 
positive and 
y0
is initially on the southern edge, the change made to 
y0
for the previous scaling 
operation makes 
y0
correct for this operation as well. But when the slope is negative and 
y0
is on 
the northern edge, 
y0
needs to increase by the 
y
-extent of the image.

Download 18,68 Mb.

Do'stlaringiz bilan baham:
1   ...   77   78   79   80   81   82   83   84   ...   98




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish