edankwan/PerspectiveTransform.js
소개
A Javascript Class to do the CSS 3D transformation by 4 destination points
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalPerspectiveTransform
This is an extremely useful class for advanced CSS 3d animation. You can set the x, y point of the corners of a DOM element and do need to think about the complicated Matrix formula behind it.
Usage
// create PerspectiveTransfrom
var transform = new PerspectiveTransform(elem, width, height, useBackFacing);
// the properties represent the 4 corners are "topLeft", "topRight", "bottomLeft" and "bottomRight"
transform.bottomRight.x = 200;
transform.bottomRight.y = 200;
// check the polygon error before updating
if(transform.checkError()==0){
transform.update(); // update the perspective transform
elem.style.display = "block"; // show the element
}else{
elem.style.display = "none"; // hide the element
}
Firefox on retina screen fix
PerspectiveTransform.useDPRFix = true; // put true if you need to apply this fix
window.onresize = function(){
PerspectiveTransform.dpr = window.devicePixelRatio; // update the dpr
transform.update(); // update the PerspectiveTransform instance
}
Credit
The original PerspectiveTransform.js is created by Israel Pastrana http://www.is-real.net/experiments/css3/wonder-webkit/js/real/display/PerspectiveTransform.js
Matrix Libraries from a Java port of JAMA: A Java Matrix Package, http://math.nist.gov/javanumerics/jama/ Developed by Dr Peter Coxhead: http://www.cs.bham.ac.uk/~pxc/ Available here: http://www.cs.bham.ac.uk/~pxc/js/
I simply removed some irrelevant variables and functions and merge everything into a smaller function. I also added some error checking functions and bug fixing things.
관련 프로젝트 살펴보기
불러오는 중…
