什么是 HTML5 画布?

2022-01-17 00:00:00 javascript html html5-canvas

我对 HTML5 画布是什么感到有些困惑.有人告诉我它是 JavaScript,但它似乎更重要?

I'm a little confused to what HTML5 canvas is. I've been told it is JavaScript, but it seems to be a much bigger deal?

  1. 它与 javascript 有何不同?

  1. What makes it different than javascript?

为什么这么神奇?

除了 JavaScript 之外,它还会做其他事情吗?

Does it do other things than JavaScript?

推荐答案

我建议你阅读这篇文章 HTML5 Canvas - 基础

I suggest you read this article HTML5 Canvas - the basics

但总之.它不会取代 javascript.

But in short. It does not replace javascript.

HTML 5 canvas 为您提供了一个简单且强大的方法来绘制图形使用JavaScript.对于每个画布元素你可以使用上下文"(想想一个绘图板中的页面),您可以在其中可以发出 JavaScript 命令来绘制任何你想要的.浏览器可以实现多个画布上下文和不同的 API 提供绘图功能.

HTML 5 canvas gives you an easy and powerful way to draw graphics using JavaScript. For each canvas element you can use a "context" (think about a page in a drawing pad), into which you can issue JavaScript commands to draw anything you want. Browsers can implement multiple canvas contexts and the different APIs provide the drawing functionality.

相关文章