Beispiel:Transform-rotate-2.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
<!DOCTYPE html>
<html lang="de">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css" >
	<title>rotate + scale 2</title>
<style>
@property --scale {
   syntax: "<number>";
   inherits: true;
   initial-value: 1;
}

@keyframes pulse {
	from { --scale: 1.0; }
	to   { --scale: 1.2; }
}

svg {
	fill: rebeccapurple;
	width: 12em;
	transform: rotate(.45turn) scale(var(--scale, 1));
	animation: 1s infinite alternate pulse;
}

@supports (rotate: .45turn) {
	svg {
		transform: none;
		rotate: .45turn;
	}
	@keyframes pulse {
		from { scale: 1.0; }
		to   { scale: 1.2; }
	}
}
</style>
</head>
<body>
	<h1>Animation von <code>rotate</code> und <code>scale</code><br>mit custom properties</h1>
<svg viewBox="0 0 10 10">
	<path d="m5 1 -4 5 h2 v3 h4 v-3 h2z"/>
</svg>

<p>Das Beispiel funktioniert in allen modernen Browsern!</p>
	
</body>
</html>