Parametric circle positions

This commit is contained in:
Alexander Yakovlev 2017-06-16 14:31:06 +07:00
parent abc8a124f6
commit 56f21908ff
4 changed files with 87 additions and 96 deletions

View File

@ -22,12 +22,9 @@ jQuery(function($){
"animation-duration":speed+"s",
"-webkit-animation-duration":speed+"s"
});
for(var i=0;i<$(".small-circle").length;i++){
var r=Math.round(Math.random()*radius);
var g=Math.round(Math.random()*radius);
var b=Math.round(Math.random()*radius);
$(".small-circle").eq(i).css("border-color","rgb("+r+","+g+","+b+")");
}
$(".small-circle").each(function(){
$(this).css("border-color",$(this).data('color'));
});
$(".humans").hover(function(){
$(this).find("img").css({
"border":"5px double "+img_border_color

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,62 @@
@function pow($number, $exp) {
$value: 1;
@if $exp > 0 {
@for $i from 1 through $exp {
$value: $value * $number;
}
}
@else if $exp < 0 {
@for $i from 1 through -$exp {
$value: $value / $number;
}
}
@return $value;
}
@function fact($number) {
$value: 1;
@if $number > 0 {
@for $i from 1 through $number {
$value: $value * $i;
}
}
@return $value;
}
@function pi() {
@return 3.14159265359;
}
@function rad($angle) {
$unit: unit($angle);
$unitless: $angle / ($angle * 0 + 1);
// If the angle has 'deg' as unit, convert to radians.
@if $unit == deg {
$unitless: $unitless / 180 * pi();
}
@return $unitless;
}
@function sin($angle) {
$sin: 0;
$angle: rad($angle);
// Iterate a bunch of times.
@for $i from 0 through 10 {
$sin: $sin + pow(-1, $i) * pow($angle, (2 * $i + 1)) / fact(2 * $i + 1);
}
@return $sin;
}
@function cos($angle) {
$cos: 0;
$angle: rad($angle);
// Iterate a bunch of times.
@for $i from 0 through 10 {
$cos: $cos + pow(-1, $i) * pow($angle, 2 * $i) / fact(2 * $i);
}
@return $cos;
}
@function tan($angle) {
@return sin($angle) / cos($angle);
}

View File

@ -79,9 +79,10 @@ function imbb_usergalaxy() {
<div class="container">
<div class="circles circle-1">
<?php
for ($i = 1; $i <= count($query); $i++) {
for ($i = 1; $i <= count($query); $i++) {
$color = 'rgb('.rand(0,255).', '.rand(0,255).', '.rand(0,255).')';
?>
<div class="small-circle small-<?php echo $i ?>"></div>
<div class="small-circle small-<?php echo $i ?>" data-color="<?php echo $color ?>"></div>
<?php
}
?>