具有动态用户输入的HTML5画布 [英] HTML5 canvas with dynamic user input

查看:93
本文介绍了具有动态用户输入的HTML5画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将首先承认自己从未使用过画布,所以我不知道这是否可行,但我似乎找不到解决方法。

I will start off by admitting I have never used canvas before so I don't know if this is possible but I can't seem to find the solution.

我正在尝试创建一个画布,该画布根据用户最有可能以HTML / PHP形式输入的多边形的边数和大小,在画布上绘制一个简单的常规多边形形状(所有边都相等)。实际上没有任何内容保存到服务器或数据库,仅用于一个图形。

I am trying to create a canvas that draws a simple regular polygon shape (all sides are equal) in canvas based on the number of sides and size of the polygon that the user inputs most likely in HTML/PHP form. Nothing is actually saved to a server or database, just used for the one drawing.

有人有什么建议吗?

推荐答案

您应该使用JavaScript库使它更容易在画布上绘制。

You should use a JavaScript library to make it easier to draw on the canvas.

以下是您正在寻找的功能的非常不错的演示:

Here's a really good demo of the functionality that you're looking for:

http://fabricjs.com/

该库为Fabric.js,您可以在此处下载: http://fabricjs.com/

And the the library is Fabric.js, which you can download here: http://fabricjs.com/

这篇关于具有动态用户输入的HTML5画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆