Cov txheej txheem:

Nthuav Tawm Cov Txheej Txheem Qhia Ntawv rau Tus Tsim Qauv-Tswj Xim: 10 Kauj Ruam
Nthuav Tawm Cov Txheej Txheem Qhia Ntawv rau Tus Tsim Qauv-Tswj Xim: 10 Kauj Ruam

Video: Nthuav Tawm Cov Txheej Txheem Qhia Ntawv rau Tus Tsim Qauv-Tswj Xim: 10 Kauj Ruam

Video: Nthuav Tawm Cov Txheej Txheem Qhia Ntawv rau Tus Tsim Qauv-Tswj Xim: 10 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Hlis ntuj nqeg
Anonim
Nthuav Tawm Cov Txheej Txheem Qhia Ntawv rau Tus Tsim-Xim Tswj
Nthuav Tawm Cov Txheej Txheem Qhia Ntawv rau Tus Tsim-Xim Tswj

Hauv tshooj dhau los, peb tau tham ntau ntxiv txog yuav siv cov cai los ua qhov zoo li cas es tsis paub cov ntsiab lus hais txog xim. Hauv tshooj no, peb tab tom tshawb fawb txog qhov kev paub no tob dua.

Kauj Ruam 1: Kev Paub Yooj Yim Txog Xim

Xim, hauv qee yam, tau zoo tshaj tib neeg txoj kev xav. Ntau yam xim zoo nkauj uas peb pom los ntawm peb lub qhov muag liab qab yog suav nrog cov khoom sib xws. Tsuas yog nrog peb lub teeb xim liab, ntsuab thiab xiav, peb tuaj yeem tsim txhua xim uas tuaj yeem pom los ntawm tib neeg lub qhov muag los ntawm kev sib xyaw.

Cov ntxaij vab tshaus mobile thiab lub vijtsam computer uas koj pom tam sim no tau tsim los ntawm lub hauv paus ntsiab lus no. Liab, ntsuab thiab xiav hu ua peb lub xim qub ntawm lub teeb. Los ntawm qhov sib piv ntawm peb lub ntsiab lus, peb tuaj yeem paub tseeb qee yam xim. Txoj kev piav qhia no tseem hu ua hom RGB. Ntawm nws, liab yog R, ntsuab yog G thiab xiav yog B.

Tsuas yog hom RGB, muaj lwm hom hu ua CMYK hom. Nws feem ntau yog ua ke nrog luam ntawv. Hauv kev luam ntawv, muaj peb qho xim qub ib yam nkaus. Txawm li cas los xij, nws txawv rau peb qhov qub xim ntawm lub teeb. Lawv yog xim liab, daj thiab xiav sib cais. Ntawm nws, C yog rau cyan, M yog rau magenta, thiab Y yog rau daj. Kev xav, tsuas yog los ntawm CMY, peb tuaj yeem sib xyaw xim feem ntau. Tab sis vim yog cov txheej txheem tsim khoom ntawm cov khoom siv raw, peb tsis tuaj yeem ua kom saturation ntawm CMY ua tiav 100%. Yog tias peb sib xyaw peb xim no, peb tsis tuaj yeem tau txais cov xim dub uas yog qhov tsaus ntuj txaus. Yog li muaj ib qho ntxiv K, uas yog rau cov luam ntawv dub, raws li kev ntxiv ntawm kev luam ntawv.

Raws li rau RGB thiab CMYK, koj tsuas yog yuav tsum paub tias muaj qhov sib txawv pom tseeb hauv qhov. RGB yog ntxiv rau hom xim, uas ua rau kom ci ntsa iab los ntawm kev sib xyaw ntau xim. Thaum CMYK raug rho tawm hom xim, uas ua rau tsaus ntuj los ntawm kev sib xyaw xim ntau dua. Hauv daim duab hauv qab no, peb tuaj yeem pom qhov sib xws thiab sib txawv ntawm ob hom. Daim duab sab laug, peb tuaj yeem xav tias yog lub tsev tsaus nrog peb lub xim sib txawv ntawm lub teeb nyem qhib. Daim duab ntawm sab xis, peb tuaj yeem suav nws li daim ntawv xim dej tom qab sib tshooj nrog peb xim liab, ntsuab thiab xiav.

Yog tias koj xav paub nws cov txheeb ze txheeb ze ntawm cov xim sib txawv sib sib zog nqus, koj tuaj yeem qhib koj lub Photoshop thiab xaiv cov xim xaiv. Tom qab ntawd koj tuaj yeem pom cov xim tseem ceeb ntawm cov xim ib yam hauv cov xim sib txawv ua kom nkag siab.

Thaum kawg, peb xav qhia lwm hom xim sib xws rau koj, HSB. HSB tsis muaj lub tswvyim ntawm "Thawj Xim". Nws tau muab cais raws li kev xav ntawm tib neeg lub qhov muag rau xim. H sawv cev rau hue, S rau saturation, thiab B yog rau ci ntsa iab.

Hawj txawm sawv cev xim nyiam. Txhua qhov xim muaj qee yam xim nyiam tsuas yog nws tsis yog xim av, dawb lossis txho. Qhov hloov pauv xim nplua nuj tshaj plaws ntawm tus neeg xaiv xim yog siv los qhia qhov hue. Nws tus nqi hauv PS ntau ntawm 0 txog 360.

Saturation txhais tau tias yog xim dawb huv. Siab dawb huv coj ntau xim tiag tiag. Nws tus nqi hauv PS yog los ntawm 0 txog 100.

Kev ci ci txhais tau tias yog qhov pom kev ntawm cov xim, suav txij 0 txog 100.

Piv nrog RGB hom, peb qhov ntev ntawm HSB muaj ntau qhov kev pom zoo rau tib neeg lub qhov muag rau xim. Tsuas yog saib HSB qhov tseem ceeb nkaus xwb, koj tuaj yeem xav txog yam xim twg nws yog.

Raws li tib yam xim, tus nqi xim hauv RGB hom yog (255, 153, 71), thaum nyob hauv HSB yog (27, 72, 100).

Nws nyuaj rau txiav txim seb nws yuav zoo li cas tom qab sib xyaw peb xim qub ua ke yog tias peb tsuas yog saib RGB. Tab sis HSB txawv. Koj tsuas yog yuav tsum paub txog cov xim ntawm cov xim xws li liab yog 0, txiv kab ntxwv yog 30 thiab daj yog 60, tom qab ntawd koj yuav paub tias nws yuav yog qhov sib piv xim daj txiv kab ntxwv nrog qhov ci siab thiab me ntsis ze rau liab thaum H yog 27.

Tom ntej no, peb yuav cuam tshuam qhov peb qhov ntev ntawm ob txoj hauv kev rau x, y, x hauv qhov chaw thiab kos xim xim los ua qhov sib piv.

RGB thiab HSB tsuas yog txoj hauv kev sib txawv los piav qhia xim. Peb tuaj yeem siv qhov chaw nyob ua piv txwv. Piv txwv tias yog koj xav qhia rau lwm tus neeg txog txoj haujlwm ntawm Imperial palace, koj tuaj yeem hais nws yog nyob ntawm No. 4 ntawm Jingshan Front Street, Dongcheng Area, Beijing. Lossis koj tuaj yeem hais nws yog ntawm 15 vib nas this, 55 feeb, 39 degrees ntawm North latitude thiab 26 vib nas this, 23 feeb, 116 degrees ntawm East longitude. Cov txheej txheem piav qhia ntawm HSB zoo ib yam li yav dhau los. Yog tias koj paub thaj chaw txheeb ze, koj tuaj yeem paub qhov chaw nyob ntawm qhov chaw nyob. Thaum RGB yuav yog qhov tseeb dua, tab sis nws yog cov paub daws teeb heev.

Hom HSB muaj nyob nrog lub hom phiaj los pab peb piav qhia xim kom yooj yim dua. Txhawm rau pom qee yam xim ntawm lub vijtsam, peb kawg yuav tsum hloov nws mus rau hauv RGB hom ua ntej.

Hauv qhov saum toj no, peb qhia peb hom xim: RGB, HSB, CMYK. Hauv txoj haujlwm, koj tsuas yog yuav tsum tsom mus rau ob hom: RGB thiab HSB. Lawv muaj lawv tus kheej qhov zoo thiab lawv tus kheej daim ntawv thov tib lub sijhawm. Yog tias koj paub nws, nws yuav txaus siab rau koj qhov kev xav tau tshaj plaws.

Kauj Ruam 2: Hom Ntaub Ntawv rau Khaws Xim

Txhawm rau qhia cov xim hauv qhov kev zov me nyuam, feem ntau peb siv hom RGB ua ntej. Txawm li cas los xij, tsuas yog tswj hwm peb lub zog, peb puas tuaj yeem tso saib cov xim? Hauv computer, nws zoo li no.

Peb tau hais ua ntej ntawd hauv Kev Ua Haujlwm, tshwj tsis yog R, G, B, peb tuaj yeem xaiv tus alpha (pob tshab) rau xim. Tab sis alpha tsis yog koom nrog cov xim. Nws muaj nyob yog kom yooj yim sib xyaw nrog cov xim tom qab. Yog li ntawd, rau cov khoos phis tawj los piav qhia qee yam xim kom raug, peb yuav tsum sib txuas qhov tseem ceeb peb qhov kev hloov pauv nkaus xwb.

Hauv cov hauv qab no, peb pib qhia cov ntaub ntawv hom xim, uas yog siv rau khaws cov xim. Nws zoo ib yam li cov ntaub ntawv xa mus yav dhau los zoo li boolena, int, ntab.

Ntawm no, cia kuv ua tib zoo piav qhia qhov tseeb siv xim ua ntej. Xav txog qhov no: xav tias yog peb tsuas tuaj yeem siv cov txuj ci yav dhau los los khaws qee cov ntaub ntawv, peb yuav ua dab tsi?

Txoj Cai Piv Txwv (9-1):

[cceN_cpp ntsiab lus = "kaj ntug"] int r, g, b;

void teeb tsa () {

loj (400, 400);

r = 255;

g yog 0;.

b = 0;

}

void kos () {

keeb kwm yav dhau (0);

rectMode (CENTER);

sau (r, g, b);

rect (dav/2, qhov siab/2, 100, 100);

}

[/cceN_cpp]

Raws li rau cov xim uas muaj xim nyiam, peb yuav tsum tsim peb qhov sib txawv los khaws cov ntaub ntawv hauv peb xim raws xim liab, ntsuab thiab xiav feem. Tom qab ntawd, yog tias peb xav kom thov cov txheej txheem ntawm cov xim no, peb yuav tsum sau nws rau hauv sau lossis mob stroke.

Tab sis koj yuav pom nws nyuaj heev los ua li ntawd vim cov ntaub ntawv sib cuam tshuam. Yog tias koj muaj lub tswv yim ntim lawv rau hauv kev siv, nws yuav yooj yim dua. Yog li ntawd, xim yog tsim.

Txoj Cai Piv Txwv (9-2):

[cceN_cpp ntsiab lus = "kaj ntug"] xim myColor;

void teeb tsa () {

loj (400, 400);

myColor = xim (255, 0, 0);

}

void kos () {

keeb kwm yav dhau (0);

rectMode (CENTER);

sau (myColor);

rect (dav/2, qhov siab/2, 100, 100);

} [/cceN_cpp]

Tib yam nrog cov ntaub ntawv hom zoo li int, peb yuav tsum siv "xim myColor" thaum pib los tsim qhov sib txawv.

Hauv kev teeb tsa, peb siv "myColor = color (255, 0, 0)" los muab tus nqi sib txawv myColor. Thaum ua haujlwm xim (a, b, c) raug cai sawv cev tias cov ntaub ntawv txheej no tau tsim ib hom xim kom tuaj yeem hloov pauv myColor. Yog tias koj sau "myColor = (255, 0, 0)", qhov program yuav mus tsis raug.

Thaum kawg, peb siv sau () kom paub txog kev ua haujlwm ntawm cov xim tha xim. Muaj nuj nqi sau () thiab mob stroke () yog ob qho tib si ua kom sib tshooj. Raws li qhov ntau thiab hom kev ntsuas, nws yuav muaj qhov cuam tshuam sib txawv. Ntshuam tsuas yog ib qho sib txawv ntawm qhov sib txawv, uas sawv cev rau nws yog xim nrog cov xim greyscale nkaus xwb. Thaum nqa cov xim sib txawv, nws txhais tau tias xim ntau yuav loj dua. Koj kuj tseem tuaj yeem hloov cov xim sib txawv thiab cov lej sib txawv, hloov pauv kev ua () hauv qhov saum toj no rau hauv kev sau (myColor, 150), tom qab ntawd koj tuaj yeem tswj alpha nrog qhov ntsuas thib ob.

Kauj Ruam 3: Txoj Kev Sib Sau Ua Ke

mob stroke, keeb kwm yav dhau muaj tib txoj kev sib tshooj nrog sau.

Nyeem Channel Tus Nqi Ntawm Cov Xim

Ntxiv rau kev ua haujlwm, koj kuj tseem tuaj yeem tau txais tus nqi RGB hauv qhov sib txawv xim

Txoj Cai Piv Txwv (9-3):

[cceN_cpp ntsiab lus = "kaj ntug"] xim myColor;

void teeb tsa () {

myColor = xim (255, 125, 0);

println (liab (myColor));

println (ntsuab (myColor));

println (xiav (myColor));

}

[/cceN_cpp]

Qhov tshwm sim hauv lub console: 255, 125, 0.

Muaj nuj nqi liab (), ntsuab (), xiav () yuav rov qab los rau tus nqi liab, ntsuab thiab xiav channel hauv myColor.

Txoj Haujlwm Hexadecimal

Tsuas yog siv tus lej zauv los qhia RGB, peb tseem tuaj yeem siv hexadecimal. Decimal txhais tau tias nce 1 thaum nws ntsib 10. Thaum hexadecimal txhais tau tias nce 1 thaum nws ntsib 16. Nws cov txheeb ze txheeb ze nrog zauv yog: “0 txog 9” sib xws rau “0 rau 9 "," A rau F "sib raug rau" 10 txog 15 ".

Daim duab hauv qab no yog qhov piv txwv ntawm txoj kev hloov pauv.

Yog lawm, yog tias peb tau txais cov txheej txheem hexadecimal zoo li ff7800, peb tsis tas yuav hloov nws los ntawm phau ntawv. Qhov kev zov me nyuam yuav muab qhov tseem ceeb rau xim hloov pauv ncaj qha. Nws yooj yim heev.

Peb tuaj yeem pom ntau daim npav xim hauv online yog txhua tus txais yuav hexadecimal txoj hauv kev los tso saib xim.

Zoo li tsim zej zog dribbble, cov duab kos yuav muab txuas nrog xim palettes. Yog tias koj pom cov xim nyiam, koj tuaj yeem thov nws rau txoj haujlwm.

Txoj Cai Piv Txwv (9-4):

[cceN_cpp ntsiab lus = "kaj ntug"] xim backColor, colorA, colorB, colorC;

void teeb tsa () {

loj (400, 400);

rectMode (CENTER);

noStroke ();

backColor = #395b71;

colorA = #c4d7fb;

colorB = #f4a7b4;

colorC = #f9e5f0;

}

void kos () {

tom qab (backColor);

sau (colorA);

rect (200, 200, 90, 300);

sau (colorB);

rect (100, 200, 90, 300);

sau (colorC);

rect (300, 200, 90, 300);

} [/cceN_cpp]

Tam sim no, xim zoo dua nrog cov txiaj ntsig zoo dua li nkag siab qhov tseem ceeb.

Ntxiv "#" ua ntej tus lej hexadecimal xim, tom qab ntawd koj tuaj yeem muab tus nqi rau xim sib txawv ncaj qha.

Kauj Ruam 4: Hom HSB

Ib sab ntawm hom RGB, tom ntej no peb yuav tham txog hom HSB. Cov hauv qab no qhia txog txoj hauv kev ua haujlwm ntawm HSB hom.

Txoj Cai Piv Txwv (9-5):

[cceN_cpp ntsiab lus = "kaj ntug"] tsis muaj teeb meem teeb tsa () {

loj (400, 400);

colorMode (HSB);

}

void kos () {

keeb kwm yav dhau (0);

rectMode (CENTER);

rau (int kuv = 0; kuv <20; kuv ++) {

xim col = xim (i/20.0 * 255, 255, 255);

sau (col);

rect (kuv * 20 + 10, qhov siab/2, 10, 300);

}

} [/cceN_cpp]

Hauv Kev Ua, txhawm rau hloov hom HSB, peb tsuas yog yuav tsum ntxiv kab lus ntawm xim xim (HSB). Kev siv ntawm kev ua haujlwm colorMode () yog hloov xim xim. Yog tias peb sau "HSB" hauv kab zauv, tom qab ntawd nws yuav raug teeb tsa mus rau hom HSB; thaum peb sau "RGB", nws yuav raug hloov mus rau hom RGB.

Dab tsi yog qhov tsim nyog tau them sai sai yog thaum peb sau colorMode (HSB), qhov ua tsis tau zoo tshaj plaws ntawm HSB yog 255. Qhov no txawv heev rau tus nqi siab tshaj hauv Photoshop. Hauv Photoshop, tus nqi siab tshaj ntawm H yog 360, tus nqi siab tshaj ntawm S thiab B yog 100. Yog li peb yuav tsum tau hloov pauv.

Yog tias HSB tus nqi hauv Photoshop yog (55, 100, 100), thaum hloov pauv mus rau Kev Ua Haujlwm, tus nqi no yuav tsum yog (55 /360 × 255, 255, 255, 255), piv txwv li (40, 255, 255).

colorMode () yog txoj haujlwm uas tuaj yeem sib tshooj. Hauv qab no, peb yuav qhia nws rau koj kom ntxaws.

Kauj Ruam 5: Txoj Kev Cuam Tshuam ntawm ColorMode

Yog li, yog tias koj tsis xav hloov HSB tus nqi hauv Photoshop manually, koj tuaj yeem sau "colorMode ()" rau hauv "colorMode (HSB, 360, 100, 100)".

HSB Hom Ntawv Thov Case 1

Vim tias hom RGB tsis yooj yim los tswj kev hloov pauv ntawm cov hue, lub sijhawm no, yog tias koj xav tswj cov xim kom yooj yim dua, koj yuav xav txog hom HSB.

Txoj Cai Piv Txwv (9-6):

[cceN_cpp ntsiab lus = "kaj ntug"] tsis muaj teeb meem teeb tsa () {

loj (800, 800);

keeb kwm yav dhau (0);

colorMode (HSB);

}

void kos () {

strokeWeight (2);

mob stroke (int (millis ()/1000.0 * 10)%255, 255, 255);

ntab newX, newY;

newX = mouseX + (suab nrov (millis ()/1000.0 + 1.2) - 0.5) * 800;

newY = mouseY + (suab nrov (millis ()/1000.0) - 0.5) * 800;

kab (mouseX, mouseY, newX, newY);

} [/cceN_cpp]

Thaum peb tswj H (hues) hauv mob stroke, peb tau siv millis (). Nws yuav tau txais sijhawm ua haujlwm txij thaum pib txog rau tam sim no. Yog li, nrog rau lub sijhawm txav mus tom ntej, tus nqi H (hue) yuav nce ntxiv, tom qab ntawd hloov xim.

Chav tsev ntawm millis () yog ms. Yog li, thaum qhov kev zov me nyuam khiav rau 1 thib ob, tus nqi xa rov qab yuav yog 1000. Qhov no yuav ua rau tus nqi uas loj heev. Yog li peb yuav tsum faib nws los ntawm 1000.0.

Vim tias peb cia siab tias cov xim yuav nthuav tawm ib ntus, yog li peb yuav tsum tau ua haujlwm modulo thaum peb thaum kawg sau thawj qhov ntsuas hauv mob stroke. Qhov no tuaj yeem paub tseeb tias nws yuav pib los ntawm 0 dua thaum H (hue) tau dhau 255.

Muaj nuj nqi strokeWeight () tuaj yeem tswj cov tuab ntawm kab. Chav nyob sib haum rau cov kev ntsuas tsis pub dhau lub bracket yog pixel.

Kauj Ruam 6: Hom Ntawv Thov Case 2

Txoj Cai Piv Txwv (9-7):

[cceN_cpp ntsiab lus = "kaj ntug"] int num; // kom muaj nuj nqis ntawm cov kab tam sim no kos

ntab posX_A, posY_A; // Kev sib koom tes ntawm taw tes A.

ntab posX_B, posY_B; // Kev sib koom tes ntawm taw tes B.

ntab angleA, speedA; // Lub kaum ntawm taw tes A, nrawm

ntab kaum B, speedB; // Lub kaum sab xis ntawm taw tes B, nrawm

ntab radiusX_A, radiusY_A; // Lub vojvoog ntawm oval tsim los ntawm taw tes A hauv X (Y) qag.

ntab radiusX_B, radiusY_B; // nws lub vojvoog ntawm oval tsim los ntawm point B hauv X (Y) qag.

void teeb tsa () {

loj (800, 800);

colorMode (HSB);

keeb kwm yav dhau (0);

speedA = 0.0009;

speedB = 0.003;

radiusX_A = 300;

radiusY_A = 200;

radiusX_B = 200;

radiusY_B = 300;

}

void kos () {

txhais lus (dav/2, qhov siab/2);

rau (int kuv = 0; kuv <50; kuv ++) {

angleA += speedA;

angleB += speedB;

posX_A = cos (angleA) * radiusX_A;

posY_A = sin (angleA) * radiusY_A;

posX_B = cos (angleB) * radiusX_B;

posY_B = sin (angleB) * radiusY_B;

mob stroke (int (num/500.0) % 255, 255, 255, 10);

kab (posX_A, posY_A, posX_B, posY_B);

num ++;

}

} [/cceN_cpp]

Cov Haujlwm Ua Haujlwm:

Cov Duab Tso Tawm:

Tus qauv uas koj pom yog tsim los ntawm kab kev xav los ntawm kev sib tshooj tas mus li. Cov kab ntawm ob lub ntsiab lus kawg ntawm kab yog ob lub voj voos sib cais.

Los ntawm hom HSB, peb tau tswj hwm qhov kev hloov pauv ntawm hue. Nrog kev nce ntawm cov kab, cov zas xim yuav poob. Thaum cov kab loj ib nrab pob tshab sib tshooj, nws yuav tsim cov xim nplua nuj heev.

Peb tau teeb tsa lub voj rau hauv kev ua haujlwm nrog lub hom phiaj siv rau lub voj los tswj kom muaj nuj nqis ntawm kab. Nws yog sib npaug rau qhov peb tau tswj kev teeb duab nrawm. Ua kom muaj nuj nqis ntawm kev txiav txim rau hauv lub voj, nws yuav ua rau cov duab kos seepd.

Hauv qab no yog daim duab schematic. Koj tuaj yeem pom qhov txav txav ntawm cov voj voog kom meej dua.

Kho qhov sib txawv nrawm thiab lub vojvoog, cov qauv tsim yuav txawv ib yam nkaus. Sim hloov pauv xws li lub kaum ntse ntse, nrawm, radiusX, radiusY thiab saib yuav muaj dab tsi tshwm sim.

Kauj ruam 7: Txheej Blending Mode

Ntau hom xim uas peb tham hauv ua ntej yog txhua yam siv rau xim cov duab sib piv. Tsuas yog siv txoj hauv kev no los tswj xim, Kev ua haujlwm tuaj yeem siv ntau txheej txheej sib xyaw ua ke zoo li Photoshop.

Qhib txheej txheej hauv PS, nyem rau xaiv txheej txheej sib xyaw ua ke, tom qab ntawd peb tuaj yeem pom cov kev xaiv no.

Cov no muaj nyob txheej txheej hauv PS. Hais lus nws yooj yim, kev sib xyaw hom tuaj yeem suav tias yog hom kev suav xim. Nws yuav txiav txim siab tias yuav tsim cov xim twg thaum kawg thaum "xim A" ntxiv rau "xim B". Ntawm no "xim A" txhais tau tias xim tom qab txheej tam sim no (tseem hu ua xim xim pib). "Xim B" txhais tau tias xim ntawm txheej tam sim no (tseem hu ua xim sib xyaw). Qhov kev zov me nyuam yuav xam kom tau xim C raws li tus nqi RGB thiab alpha ntawm cov xim A thiab B. Nws yuav muab tso tawm ntawm lub vijtsam vim yog xim.

Cov txheej txheej sib txawv sawv rau cov txheej txheem sib txawv. Hauv ib nrab ntu tom ntej ntawm kab lus ntawm kab lus no, peb yuav piav qhia nws hauv cov ntsiab lus. Tam sim no peb tsuas yog yuav tsum paub nws siv ua ntej.

Cia peb saib ib qho piv txwv ntawm kev siv Ntxiv Hom hauv qhov program.

Txoj Cai Piv Txwv (9-8):

[cceN_cpp ntsiab lus = "kaj ntug"] PImage duab 1, duab 2;

void teeb tsa () {

loj (800, 400);

duab 1 = loadImage ("1.jpg");

duab 2 = loadImage ("2.jpg");

}

void kos () {

keeb kwm yav dhau (0);

blendMode (ADD);

duab (duab 1, 0, 0, 400, 400);

duab (duab 2, mouseX, mouseY, 400, 400);

}

[/cceN_cpp]

Qhov tshwm sim:

Muaj nuj nqi blendMode () yog siv los teeb tsa cov duab sib xyaw ua ke. Peb sau rau hauv ADD tom qab txhais tau tias peb tau teeb tsa Hom Ntxiv.

Hauv txoj haujlwm, tsis muaj lub tswvyim ntawm txheej. Tab sis vim tias muaj cov duab sib dhos ntawm cov duab nraaj, yog li thaum muab cov duab sib dhos, duab 1 yog suav tias yog xim xim thiab duab 2 ua xim sib xyaw.

ADD hom yog "Brighten Class". Tom qab siv nws, koj yuav tau txais cov txiaj ntsig ci ntsa iab.

Hauv qab no yog hom sib xyaw uas tuaj yeem siv hauv Kev Ua.

Kauj Ruam 8: Ua Hom Sib Ntsib

Peb tuaj yeem sim hloov hom sib xyaw sib txawv kom pom cov txiaj ntsig.

Thaum piv txwv (9-8) tau saws hom sib tshooj (keeb kwm yav dhau yuav tsum tau teeb dawb):

Tom qab siv Substract Mode (keeb kwm yav dhau yuav tsum tau teeb dawb):

Kauj Ruam 9: Txheej Txheej Txheej Hom Ntawv Thov

Hom kev sib xyaw ua ke tsis tuaj yeem siv rau cov duab nkaus xwb, tab sis kuj haum rau txhua qhov duab nraaj hauv daim duab. Hauv qab no tau nthuav tawm ib qho kev siv hais txog Ntxiv Hom. Nws tuaj yeem siv los sib piv cov teeb pom kev zoo sib xws.

Txoj Cai Piv Txwv (9-9):

[cceN_cpp ntsiab lus = "kaj ntug"] tsis muaj teeb meem teeb tsa () {

loj (400, 400);

}

void kos () {

keeb kwm yav dhau (0);

blendMode (ADD);

int num = int (3000 * mouseX/400.0);

rau (int i = 0; i <num; i ++) {

yog (random (1) <0.5) {

sau (0, 50, 0);

lwm yam {

puv (50);

}

ellipse (random (50, dav - 50), random (50, qhov siab - 50), 20, 20);

}

}

[/cceN_cpp]

Ntawm no, los ntawm kev ua haujlwm tsis raug, peb tau sib xyaw xim ntsuab thiab xim dawb, uas tau nqa alpha twb dhau los, rau hauv cov khoom me me. Peb tuaj yeem siv nas los tswj kom muaj nuj nqis ntawm lub voj voos thiab saib cov txiaj ntsig sib tshooj.

ADD thiab SCREEN zoo ib yam. Txawm hais tias nws zoo ib yam kom ci ntsa iab, muaj qhov sib txawv me ntsis. Koj tuaj yeem hloov nws mus rau SCREEN thiab sib piv. Tom qab tau muab sib dhos, qhov huv thiab ci ntawm ADD yuav siab dua. Nws yog qhov tsim nyog rau kev sib piv cov teeb pom kev zoo.

Raws li rau xim, ntawm no peb tau xaus rau tshooj no. Txog rau “hom lus” no, koj twb tau paub txaus txaus lawm. Tam sim no, maj nrawm siv cov cai kom txaus siab rau lub ntiaj teb ntawm cov duab thiab xim!

Kauj ruam 10: Qhov chaw

Kab lus no yog los ntawm:

Yog tias koj muaj lus nug, koj tuaj yeem tiv toj : [email protected].

Pom zoo: