用css / js响应重叠图像(Rsponsive overlapping image with css/js)
我有一个全格div的图像,它与div重叠,所以当浏览器被调整大小时,会显示/隐藏更多图像,但图像本身不会调整大小。 我得到了它的宽度工作,但我怎么能达到相同的效果的高度?
这是我的测试: https : //jsfiddle.net/g8h8umt3/
我得到了与CSS工作的宽度:
#img-header{ margin-left: 50%; transform: translateX(-50%); }
编辑:
背景中的图像应保持其大小,并且根据屏幕大小,父div应该变得更小/更大。 我得到了宽度的行为,但我不知道如何去做图像的高度。
我也试过添加
#img-header{ margin-top: 50%; margin-left: 50%; transform: translate(-50%,-50%); }
但这似乎并不奏效
I have a image in a fullwidth div which is overlapping the div, so when the browser gets resized more of the image is shown/hidden but the image itself does not get resized. i got it working for the width but how can i achieve the same effect for the height?
Here is my test: https://jsfiddle.net/g8h8umt3/
i got the width working with css:
#img-header{ margin-left: 50%; transform: translateX(-50%); }
EDIT:
Here is a image on how it suppose to work: Image
The image in the background should keep its size and the parent div should get smaller/larger depending on the screen size. I got the behaviour for the width but i dont know how to do it for the height of the image.
I also tried adding
#img-header{ margin-top: 50%; margin-left: 50%; transform: translate(-50%,-50%); }
but this does not seem to work
原文:https://stackoverflow.com/questions/45495266
最满意答案
在我的日常生活中,我只是为角色创建一个动画,而在Unity中我是父亲的武器,例如手骨。 这种简单的方法对我来说很好。 并尝试将您的模型导出为.fbx,通常更好。
On my daily basis, I just create an animation for character, and in Unity I am parent a weapon to the, for example, hand bone. This simple approach works fine for me. And try exporting your model as .fbx, usually its better.
相关问答
更多-
在我的日常生活中,我只是为角色创建一个动画,而在Unity中我是父亲的武器,例如手骨。 这种简单的方法对我来说很好。 并尝试将您的模型导出为.fbx,通常更好。 On my daily basis, I just create an animation for character, and in Unity I am parent a weapon to the, for example, hand bone. This simple approach works fine for me. And try ...
-
如何在Unity中做2D动画(How to do 2D animation in Unity)[2023-11-25]
您是否探索过Unity中可用的2D Sprite引擎? 无论谁说“Unity不是真正的设计用于2D工作的引擎”,他们正在谈论这个问题。 我刚开始研究爱好2D游戏,并使用名为Orthello的Unity插件( 请参阅WyrmTale网站获取信息 )。 它可以处理精灵表,动画,碰撞检测等等,而无需编写大量代码来完成此操作。 学习曲线有点陡峭,他们网站上的例子并不是最好的,但我发现复制下载附带的示例解决方案是获得某些工作的最佳方式。 还有一个名为Sprite Manager 2的类似工具,但您必须为此付费(我认为 ... -
在UV解开你的模型后,你将uv保存在一个文件中,你应该将该文件作为一个纹理应用于你的模型,你将会完成,告诉我你是否已经这样做了。 这是有用的教程。 after you UV unwrapped your model you save the uv in a file in blender you should apply that file as a texture to your model in unity and you will be done,tell me if you have already ...
-
您可以使用不同的图层和蒙版来混合多个动画。 你可以看看这里: https://www.youtube.com/watch?v=-SAnr8-Xfgg 头像面具的Unity教程: https://unity3d.com/learn/tutorials/topics/animation/avatar-masks You can use different layers and masks to blend multiple animations. You can have a look at here: htt ...
-
这取决于你的游戏是什么,以及什么样的规模。 与其他动态选项交互的下降对象? 物理学通常是最好的答案。 只是想要一些东西离开屏幕然后消失? 动画可以有意义,但是没有使用物理也有其他选择。 使用大量的对象? 物理学是处理它的好方法。 使用数千个对象? 物理学可能太多,需要考虑其他方式。 你的问题真的很模糊,所以除了模糊的回答之外别无他法。 但是,对于你的第一款游戏,我会说不要过于担心优化,一开始就要简单。 随着您的学习,您将了解以后可以修剪/更改的内容。 It depends a lot on what you ...
-
如果你想像你说的那样滚动它,你可以通过几种方式实现这一点,而无需退出Unity。 例如,这里有一些: 在立方体中使用Animator组件并应用预制动画(通过动画窗口在Unity中制作,只需更改变换旋转属性) 使用物理学来施加恒定的旋转力(扭矩) 使用脚本来修改每个帧更新(c#或javascript)上的变换旋转属性 可能存在更多,但这些是最简单和最简单的。 如果我选择一个,Animator + Animations将是我的选择。 还要记住,当在场景中的多个实例(大量立方体)上使用时,此组件(Animator ...
-
Mecanim执行人形动画的重定向 ,因此对于特定情况的关注,您应该能够在不同模型上使用相同的装备和动画片段集。 对于抓住家具的问题,您不需要操纵物体。 您可以使用IK精确地将角色的手移向目标对象,然后将其父级添加到层次结构中的相对关节。 Mecanim performs retargeting of humanoid animations, so for what concern that specific case, you should be able to use the same rig and ...
-
大家。 经过一个早晨的研究,我发现了一个完美解决我的问题的好视频。 ( https://www.youtube.com/watch?v=5GbDkqw0U9Y )事实上,问题来自于Blender的输入设计,它使用“duplivert”技术来构建模型。 everyone. After one more morning's research, I've found a great video that perfectly resolve my problem. (https://www.youtube.com/ ...
-
发现你去: 文件/导出并选择 Found out you go to : FILE/Export and choose
-
一种解决方案是在没有按下任何移动键时使其播放偶像动画。 if(Input.GetKey ("left")){ transform.position.x = transform.position.x - 0.1; animation.Play("walking"); } if(!Input.GetKey ("left")){ animation.Play("idle"); } 此外,动画师应该是动画。 One solution would be to make it play the idol anima ...