一連の座標からの距離に基づいてセルをシェーディングしてグラデーションを作成するスクリプトがあります。私がやりたいのは、現在のひし形ではなく、グラデーションを円形にすることです。ここで例を見ることができます: http://jsbin.com/uwivev/9/edit
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);
});
曲線を取得するための適切な数学関数を手に入れることができれば、それは素晴らしいことです! ありがとう!
ダレン