【发布时间】:2017-12-13 14:38:19
【问题描述】:
我想为一个 svg 元素制作动画并让它缩放 (2)。这很好用,但问题是我的元素有一个“x”和“y”值。因此,比例尺将元素移动到不同的位置。
但我想在不将其移动到其他位置的情况下对其进行缩放。 'x' 和 'y' 值在其他地方定义,我不想在我的 css 中“硬编码”这些值。 而且我不想使用 JS,如果可能的话,它应该是平面 css。
代码:
.hello {
transition: 1s;
height: 100px;
width: 100px;
margin: 100px;
background-color: red;
transform-origin: center center;
position:relative;
}
.hello:hover {
transform: scale(4);
}
<use
id="=test"
xlink:href="#but"
x="100" y="20"
width="100%"
height="100%"
class="hello">
<title
id="title31">
I am an example toolTip
</title>
</use>
可以在此处找到代码示例:
【问题讨论】: