简体   繁体   English

有人可以帮助我使用网络应用程序来模拟图像传输吗?

[英]Can somebody help me with a web application for a simulation of transfer of images

I am trying to simulate a transfer of images by showing an image disappearing from the originating device and after a delay appearing on the target device. 我试图通过显示从原始设备中消失的图像以及在目标设备上出现延迟之后来模拟图像的传输。 The application is for an experiment to design gestures 该应用程序是用于设计手势的实验

I have done the following that shows how an image appears and disappears when hovered upon 我完成了以下操作,显示了将鼠标悬停在其上时图像如何出现和消失

  #pic3 { max-width: 800px; max-height: 500px; width:500px; height:800px; position:absolute; } #pic3 { max-width: 800px; max-height: 500px; width:500px; height:800px; position:absolute; } #pic4 { width:500px; height:800px; position:absolute; max-width:800px; max-height: 500px; opacity:0; -webkit-transition: opacity 1s; } #pic3:hover ~ #pic4, #pic4:hover { opacity:1; } 
  <div class="maps1"> <img id="pic3" src="http://wallpapersfor.me/wp-content/uploads/2012/02/cute_cat_praying-1280x800.jpg" /> <img id="pic4" src="http://www.garageservicesruislip.co.uk/communities/5/004/008/507/645/images/4586026183.jpg /> </div> 

you have a typo in your html in the last img (missing ") 您在上一张img中的html中有一个错字(缺少“”)

btw. 顺便说一句 i would try to solve it using jQuery 我会尝试使用jQuery解决问题

A simple Keyframe solution: 一个简单的关键帧解决方案:

 .device { position: absolute; height: 200px; width: 150px; background: gray; border: 10px solid black; border-radius: 5px; top: 0; left: 400px } .device:first-child { right: auto; left: 0; } img { height: 100px; width: 100px; z-index: 8; position: absolute; top: 20px; left: 30px; -webkit-animation: animated 5s infinite; animation: animated 5s infinite; -webkit-animation-direction: linear; /* Chrome, Safari, Opera */ animation-direction: linear; } @-webkit-keyframes animated { 10% { opacity: 1; } 30% { opacity: 0; left: 30px; } 60% { opacity: 0; left: 430px; } 90% { left: 430px; opacity: 1; } 100% { left: 430px; opacity: 1; } } @keyframes animated { 10% { opacity: 1; } 30% { opacity: 0; left: 30px; } 60% { opacity: 0; left: 430px; } 90% { left: 430px; opacity: 1; } 100% { left: 430px; opacity: 1; } } 
 <div class="device"></div> <img src="http://placekitten.com/g/300/300" /> <div class="device"></div> 


My Approach 我的方法

You could use Keyframes for this, and use a little magic to create a nice effect. 您可以为此使用关键帧,并使用一些魔术来创建一个不错的效果。 Here I've used rotation, opacity, and movement to generate this 'movement' from one device to another. 在这里,我使用了旋转,不透明度和运动来生成从一个设备到另一个设备的“运动”。

 .start, .end { position: absolute; height: 250px; background: gray; border: 10px solid black; border-radius: 5px; width: 100px; top: 0; left: 0; } .end { left: auto; right: 0; } .imgMove { background: url(http://placekitten.com/g/300/300); background-size: 100% 100%; height: 50px; width: 50px; position: absolute; top: 100px; left: 40px; z-index: 8; -webkit-animation: myfirst 3s infinite; animation: myfirst 3s infinite; } #two { background: url(http://placekitten.com/g/200/300); -webkit-animation-delay: 0.5s; animation-delay: 0.4s; } #three { background: url(http://placekitten.com/g/300/200); -webkit-animation-delay: 0.1s; animation-delay: 0.6s; } @-webkit-keyframes myfirst { 0% { top: 100px; height: 50px; width: 50px; opacity: 0; } 50% { top: 10px; height: 200px; width: 200px; left: calc(50% - 100px); -webkit-transform: rotate(360deg); opacity: 1; } 100% { top: 100px; height: 50px; width: 50px; left: 90%; -webkit-transform: rotate(720deg); opacity: 0; } } @keyframes myfirst { 0% { top: 100px; height: 50px; width: 50px; opacity: 0; } 50% { top: 10px; height: 200px; width: 200px; left: calc(50% - 100px); transform: rotate(360deg); opacity: 1; } 100% { top: 100px; height: 50px; width: 50px; left: 90%; transform: rotate(720deg); opacity: 0; } } 
 <div class="wrap"> <div class="imgMove" id="one"></div> <div class="imgMove" id="two"></div> <div class="imgMove" id="three"></div> <div class="start">START</div> <div class="end">END</div> </div> 

If you are trying to make an animation on one device - ie a desktop computer - trigger an animation on another device - ie a smartphone - you're going to need some means of communicating between the two. 如果您尝试在一个设备(例如台式计算机)上制作动画,而在另一设备(例如智能手机)上触发动画,则将需要一些在两者之间进行通信的方法。 There will need to be some kind of session ID or other marker to facilitate communication between two separate browsers accessing content on a webpage each of them has loaded and rendered separately. 将需要某种会话ID或其他标记,以促进两个单独的浏览器之间的通信,这些浏览器访问网页上的内容,每个浏览器均已分别加载和呈现。

You'll be able to achieve this kind of functionality in a number of ways, but I suggest reading up on websockets using node.js . 您可以通过多种方式实现这种功能,但是我建议您使用node.js阅读websockets

If you're simply trying to mock it up on one screen (read: one browser, one session) then you're best off doing something like what @jbutler483 describes. 如果您只是想在一个屏幕上模拟它(阅读:一个浏览器,一个会话),那么最好执行@ jbutler483描述的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有人可以帮我编写和理解部分应用程序模式吗? - Can somebody help me write and understand the partial application pattern? 有人可以用一些逻辑来帮助我吗? - Can somebody help me with some logic? 有人可以帮助我吗? 在 React 中找不到问题 - Can somebody help me? Can't find problem in React 有人可以使用Lodash / Underscore / Javascript / jQuery帮助我吗? - Can somebody help me using Lodash/Underscore/Javascript/jQuery? 有人可以帮助我理解这段代码中发生的事情吗 - Can somebody help me in understanding what is happening in this piece of code 有人可以帮助我找到带有链接的ng内容的定位器吗? - Can somebody help me with locators for ng-contents with links? discord.js中的“未定义”错误,有人可以帮助我吗? - “Undefined” Error in discord.js, can somebody help me? 有人可以帮助我更改Chrome的Google字典扩展的不透明度吗? - Can somebody help me change the opacity of the Google Dictionary Extension for Chrome? 有人可以帮我解决几何变换问题吗? - Can somebody please help me with a geometric transformation problem? 有人可以帮我解码这个。 看起来像 Javascript 或 Json - Can somebody help me decode this. Looks like Javascript or Json
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM