Skip to content

Commit

Permalink
General fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CallumGilly committed Nov 14, 2022
1 parent 6958d39 commit 67290db
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
8 changes: 4 additions & 4 deletions navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
}

.hamburger-menu:hover .top {
transform: translateX(1.7rem) rotate(45deg);
transform: translateX(1.2rem) rotate(45deg);
border-radius: 0px;
width: 1.17rem;
width: 1.1rem;
}

.hamburger-menu:hover .middle {
width: 2rem;
}

.hamburger-menu:hover .bottom {
transform: translateX(1.7rem) rotate(-45deg);
transform: translateX(1.2rem) rotate(-45deg);
border-radius: 0px;
width: 1.17rem;
width: 1.1rem;
}
4 changes: 3 additions & 1 deletion spirograph.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.5.0/p5.min.js" integrity="sha512-WJXVjqeINVpi5XXJ2jn0BSCfp0y80IKrYh731gLRnkAS9TKc5KNt/OfLtu+fCueqdWniouJ1ubM+VI/hbo7POQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="spirograph.js"></script>
<style> body {padding: 0; margin: 0;} </style>
<style>
body {padding: 0; margin: 0;}
</style>
</head>

<body>
Expand Down
20 changes: 18 additions & 2 deletions spirograph.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//Half of these are useless but I do not wish to deal with this bull rn
let r=10;
let rDir=1;
let rEnabled=1;
Expand All @@ -11,28 +12,35 @@ let ODir = 2.5;
let OMax;
let frame = 0;
let frameMod = 20;

//Runs once at the start and sets environment variable
function setup() {
createCanvas(windowWidth,windowHeight);
rMax = windowWidth/4;
rMax = 70//windowWidth/8;
OMax = windowWidth/4;
R=rMax+1;
R=windowWidth/4+1;
background(0);
stroke(0,100,0);
frameRate(30);
}

//Runs ever frame
function draw() {
background(0);
for (let t = 0; t < (100 / frameMod) * (frame % frameMod); t+= 0.025) {
line(x(t),y(t),x(t+0.025),y(t+0.025));
}
//This does cool maths to make it move, I've changed it so much I no longer know what it does
if (frame % frameMod == 0) {
//Code in this runs ever 20 frames
r +=rDir;
if (O == r) {
r += rDir;
}
if (r >= rMax || r <= 9) {
rDir *= -1;
}
if (frame % (frameMod*7) == 0) {
O += ODir;
if (O >= 40 || O <= 20) {
ODir *= -1;
Expand All @@ -42,10 +50,18 @@ function draw() {
frame++;
}

//Calculate a X coordinate
function x(t) {
return windowWidth/2 + (R-r)*Math.cos(t) + O*Math.cos(((R-r)/r)*t);
}

//Calculate a Y coordinate
function y( t) {
return windowHeight/2 + (R-r)*Math.sin(t) + O*Math.sin(((R-r)/r)*t);
}

//Resize the canvas on window resize
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
R = windowWidth/4 + 1;
}

0 comments on commit 67290db

Please sign in to comment.