Parametric circle positions
This commit is contained in:
parent
abc8a124f6
commit
56f21908ff
|
@ -22,12 +22,9 @@ jQuery(function($){
|
||||||
"animation-duration":speed+"s",
|
"animation-duration":speed+"s",
|
||||||
"-webkit-animation-duration":speed+"s"
|
"-webkit-animation-duration":speed+"s"
|
||||||
});
|
});
|
||||||
for(var i=0;i<$(".small-circle").length;i++){
|
$(".small-circle").each(function(){
|
||||||
var r=Math.round(Math.random()*radius);
|
$(this).css("border-color",$(this).data('color'));
|
||||||
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+")");
|
|
||||||
}
|
|
||||||
$(".humans").hover(function(){
|
$(".humans").hover(function(){
|
||||||
$(this).find("img").css({
|
$(this).find("img").css({
|
||||||
"border":"5px double "+img_border_color
|
"border":"5px double "+img_border_color
|
||||||
|
|
File diff suppressed because one or more lines are too long
62
stylesheets/trigonometry.scss
Normal file
62
stylesheets/trigonometry.scss
Normal 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);
|
||||||
|
}
|
|
@ -80,8 +80,9 @@ function imbb_usergalaxy() {
|
||||||
<div class="circles circle-1">
|
<div class="circles circle-1">
|
||||||
<?php
|
<?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
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Reference in a new issue