프로젝트
GitHub에서 보기
dntzhang/pasition
소개
적은 JavaScript 코드로 경로 전환을 구현하고 어디서나 렌더링할 수 있는 경량 Path 전환 라이브러리입니다.
디자인 및 미디어측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 0
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalPasition - Path Transition with little JS code, render to anywhere.
中文 README
DEMO
Install
npm install pasition
or get js by the cdn address:
Usage
pasition.animate({
from : fromPath,
to : toPath,
time : time,
easing : function(){ },
begin : function(shapes){ },
progress : function(shapes, percent){ },
end : function(shapes){ }
})
you can get the path from attr d of svg path element.
Supported All the svg path commands:
M/m = moveto
L/l = lineto
H/h = horizontal lineto
V/v = vertical lineto
C/c = curveto
S/s = smooth curveto
A/a = elliptical Arc
Z/z = closepath
Q/q = quadratic Belzier curve
T/t = smooth quadratic Belzier curveto
Example:
pasition.animate({
from: 'M 40 40 Q 60 80 80 40T 120 40 T 160 40 z',
to: 'M32,0C14.4,0,0,14.4,0,32s14.3,32,32,32 s32-14.3,32-32S49.7,0,32,0z',
time: 1000,
easing : function(){ },
begin:function(shapes){ },
progress : function(shapes, percent){
//render you shape to svg or canvas or webgl
},
end : function(shapes){ }
});
you can get the progressing shapes by pasition.lerp:
var shapes = pasition.lerp(pathA, pathB, 0.5)
//render shapes in canvas ,svg or anywhere you want
...
License
This content is released under the MIT License.
관련 프로젝트 살펴보기
불러오는 중…

