All Projects → Aaaaaaaty → Beziermaker.js

Aaaaaaaty / Beziermaker.js

Licence: apache-2.0
arbitrary order bézier-curve generator

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Beziermaker.js

Wechart
Create all the [ch]arts by cax or three.js - Cax 和 three.js 创造一切图[表]
Stars: ✭ 152 (-45.13%)
Mutual labels:  bezier, canvas
Micro Racing
🚗 🏎️ 🎮 online 3D multiplayer neural networks based racing game
Stars: ✭ 100 (-63.9%)
Mutual labels:  bezier, canvas
Curvejs
Made curve a dancer in HTML5 canvas - 魔幻线条
Stars: ✭ 1,251 (+351.62%)
Mutual labels:  bezier, canvas
Apple Pencil Safari Api Test
Canvas sketch board, force touch, real-time Bezier curve.
Stars: ✭ 189 (-31.77%)
Mutual labels:  bezier, canvas
Flutter Canvas
About using of canvas in the flutter
Stars: ✭ 259 (-6.5%)
Mutual labels:  canvas
Pancake
Lightweight, Fast, Easy-to-use HTML5 2D game framework!
Stars: ✭ 79 (-71.48%)
Mutual labels:  canvas
Spotify-Cards-API
🚀 Unofficial Spotify PromoCards API
Stars: ✭ 13 (-95.31%)
Mutual labels:  canvas
canvas-color-tracker
A utility to track objects on a canvas by unique px color
Stars: ✭ 29 (-89.53%)
Mutual labels:  canvas
Code To Image
Convert blocks of code to a highlighted jpeg base64 image.
Stars: ✭ 271 (-2.17%)
Mutual labels:  canvas
Sessions
A series of creative coding sessions
Stars: ✭ 262 (-5.42%)
Mutual labels:  canvas
Canvg
Javascript SVG parser and renderer on Canvas
Stars: ✭ 2,963 (+969.68%)
Mutual labels:  canvas
jqCandlestick
jQuery plugin for creating line, bar and candlestick charts.
Stars: ✭ 13 (-95.31%)
Mutual labels:  canvas
Zimjs
ZIM JavaScript Canvas Framework - Code Creativity! Interactive Media For All.
Stars: ✭ 259 (-6.5%)
Mutual labels:  canvas
audio-oscilloscope
Audio oscilloscope in canvas.
Stars: ✭ 28 (-89.89%)
Mutual labels:  canvas
Smartchart
一款android 图表框架,支持图表N配置,支持缩放,旋转手势。
Stars: ✭ 266 (-3.97%)
Mutual labels:  canvas
repeat-editor
editor for live coding graphics
Stars: ✭ 17 (-93.86%)
Mutual labels:  canvas
Photoeditor
A Photo Editor library with simple, easy support for image editing using paints,text,filters,emoji and Sticker like stories.
Stars: ✭ 3,105 (+1020.94%)
Mutual labels:  canvas
Dynamic effect
平时练习的一些前端动效,基于HTML5,CSS3,Canvas,Svg
Stars: ✭ 264 (-4.69%)
Mutual labels:  canvas
Isomer
Isomer is an easy-to-use graphics library for drawing isometric scenes.
Stars: ✭ 2,767 (+898.92%)
Mutual labels:  canvas
Simple Draw
A canvas you can draw on with different colors.
Stars: ✭ 256 (-7.58%)
Mutual labels:  canvas

bezierMaker.js

以中文查看

Native HTML5 canvas can only support bezier curves up to third order.

bezierMaker.js supports the formation of arbitrary order of bezier curves in theory. And provide a playground on which can add and move control points, and generate draw animation.

Features

  • [x] There can be arbitrary number of control points in playground.
  • [x] The playground can show the display of the formation of curves.
  • [x] Control points can be moved freely.
  • [x] The playground can show the tangent of the formation of bezier curves.
  • [x] The formations of the less than or equal to third order bezier curves are based on the native API.

ScreenShots

2017-12-28 17_21_52 2017-12-28 17_38_06

playground website

Usage

preparation

<script src="./bezierMaker.js"></script>

Get Started

/**
 * canvas canvas's dom object
 * bezierCtrlNodesArr control point's array
 * color curve's color
 */
var canvas = document.getElementById('canvas')
//The formations of the less than or equal to third order bezier curves are based on the native API. 
var arr0 = [{x:70,y:25},{x:24,y:51}]
var arr1 = [{x:233,y:225},{x:170,y:279},{x:240,y:51}]
var arr2 = [{x:23,y:225},{x:70,y:79},{x:40,y:51},{x:300, y:44}]
var arr3 = [{x:333,y:15},{x:70,y:79},{x:40,y:551},{x:170,y:279},{x:17,y:239}]
var arr4 = [{x:53,y:85},{x:170,y:279},{x:240,y:551},{x:70,y:79},{x:40,y:551},{x:170,y:279}]
var bezier0 = new BezierMaker(canvas, arr0, 'black')
var bezier1 = new BezierMaker(canvas, arr1, 'red')
var bezier2 = new BezierMaker(canvas, arr2, 'blue')
var bezier3 = new BezierMaker(canvas, arr3, 'yellow')
var bezier4 = new BezierMaker(canvas, arr4, 'green')
bezier0.drawBezier()
bezier1.drawBezier()
bezier2.drawBezier()
bezier3.drawBezier()
bezier4.drawBezier()

Effect

image

You can not know the exact position of the control point of the curve you want when drawing a complex higher order Bezier curve. When simulate in playground, we can get the coordinates of the control point in real time. Then we can make the coordinates into an array of objects and pass it into BezierMaker class to get the target curve.

License

Copyright (C) 2017 [email protected]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].