Skip to content

Commit ac7a923

Browse files
committed
キャンバス調整
1 parent 4f07271 commit ac7a923

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

assets/js/menuAnimation.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
let animationCanvas;
2+
let circleSize = 0;
3+
let growing = true;
24

35
function setup() {
46
const parent = document.getElementById(
@@ -9,13 +11,29 @@ function setup() {
911
parent.offsetHeight,
1012
);
1113
animationCanvas.parent("menuAnimationCanvas");
12-
background(22, 27, 34);
14+
background(22, 27, 34); // 背景色を一度だけ設定
1315
}
1416

1517
function draw() {
18+
background(22, 27, 34, 50);
1619
noStroke();
17-
fill(255, 255, 255, 50);
18-
ellipse(random(width), random(height), 10, 10);
20+
fill(255, 255, 255, 150);
21+
22+
if (growing) {
23+
circleSize += 0.5;
24+
if (circleSize > 50) {
25+
growing = false;
26+
}
27+
} else {
28+
circleSize -= 0.5;
29+
if (circleSize < 10) {
30+
growing = true;
31+
}
32+
}
33+
ellipse(width / 2, height / 2, circleSize, circleSize);
34+
35+
fill(255, 255, 255, 80);
36+
ellipse(mouseX, mouseY, 15, 15);
1937
}
2038

2139
function windowResized() {

index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,9 @@ <h3>Contact</h3>
454454
</section>
455455
</main>
456456
</div>
457-
<!-- 共通JS -->
457+
458458
<script src="assets/js/layout.js" defer></script>
459459
<script src="assets/js/ui.js"></script>
460-
<!-- トップページ専用JS(今は空でもOK) -->
461460
<script src="assets/js/top.js" defer></script>
462461
</body>
463462
</html>

partials/header.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
>Contact</a
3939
>
4040

41-
<canvas id="menuAnimationCanvas"></canvas>
42-
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js"></script>
43-
<script src="assets/js/menuAnimation.js"></script>
41+
<!-- <canvas id="menuAnimationCanvas"></canvas> -->
42+
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js"></script> -->
43+
<!-- <script src="assets/js/menuAnimation.js"></script> -->
4444
</nav>
4545
</div>
4646
</header>

0 commit comments

Comments
 (0)