gpt4 book ai didi

CSS transform Scale 平移对象,如何避免?

转载 作者:太空宇宙 更新时间:2023-11-04 11:07:37 25 4
gpt4 key购买 nike

我想将一个对象作为动画进行缩放,我希望它保持在原位并且只是增长,但是在对此进行编程时,整个绘图都会增长,即使我只是在这个例子中将代码应用于圆圈:http://codepen.io/Filipo/pen/JYVvXK

<svg>
<g transform="translate(0 -662.36)">
<circle id="dedo" r="35" style="color-rendering:auto;color:#000000;isolation:auto;mix-blend-mode:normal;fill-rule:evenodd;shape-rendering:auto;solid-color:#000000;image-rendering:auto;fill:#fff" cx="147.62" cy="741.74"/>
</g>
</svg>

body {background-color: black;}
#dedo{
animation: deslizando 2s ease-in-out infinite;
}

@keyframes deslizando {
0% {opacity: 1;}
100% {transform: scale(1.1,1.1);}
}

它是一个矩形 SVG,里面有一个圆圈,当我扩大圆圈时,它会改变它的位置,我希望它留在原来的位置。

感谢您的帮助!

最佳答案

你只需要在比例尺上应用一个原点,它默认在左上角,听起来你可能想要它在中间

#dedo{
animation: deslizando 2s ease-in-out infinite;
transform-origin: 50% 50%;
}

关于CSS transform Scale 平移对象,如何避免?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33848802/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com