프로젝트
GitHub에서 보기
AlloyTeam/curvejs
소개
HTML5 캔버스에서 곡선을 춤추게 만드는 마법의 선.
디자인 및 미디어측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 0
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalMade curve a dancer in HTML5 canvas.
中文README
Demos
- Loading
- Rope
- Siri-Wave
- Water
- Sprout
- Scale-To
- Points-To
- Rotate
- Word
- Perlin-Noise
- Simple
- Simple-ES5
- Lerp Color
- Curves
- Line
- Close
Usage
$ npm install curvejs
import curvejs from 'curvejs'
Or get it by the cdn and link curve.min.js in your HTML:
<script src="https://unpkg.com/[email protected]/dist/curve.min.js"></script>
Then start to dance:
var Stage = curvejs.Stage,
Curve = curvejs.Curve,
canvas = document.getElementById('myCanvas'),
stage = new Stage(canvas),
rd = function() {
return -2 + Math.random() * 2
}
var curve = new Curve({
color: '#00FF00',
points: [277, 327, 230, 314, 236, 326, 257, 326],
data: [rd(), rd(), rd(), rd(), rd(), rd(), rd(), rd()],
motion: function motion(points, data) {
points.forEach(function (item, index) {
points[index] += data[index]
})
}
})
stage.add(curve)
function tick(){
stage.update()
requestAnimationFrame(tick)
}
tick()
Using built-in motion
var curve = new Curve({
points: [277, 327, 230, 314, 236, 326, 257, 326],
data: {angle: 0, r:5 ,step:Math.PI / 50 },
motion: curvejs.motion.dance
})
Submit your motion
In this motion directory, there are already some built-in motion. you can submit your motion and then create a pull request to the project.
Format and specification of your motion:
/**
* move motion.
*
* @param {points}
* @param {data}
* data rule example:
* [1, 0.2, -3, 0.7, 0.5, 0.3, -1, 1]
*/
export default function (points, data) {
points.forEach(function (item, index) {
points[index] += data[index]
})
}
QQ Group
The group id is 179181560. Welcome to join the group.
License
Copyright (c) 2017-present, dntzhang & AlloyTeam
관련 프로젝트 살펴보기
불러오는 중…
