Dab tsi yog 2d ntsiab lus hauv html5?
Dab tsi yog 2d ntsiab lus hauv html5?

Video: Dab tsi yog 2d ntsiab lus hauv html5?

Video: Dab tsi yog 2d ntsiab lus hauv html5?
Video: Koj Hais Dab Tsi?/Suabci Kwm & Ab Meej Ham/Official MV 2023 2024, Hlis ntuj nqeg
Anonim

Cov specification no txhais cov 2D Cov ntsiab lus rau HTML daim ntaub keeb. Cov 2D Cov ntsiab lus muab cov khoom, txoj hauv kev, thiab cov khoom los kos thiab tswj cov duab ntawm a daim ntaub daim duab nto.

Ib yam li ntawd, cov ntsiab lus hauv HTML yog dab tsi?

Lub caij canvas yog qhov tseeb DOM node uas tau kos rau hauv HTML nplooj. Lub canvas ntsiab lus yog ib yam khoom uas muaj cov khoom thiab cov hau kev uas koj tuaj yeem siv los ua cov duab hauv cov khoom siv canvas. Cov ntsiab lus tuaj yeem yog 2d lossis webgl (3d).

Qhov thib ob, Kuv yuav ua li cas thiaj li tau txais cov ntsiab lus canvas? Koj ua tau tau ib a2d ntsiab lus ntawm daim ntaub nrog cov cai hauv qab no: var daim ntaub = document. getElementById(' daim ntaub '); var ctx = daim ntaub . getContext('2d'); lub console.

Hauv qhov no, canvas getContext 2d yog dab tsi?

Cov getContext () txoj kev xa rov qab ib yam khoom uas muab cov txheej txheem thiab cov khoom rau kos duab rau ntawm daim ntaub . Qhov kev siv no yuav npog cov khoom thiab cov txheej txheem ntawm cov getContext (" 2d ib ") khoom, uas tuaj yeem siv los kos cov ntawv, kab, thawv, voj voog, thiab lwm yam - ntawm lub daim ntaub.

Canvas API yog dab tsi?

Cov Canvas API muab ib txoj hauv kev rau kos duab ntawm JavaScript thiab HTML < daim ntaub > element. Ntawm lwm yam, nws tuaj yeem siv rau cov animation, game graphics, data visualization, photo manipulation, thiab real-time video processing. Cov Canvas API feem ntau tsom rau 2D duab.

Pom zoo: