I am trying to make my triangle rotate around the circle for my college assignment, but I have a problem making my triangle responsive.
The blue-purple triangle is supposed to be rotating inside the orange square box and the size should be responsive like the other shapes, but my knowledge is very limited.
Is there any solution for squashing my little triangle into the square?
I appreciated your help in advance...
body {
background-color: white;
}
svg {
position: absolute;
width: 100vw;
height: 100vh;
fill:white;
}
.box {
position: relative;
width: 30vw;
height: 30vw;
fill:white;
stroke:orange;
stroke-width: 1px;
}
.circleAndTriangle {
animation: colorChange 5s linear infinite;
}
.triangle {
transform-origin: 50vw 35vw;
position: absolute;
animation: rotatingTriangle 5s linear reverse infinite;
}
@keyframes colorChange {
0% {fill:blue }
100% {fill:red}
}
@keyframes rotatingTriangle {
0% {transform: rotate(0deg);}
100% {transform: rotate(-360deg);}
}
<!DOCTYPE html>
<html lang="en-UK">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link type="text/css" href="https://cdn.jsdelivr.net/npm/reset-css@3.0.0/reset.min.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<title>Rotating Study</title>
</head>
<body>
<svg>
<rect x="35vw" y="20vw" rx="0px" ry="0px" class="box"/>
<g class="circleAndTriangle">
<circle cx= "50vw" cy="35vw" r="1.5vw" class="circle"/>
<polygon points="250,150,280,150,265,175" class="triangle"/>
</g>
</svg>
</body>
</html>