```html
<!DOCTYPE html>
<html>
<head>
<style>
@keyframes pop {
0% { transform: scale(1); }
50% { transform: scale(1.2); }
100% { transform: scale(1); }
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.pop-animation {
animation: pop 0.3s ease;
}
.fade-in {
animation: fadeIn 0.5s ease;
}
</style>
</head>
<body>
<div style="width: 100%; max-width: 400px; height: 400px; margin: auto; position: relative; border: 2px solid #000; box-sizing: border-box;">
<canvas id="designCanvas" width="400" height="400" style="display: block;"></canvas>
<div style="position: absolute; top: 10px; left: 10px; background: rgba(255, 255, 255, 0.8); padding: 10px; border-radius: 8px;">
<div style="margin-bottom: 10px;">
<label for="innerThickness" style="display: block; font-size: 14px;">内端の太さ: <span id="innerValue">2</span>px</label>
<input type="range" id="innerThickness" min="1" max="10" value="2" style="width: 150px;">
</div>
<div style="margin-bottom: 10px;">
<label for="outerThickness" style="display: block; font-size: 14px;">外端の太さ: <span id="outerValue">4</span>px</label>
<input type="range" id="outerThickness" min="1" max="20" value="4" style="width: 150px;">
</div>
<div style="margin-bottom: 10px;">
<label for="lineCount" style="display: block; font-size: 14px;">線の数: <span id="lineCountValue">12</span></label>
<input type="range" id="lineCount" min="4" max="60" value="12" style="width: 150px;">
</div>
<div style="margin-bottom: 10px;">
<label for="colorCount" style="display: block; font-size: 14px;">色の数: <span id="colorCountValue">6</span></label>
<input type="range" id="colorCount" min="2" max="12" value="6" style="width: 150px;">
</div>
<button id="randomizeBtn" style="width: 100%; padding: 5px; font-size: 14px; cursor: pointer;">ランダム化</button>
</div>
</div>
<script>
const canvas = document.getElementById('designCanvas');
const ctx = canvas.getContext('2d');
const innerThicknessInput = document.getElementById('innerThickness');
const outerThicknessInput = document.getElementById('outerThickness');
const lineCountInput = document.getElementById('lineCount');
const colorCountInput = document.getElementById('colorCount');
const randomizeBtn = document.getElementById('randomizeBtn');
const innerValue = document.getElementById('innerValue');
const outerValue = document.getElementById('outerValue');
const lineCountValue = document.getElementById('lineCountValue');
const colorCountValue = document.getElementById('colorCountValue');
function getRandomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
function generateColors(count) {
const colors = [];
for (let i = 0; i < count; i++) {
colors.push(getRandomColor());
}
return colors;
}
function draw() {
const innerThickness = parseInt(innerThicknessInput.value);
const outerThickness = parseInt(outerThicknessInput.value);
const lineCount = parseInt(lineCountInput.value);
const colorCount = parseInt(colorCountInput.value);
innerValue.textContent = innerThickness;
outerValue.textContent = outerThickness;
lineCountValue.textContent = lineCount;
colorCountValue.textContent = colorCount;
ctx.clearRect(0, 0, canvas.width, canvas.height);
const colors = generateColors(colorCount);
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
const maxRadius = Math.min(centerX, centerY);
for (let i = 0; i < lineCount; i++) {
const angle = (i / lineCount) * Math.PI * 2;
const x = centerX + Math.cos(angle) * maxRadius;
const y = centerY + Math.sin(angle) * maxRadius;
const radius = Math.random() * maxRadius;
ctx.beginPath();
ctx.moveTo(centerX, centerY);
ctx.lineTo(x, y);
ctx.strokeStyle = colors[i % colorCount];
ctx.lineWidth = innerThickness + Math.random() * (outerThickness - innerThickness);
ctx.stroke();
}
}
innerThicknessInput.addEventListener('input', () => {
draw();
triggerAnimation(innerThicknessInput);
});
outerThicknessInput.addEventListener('input', () => {
draw();
triggerAnimation(outerThicknessInput);
});
lineCountInput.addEventListener('input', () => {
draw();
triggerAnimation(lineCountInput);
});
colorCountInput.addEventListener('input', () => {
draw();
triggerAnimation(colorCountInput);
});
randomizeBtn.addEventListener('click', () => {
innerThicknessInput.value = Math.floor(Math.random() * 10) + 1;
outerThicknessInput.value = Math.floor(Math.random() * 20) + 1;
lineCountInput.value = Math.floor(Math.random() * 56) + 4;
colorCountInput.value = Math.floor(Math.random() * 11) + 2;
draw();
triggerAnimation(randomizeBtn);
});
function triggerAnimation(element) {
element.classList.remove('pop-animation');
void element.offsetWidth;
element.classList.add('pop-animation');
}
canvas.addEventListener('click', () => {
canvas.classList.remove('fade-in');
void canvas.offsetWidth;
canvas.classList.add('fade-in');
});
// Initial draw
draw();
</script>
</body>
</html>
```