[help] how to achieve central magnification of pictures in div?

refer to https://www.jb51.net/article/., modify the code as follows:
but the effect is the magnification effect started on the left
how to achieve the central magnification effect in the img in div?

<script type="text/javascript">
function fangda(){
    var pic=$(".pictures img");
    var wValue=20+pic.width();
    var hValue=20+pic.height();
    pic.animate({width: wValue, height: hValue, left:("-"+(0.5 * pic.width())/2), top:("-"+(0.5 * pic.height())/2)}, 1000);
}
</script>
<body>
<button onclick="fangda()"></button>
<style>
.pictures {
    width: 414px;
    height: 390px;
    overflow: hidden;
}    
</style>
<div class="pictures">
    <img src="3.jpg">
</div>
Mar.29,2021

css transform: scale (2)


try transform-origin: center

Menu