좌표 세트로부터의 거리를 기준으로 셀을 음영 처리하여 그라디언트를 만드는 스크립트가 있습니다. 내가하고 싶은 것은 그것이 현재있는 다이아몬드 모양보다는 그라디언트를 원형으로 만드는 것입니다. 당신은 여기 엔 예를 볼 수있는 권리 수학이 난 후 곡선을 얻을 기능 당신이 날 도와 줄 수 있다면 http://jsbin.com/uwivev/9/editJavaScript에서 각도가 아닌 곡선 결과 얻기
var row = 5, col = 5, total_rows = 20, total_cols = 20;
$('table td').each(function(index, item) {
// Current row and column
var current_row = $(item).parent().index(),
current_col = $(item).index();
// Percentage based on location, always using positive numbers
var percentage_row = Math.abs(current_row-row)/total_rows;
var percentage_col = Math.abs(current_col-col)/total_cols;
// I'm thinking this is what I need to change to achieve the curve I'm after
var percentage = (percentage_col+percentage_row)/2;
$(this).find('div').fadeTo(0,percentage*3);
});
것은 그 좋은 것입니다! 감사!
대런
당신은 거리 식의 제곱 사용할 수 있습니다
왜 이렇게 하시겠습니까? 왜 캔버스를 사용하지 않습니까? – elclanrs