here is the page joining methods and level
let me details you proper, let a person name A joined directly without any referral and buy a membership then A person share referral link to person B, B person joined on behalf of the person A, A person get reward to directly joined B person, person A level is A then the person B share his referral link to the person C, on joining C person buy membership. Person A get reward of 2 level and Person B get reward of level 1 then person C share referral link to person D then person A's level will be 3 and person B level 2 person C level 1 then person – D share referral to person E then A level will be 4 and person B level 3, person C 2 , person D 1 etc so On and if the level of A will be 6 didn't get any reward of the recently upper level join person mean 5th person to the tree and other person except A will get reward according –I can only achieve every last 5 level person records on new person joining using recursively call the function name check_level()
[enter image description here][1]
[enter image description here][2]
[enter image description here][3]
[enter image description here][4]
[1]: https://i.stack.imgur.com/5oLOI.png
[2]: https://i.stack.imgur.com/xuvkc.png
[3]: https://i.stack.imgur.com/IyCSk.png
[4]: https://i.stack.imgur.com/N5ZUs.png
//here is the code
function check_level($user, $level, $subscribed_package = null) //recusive calling function
{
$level = $level;
$check_directs = 0;
$check_points = 0;
$user = $user;
$user_reward = null;
$subscribed_package = $subscribed_package; // new purchased package
$newReferrar = new Referral(); // inserting referal record to reward
// $package = Subscription::where('user_id', $user->id)->where('payment', 'paid')->latest()->first(); // checking user packages
// $package_level = Package::findOrFail($package->package_id);// max package level
$directReward = User::where('my_referral', $user->refer_by)->first(); // who refer directly
if (!blank($directReward)) {
$user_package = Subscription::where('user_id', $directReward->id)->where('payment', 'paid')->latest()->first(); // check referer package level
$user_package = Package::findOrFail($user_package->package_id); // max package level
if ($level <= ($user_package->level )) { //comparing level
$newReferrar->user_id = $directReward->id; // put refer id
$newReferrar->user_refer_by = $directReward->refer_by; // who referrer to refer direct
$newReferrar->level_user_id = $user->my_referral; //
$newReferrar->level_no = $level;
$newReferrar->points = 8;
if ($level == 1) {
$newReferrar->direct = 1;
}
if ($level == 1) {
$newReferrar->reward = (40 * $subscribed_package->bv);
} elseif ($level == 2) {
$newReferrar->reward = (10 * $subscribed_package->bv);
} else {
$newReferrar->reward = (5 * $subscribed_package->bv);
}
// return $newReferrar;
$newReferrar->save();
$level = $level + 1;
$refer_by = $newReferrar->user_refer_by; // next level id finder
$check_directs = Referral::where('user_id', $newReferrar->user_id)->sum('direct'); // direct team sum
$check_points = Referral::where('user_id', $newReferrar->user_id)->sum('points'); // team points sum
$user_reward = new UserReward();
if (($check_directs >= 8 && $check_directs < 16) && ($check_points>= 320 && $check_points < 800)) { $check_bronze_user=UserReward::where('user_id', $newReferrar->user_id)->where('rank', 'Bronze')->first();
if (blank($check_bronze_user)) {
$user_reward->user_id = $newReferrar->user_id;
$user_reward->referral_id = $newReferrar->id;
$user_reward->rewards = 2000;
$user_reward->rank = 'Bronze';
$user_reward->direct = $check_directs;
$user_reward->points = $check_points;
$user_reward->save();
}
} elseif (($check_directs >= 16 && $check_directs < 30) && ($check_points>= 800 && $check_points < 2000)) { $check_silver_user=UserReward::where('user_id', $newReferrar->user_id)->where('rank', 'Silver')->first();
if (blank($check_silver_user)) {
$user_reward->user_id = $newReferrar->user_id;
$user_reward->referral_id = $newReferrar->id;
$user_reward->rewards = 5000;
$user_reward->rank = 'Silver';
$user_reward->direct = $check_directs;
$user_reward->points = $check_points;
$user_reward->save();
}
} elseif ($check_directs >= 30 && ($check_points >= 2000 && $check_points < 7200)) { $check_gold_user=UserReward::where('user_id', $newReferrar->user_id)->where('rank', 'Gold')->first();
if (blank($check_gold_user)) {
$user_reward->user_id = $newReferrar->user_id;
$user_reward->referral_id = $newReferrar->id;
$user_reward->rewards = 15000;
$user_reward->rank = 'Gold';
$user_reward->direct = $check_directs;
$user_reward->points = $check_points;
$user_reward->save();
}
} elseif ($check_points >= 7200 && $check_points < 21600) { $check_platinum_user=UserReward::where('user_id', $newReferrar->user_id)->where('rank', 'Platinum')->first();
if (blank($check_platinum_user)) {
$check_refer_by = Referral::where('user_refer_by', $directReward->my_referral)->pluck('user_id');
$golden_counter = UserReward::whereIn('user_id', $check_refer_by)->where('rank', 'Gold')->count();
// $golden_counter = 0;
// foreach ($check_gold as $gold) {
// if ($gold->rank == 'Gold') {
// $golden_counter++;
// }
// }
if ($golden_counter >= 2) {
$user_reward->user_id = $newReferrar->user_id;
$user_reward->referral_id = $newReferrar->id;
$user_reward->rewards = 30000;
$user_reward->rank = 'Platinum';
$user_reward->direct = $check_directs;
$user_reward->points = $check_points;
$user_reward->save();
}
}
} elseif ($check_points >= 21600 && $check_points < 86400) { $check_diamond_user=UserReward::where('user_id', $newReferrar->user_id)->where('rank', 'Diamond')->first();
if (blank($check_diamond_user)) {
$check_refer_by = Referral::where('user_refer_by', $directReward->my_referral)->pluck('user_id');
$platinum_counter= UserReward::whereIn('user_id', $check_refer_by)->where('rank', 'Platinum')->count();
// $platinum_counter = 0;
// foreach ($check_platinum as $gold) {
// if ($gold->rank == 'Platinum') {
// $platinum_counter++;
// }
// }
if ($platinum_counter >= 2) {
$user_reward->user_id = $newReferrar->user_id;
$user_reward->referral_id = $newReferrar->id;
$user_reward->rewards = 50000;
$user_reward->rank = 'Diamond';
$user_reward->direct = $check_directs;
$user_reward->points = $check_points;
$user_reward->save();
}
}
} elseif ($check_points >= 86400 && $check_points < 345600) { $check_blue_diamond_user=UserReward::where('user_id', $newReferrar->user_id)->where('rank', 'Blue Diamond')->first();
if (blank($check_blue_diamond_user)) {
$check_refer_by = Referral::where('user_refer_by', $directReward->my_referral)->pluck('user_id');
$diamond_counter = UserReward::whereIn('user_id', $check_refer_by)->where('rank', 'Diamond')->count();
// foreach ($check_Diamond as $gold) {
// if ($gold->rank == 'Diamond') {
// $diamond_counter++;
// }
// }
if ($diamond_counter >= 3) {
$user_reward->user_id = $newReferrar->user_id;
$user_reward->referral_id = $newReferrar->id;
$user_reward->rewards = 75000;
$user_reward->rank = 'Blue Diamond';
$user_reward->direct = $check_directs;
$user_reward->points = $check_points;
$user_reward->save();
}
}
} elseif ($check_points >= 345600) {
$check_black_diamond_user = UserReward::where('user_id', $newReferrar->user_id)->where('rank', 'Black Diamond')->first();
if (blank($check_black_diamond_user)) {
$check_refer_by = Referral::where('user_refer_by', $directReward->my_referral)->pluck('user_id');
$blue_diamond_counter = UserReward::whereIn('user_id', $check_refer_by)->where('rank', 'Blue Diamond')->count();
// foreach ($check_blue_diamond as $gold) {
// if ($gold->rank == 'Blue Diamond') {
// $blue_diamond_counter++;
// }
// }
if ($blue_diamond_counter >= 3) {
$user_reward->user_id = $newReferrar->user_id;
$user_reward->referral_id = $newReferrar->id;
$user_reward->rewards = 150000;
$user_reward->rank = 'Black Diamond';
$user_reward->direct = $check_directs;
$user_reward->points = $check_points;
$user_reward->save();
}
}
}
if ($refer_by != null) {
$user = User::where('refer_by', $refer_by)->first();
if (!blank($user)) {
check_level($user, $level, $subscribed_package);
}
}
}
}
}
I am making a report in which user can check due balance of them invoice day wise like between 1-30 days how many amount due. between 30-60 days how many amount due etc for that I have make below function.
I don't know how can I optimize this process time.
public function yajraAgingARSummaryByDueDate()
{
$customerData = GenerateInvoice::select('orders.customer_id','customers.first_name', 'customers.last_name','customers.terms','customers.account_id','customers.account_suffix','invoice.due_date','invoice.invoice_number')
->leftJoin('orders','orders.id','=','invoice.order_id')
->leftJoin('customers', 'customers.id', 'orders.customer_id')
->whereDate('invoice.due_date','<=',date('Y-m-d'))
->whereNotNull('orders.customer_id')
->where('invoice.is_invoice_paid','=','no')
->whereNull('invoice.deleted_at')
->groupBy('orders.customer_id')
->get();
$resultArr = [];
if(count($customerData))
{
foreach($customerData as $key => $row)
{
$current = 0;
$b_1_30 = 0;
$b_31_60 = 0;
$b_61_90 = 0;
$b_over_90 = 0;
$total_ar = 0;
$balance = 0;
$invoiceData = GenerateInvoice::select('invoice.id')
->leftJoin('orders','orders.id','=','invoice.order_id')
->where('orders.customer_id',$row['customer_id'])
->whereDate('invoice.due_date','<=',date('Y-m-d'))
->whereNotNull('orders.customer_id')
->whereNull('invoice.deleted_at')
->where('invoice.is_invoice_paid','=','no')
->get();
if(count($invoiceData))
{
foreach($invoiceData as $row1)
{
$data = GenerateInvoice::select(DB::raw("abs(DATEDIFF(STR_TO_DATE(due_date, '%Y-%m-%d'),CURDATE())) AS Days"),'orders.total_order_value','payments.payment_amount')
->selectRaw(' (select sum(auto_cash_distributions.payment_amount) from auto_cash_distributions where auto_cash_distributions.order_id = invoice.order_id and payment_amount is not null ) as acd_payament_amount ')
->leftJoin('orders','orders.id','=','invoice.order_id')
->leftJoin('payments','payments.order_id','=','orders.id')
->where('invoice.id',$row1['id'])
->whereNotNull('orders.customer_id')
->whereNull('invoice.deleted_at')
->whereNull('payments.deleted_at')
->where('invoice.is_invoice_paid','=','no')
// ->groupBy('payments.invoice_id')
->first();
$days = $data['Days'];
$acd_payament_amount = !(empty($data['acd_payament_amount'])) ? $data['acd_payament_amount'] : 0;
$payment_amount = $data['payment_amount'] + $acd_payament_amount;
$amount = $data['total_order_value'] - $payment_amount;
// H 30/12
$amount = $amount;
$balance =$balance + $amount;
$total_ar = $total_ar + $amount;
// $total_ar = $amount;
if($days>90)
{
$b_over_90 = $b_over_90 + $amount;
}
else if($days <=90 && $days>=61)
{
$b_61_90 = $b_61_90 + $amount;
}
else if($days <=60 && $days>=31)
{
$b_31_60 = $b_31_60 + $amount;
}
else if($days <=30 && $days>=1)
{
$b_1_30 = $b_1_30 + $amount;
}
else
{
$current = $current + $amount;
}
}
}
$resultArr[$key]['account_id'] = $row['account_id'];
$resultArr[$key]['account_suffix'] = $row['account_suffix'];
$resultArr[$key]['first_name'] = $row['first_name'];
$resultArr[$key]['terms'] = $row['terms'];
$resultArr[$key]['due_date'] = $row['due_date'];
$resultArr[$key]['invoice_number'] = $row['invoice_number'];
$resultArr[$key]['balance'] = number_format($balance,2,'.','');
$resultArr[$key]['current'] = number_format($current,2,'.','');
$resultArr[$key]['b_1_30'] = number_format($b_1_30,2,'.','');
$resultArr[$key]['b_31_60'] = number_format($b_31_60,2,'.','');
$resultArr[$key]['b_61_90'] = number_format($b_61_90,2,'.','');
$resultArr[$key]['b_over_90'] = number_format($b_over_90,2,'.','');
$resultArr[$key]['total_ar'] = number_format($total_ar,2,'.','');
}
}
return Datatables::of($resultArr)
->addColumn('due_date',function($sql){
return !empty($sql['due_date']) ? date(get_config('date_format'),strtotime($sql['due_date'])) : '';
})
->addIndexColumn()
->rawColumns(['due_date'])
->make(true);
}
but this code is taking to much time to open. can anybody help me to optimize this code?
I am looking for the best way to average the values of a submodel in Laravel, but ignore some of the values. The column I want to average is set as varchar, but contains either a number between 0 and 10 or the value 'N/A'. I need two averages on this column, one ignoring 'N/A' values, and one counting 'N/A' values as 0. I have the fucntions written how how they would be to calculate the averages but I am hoping to get some input on the best way to do this.
I would love to be able to call these functions like this:
$web_scored_tq = $website->scored_tq;
$web_uscored_tq = $website->unscored_tq;
Functions:
public function scored_tq() {
$valid_click_ads = $this->valid_click_ads;
$total = 0;
$num = 0;
foreach ($valid_click_ads as $valid_click_ad) {
if ($valid_click_ad->tq != "N/A") {
$total += $valid_click_ad->tq;
++$num;
}
}
$scored_tq = $total / $num;
}
public function unscored_tq() {
$valid_click_ads = $this->valid_click_ads;
$total = 0;
$num = 0;
foreach ($valid_click_ads as $valid_click_ad) {
if ($valid_click_ad->tq != "N/A") {
$total += $valid_click_ad->tq;
++$num;
} else {
++$num;
}
}
$unscored_tq = $total / $num;
}
I found laravel's model getFooAttribute! I used this to add the following functions to my Website model, and now can call $website->scored_tq or $website->unscored_tq.
public function getScoredTqAttribute() {
$valid_click_ads = $this->valid_click_ads;
$total = 0;
$num = 0;
foreach ($valid_click_ads as $valid_click_ad) {
if ($valid_click_ad->tq != -1) {
$total += $valid_click_ad->tq;
++$num;
}
}
if ( $num != 0 ) {
$scored_tq = $total / $num;
} else {
$scored_tq = '-';
}
return $scored_tq;
}
public function getUnscoredTqAttribute() {
$valid_click_ads = $this->valid_click_ads;
$total = 0;
$num = 0;
foreach ($valid_click_ads as $valid_click_ad) {
if ($valid_click_ad->tq != -1) {
$total += $valid_click_ad->tq;
}
++$num;
}
if ( $num != 0 ) {
$unscored_tq = $total / $num;
} else {
$unscored_tq = '-';
}
return $unscored_tq;
}
I also changed how my data is structured to integers, where "N/A" values are changed to -1.
I have this problem with GD image processing in Opencart that creates real bad blurry images after resize. Nothing I have tried so far has helped.
Below is the code for the image.php
<?php
class Image {
private $file;
private $image;
private $info;
public function __construct($file) {
if (file_exists($file)) {
$this->file = $file;
$info = getimagesize($file);
$this->info = array(
'width' => $info[0],
'height' => $info[1],
'bits' => $info['bits'],
'mime' => $info['mime']
);
$this->image = $this->create($file);
} else {
exit('Error: Could not load image ' . $file . '!');
}
}
private function create($image) {
$mime = $this->info['mime'];
if ($mime == 'image/gif') {
return imagecreatefromgif($image);
} elseif ($mime == 'image/png') {
return imagecreatefrompng($image);
} elseif ($mime == 'image/jpeg') {
return imagecreatefromjpeg($image);
}
}
public function save($file, $quality = 100) {
$info = pathinfo($file);
$extension = strtolower($info['extension']);
if (is_resource($this->image)) {
if ($extension == 'jpeg' || $extension == 'jpg') {
imagejpeg($this->image, $file, $quality);
} elseif($extension == 'png') {
imagepng($this->image, $file);
} elseif($extension == 'gif') {
imagegif($this->image, $file);
}
imagedestroy($this->image);
}
}
/**
*
* #param width
* #param height
* #param default char [default, w, h]
* default = scale with white space,
* w = fill according to width,
* h = fill according to height
*
*/
public function resize($width = 0, $height = 0, $default = '') {
if (!$this->info['width'] || !$this->info['height']) {
return;
}
$xpos = 0;
$ypos = 0;
$scale = 1;
$scale_w = $width / $this->info['width'];
$scale_h = $height / $this->info['height'];
if ($default == 'w') {
$scale = $scale_w;
} elseif ($default == 'h'){
$scale = $scale_h;
} else {
$scale = min($scale_w, $scale_h);
}
if ($scale == 1 && $scale_h == $scale_w && $this->info['mime'] != 'image/png')
{
return;
}
$new_width = (int)($this->info['width'] * $scale);
$new_height = (int)($this->info['height'] * $scale);
$xpos = (int)(($width - $new_width) / 2);
$ypos = (int)(($height - $new_height) / 2);
$image_old = $this->image;
$this->image = imagecreatetruecolor($width, $height);
if (isset($this->info['mime']) && $this->info['mime'] == 'image/png') {
imagealphablending($this->image, false);
imagesavealpha($this->image, true);
$background = imagecolorallocatealpha($this->image, 255, 255, 255, 127);
imagecolortransparent($this->image, $background);
} else {
$background = imagecolorallocate($this->image, 255, 255, 255);
}
imagefilledrectangle($this->image, 0, 0, $width, $height, $background);
imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width,
$new_height, $this->info['width'], $this->info['height']);
imagedestroy($image_old);
$this->info['width'] = $width;
$this->info['height'] = $height;
}
public function watermark($file, $position = 'bottomright') {
$watermark = $this->create($file);
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
switch($position) {
case 'topleft':
$watermark_pos_x = 0;
$watermark_pos_y = 0;
break;
case 'topright':
$watermark_pos_x = $this->info['width'] - $watermark_width;
$watermark_pos_y = 0;
break;
case 'bottomleft':
$watermark_pos_x = 0;
$watermark_pos_y = $this->info['height'] - $watermark_height;
break;
case 'bottomright':
$watermark_pos_x = $this->info['width'] - $watermark_width;
$watermark_pos_y = $this->info['height'] - $watermark_height;
break;
}
imagecopy($this->image, $watermark,
$watermark_pos_x, $watermark_pos_y, 0, 0, 120, 40);
imagedestroy($watermark);
}
public function crop($top_x, $top_y, $bottom_x, $bottom_y) {
$image_old = $this->image;
$this->image = imagecreatetruecolor($bottom_x - $top_x, $bottom_y - $top_y);
imagecopy($this->image, $image_old, 0, 0, $top_x, $top_y,
$this->info['width'], $this->info['height']);
imagedestroy($image_old);
$this->info['width'] = $bottom_x - $top_x;
$this->info['height'] = $bottom_y - $top_y;
}
public function rotate($degree, $color = 'FFFFFF') {
$rgb = $this->html2rgb($color);
$this->image = imagerotate($this->image, $degree,
imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
$this->info['width'] = imagesx($this->image);
$this->info['height'] = imagesy($this->image);
}
private function filter($filter) {
imagefilter($this->image, $filter);
}
private function text($text, $x = 0, $y = 0, $size = 5, $color = '000000') {
$rgb = $this->html2rgb($color);
imagestring($this->image, $size, $x, $y, $text,
imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
}
private function merge($file, $x = 0, $y = 0, $opacity = 100) {
$merge = $this->create($file);
$merge_width = imagesx($image);
$merge_height = imagesy($image);
imagecopymerge($this->image, $merge, $x, $y, 0, 0, $merge_width,
$merge_height, $opacity);
}
private function html2rgb($color) {
if ($color[0] == '#') {
$color = substr($color, 1);
}
if (strlen($color) == 6) {
list($r, $g, $b) = array($color[0] . $color[1], $color[2] . $color[3],
$color[4] . $color[5]);
} elseif (strlen($color) == 3) {
list($r, $g, $b) = array($color[0] . $color[0], $color[1] . $color[1],
$color[2] . $color[2]);
} else {
return false;
}
$r = hexdec($r);
$g = hexdec($g);
$b = hexdec($b);
return array($r, $g, $b);
}
}
?>
As you can see the quality is already set to 100 , so that doesn't help.
I have tried replacing resize with resample - but that produced no visible result.
However I have found this suggestion (code below) to sharpen images, unfortunately I am not sure how and where to use it. Especially since original code processed multiple image types. Please help to put this in the right place.
{
$matrix = array(
array(-1, -1, -1),
array(-1, 16, -1),
array(-1, -1, -1),
);
$divisor = array_sum(array_map('array_sum', $matrix));
$offset = 0;
imageconvolution($image, $matrix, $divisor, $offset);
return $image;
}
Also, if you have other suggestions to improve this code, help is greatly appreciated! I think that goes for the whole Opencart community, as this has been discussed many time but no working solution posted as of yet.
The quality parameter will only be applicable to .jpeg images.
To sharpen the images you could apply the imageconvolution() code within the resize() function.
public function resize($width = 0, $height = 0, $default = '') {
if (!$this->info['width'] || !$this->info['height']) {
return;
}
$xpos = 0;
$ypos = 0;
$scale = 1;
$scale_w = $width / $this->info['width'];
$scale_h = $height / $this->info['height'];
if ($default == 'w') {
$scale = $scale_w;
} elseif ($default == 'h') {
$scale = $scale_h;
} else {
$scale = min($scale_w, $scale_h);
}
if ($scale == 1 && $scale_h == $scale_w && $this->info['mime'] != 'image/png') {
return;
}
$new_width = (int)($this->info['width'] * $scale);
$new_height = (int)($this->info['height'] * $scale);
$xpos = (int)(($width - $new_width) / 2);
$ypos = (int)(($height - $new_height) / 2);
$image_old = $this->image;
$this->image = imagecreatetruecolor($width, $height);
if (isset($this->info['mime']) && $this->info['mime'] == 'image/png') {
imagealphablending($this->image, false);
imagesavealpha($this->image, true);
$background = imagecolorallocatealpha($this->image, 255, 255, 255, 127);
imagecolortransparent($this->image, $background);
} else {
$background = imagecolorallocate($this->image, 255, 255, 255);
}
imagefilledrectangle($this->image, 0, 0, $width, $height, $background);
imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']);
//Image Sharpening Code
$matrix = array(
array(0.0, -1.0, 0.0),
array(-1.0, 5.0, -1.0),
array(0.0, -1.0, 0.0)
);
$divisor = array_sum(array_map('array_sum', $matrix));
$offset = 0;
imageconvolution($this->image, $matrix, $divisor, $offset);
// End Image Sharpening Code
imagedestroy($image_old);
$this->info['width'] = $width;
$this->info['height'] = $height;
}
References:
sharpen image quality with PHP gd library
http://adamhopkinson.co.uk/blog/2010/08/26/sharpen-an-image-using-php-and-gd/
In my code I have defined a circle:
var material1 = new THREE.LineBasicMaterial( { color: 0x000000, opacity: contentionopacity} );
scene.add(circle);
var resolution1 = 100;
var amplitude1 = 60;
var size1 = 360 / resolution1;
geometry1 = new THREE.Geometry();
for(var i = 0; i <= resolution1; i++) {
var segment1 = ( i * size1 ) * Math.PI / 180;
geometry1.vertices.push(new THREE.Vertex(
new THREE.Vector3(
(Math.cos(segment1) * amplitude1) ,
400,
(Math.sin(segment1) * amplitude1) -100 )
)
);
}
feetcircle = new THREE.Line( geometry1, material1 );
scene.add(feetcircle)
In there is the part where I defined the opacity with 'contentionopacity'.
The question is... Is it still possible that while it's being rendered, I can change it's opacity (and thus make it appear/dissapear with the 'push of a button'?:
'rendering part':
if (circleX1 == undefined) circleX1 = (neckcoords[0][1] -100 )//( ((neckcoords[0][1])-305) * Math.cos(rad) - (neckcoords[0][2] * Math.sin(rad)) ) +330 ;
if (circleY1 == undefined) circleY1 = (neckcoords[0][2] -530) //( neckcoords[0][2] * Math.cos(rad) + neckcoords[0][1] * Math.sin(rad) ) ;
// if (circleZ1 == undefined) circleZ1 = ( neckcoords[0][0] -90) ;
for(var i = 0; i <= 100; i++) {
feetcircle.geometry.vertices[i].x += (neckcoords[0][1] - circleX1 ) //(neckcoords[0][1] * Math.cos(rad) - neckcoords[0][2] * Math.sin(rad)) - circleX ;
feetcircle.geometry.vertices[i].z += ( neckcoords[0][2] - circleY1) //- ( neckcoords[0][2] * Math.cos(rad) + neckcoords[0][1] * Math.sin(rad) - circleY);
//feetcircle.geometry.vertices[i].y += ( neckcoords[0][0] - circleZ1);
}
circleX1 = neckcoords[0][1] //* Math.cos(rad) - neckcoords[0][2] * Math.sin(rad) ;
circleY1 = neckcoords[0][2] //* Math.cos(rad) + neckcoords[0][1] * Math.sin(rad);
//circleZ1 = neckcoords[0][0] //* Math.cos(rad) + neckcoords[0][0] * Math.sin(rad);
feetcircle.geometry.verticesNeedUpdate = true;
'push of the button':
document.addEventListener('keypress', function (e) {
if (e.keyCode == '17') { contentionopacity=contentionopacity+0.1}
console.log(contentionopacity)
},
false)
document.addEventListener('keypress', function (e) {
if (e.keyCode == '61') { contentionopacity=contentionopacity-0.1}
console.log(contentionopacity)
},
false)
At the moment, the console log shows that the 'contentionopacity' is getting higher, but it doesn't change the opacity of the circle at all.
Thanks in advance!