将一张图像移动到另一张图像内

2023-11-25

背景

我允许用户上传蒙版图像内的图像......

一旦用户上传图像,我就填充用户上传里面的图像mask image :

1.遮罩图像 :

enter image description here

2.用户上传的图片 :

enter image description here

3.用户上传的面具图像[最终图像]:

enter image description here

代码笔:https://codepen.io/kidsdial2/pen/OdyemQ

JS小提琴:http://jsfiddle.net/2xq8p0zy/

Html

<body>
  <img src="http://139.59.24.243/images/invitations/birthday/a.jpg" alt="">
</body>

css

body {
  background-color: #111;
  color: #555;
  font-size: 1.1em;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

img {
  margin: 20px auto;
  display: block;
  width: 100%;
  height: 500px;
  -webkit-mask-image: url(http://139.59.24.243/images/invitations/birthday/ice.png);
  mask-image: url(http://tympanus.net/codrops-playground/assets/images/cssref/properties/mask-image/mask-image.png);
  -webkit-mask-position: center center;
  mask-position: center center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

要求:

我想给一个选择将用户上传的图像移动到蒙版图像内就像这个小提琴一样:

http://jsfiddle.net/aLcb4sb5/ or link

Issue :

但目前在website两个图像都在移动......


我对你的设计做了一些修改。这是对 html 和 css 的一个小改动。 新的html布局是这样的

  <div class="image-holder">
  <img src="https://www.gettyimages.com/gi-resources/images/CreativeLandingPage/HP_Sept_24_2018/CR3_GettyImages-159018836.jpg" alt="">
  </div>

where image-holderdiv 是mask image其中的图像是user uploaded image

我做了一个演示看看here

请注意,要使 Draggable 工作,您需要安装 jQuery.ui,并且我认为您已经在站点中使用了它。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将一张图像移动到另一张图像内 的相关文章