clip

Using CSS Clip with percentage

那年仲夏 提交于 2019-12-21 07:13:11
问题 I'm trying to display only the top half of an image and the bottom half of the same image in 2 separate divs. I've tried with the CSS property clip , but it doesn't seem to support % as a unit. Is it just me? Do you have a solution for displaying only a half of an image? 回答1: Update (after 5+ years): The CSS clip property is now deprecated. Consider using clip-path instead (allowing for a non-JS solution), which allows you to specify shapes with percentages. Example: /* Bottom half of image *

Using CSS Clip with percentage

折月煮酒 提交于 2019-12-21 07:13:04
问题 I'm trying to display only the top half of an image and the bottom half of the same image in 2 separate divs. I've tried with the CSS property clip , but it doesn't seem to support % as a unit. Is it just me? Do you have a solution for displaying only a half of an image? 回答1: Update (after 5+ years): The CSS clip property is now deprecated. Consider using clip-path instead (allowing for a non-JS solution), which allows you to specify shapes with percentages. Example: /* Bottom half of image *

Android Drag and Drop getClipData returns always null

送分小仙女□ 提交于 2019-12-20 20:36:49
问题 I am designing a drag and drop operation but I don't know how to access my data. Has anyone experience with Clip Data objects? Here is my code: Starting the drag and drop: ClipData dragData= ClipData.newPlainText("my", "test") ); v.startDrag(dragData, new MyDragShadowBuilder(v), v, 0); Listening on the events: case DragEvent.ACTION_DROP:{ if (event.getClipDescription().getLabel().equals("my")) Log.d("myLog","Data:"+event.getClipData()+" "+event.getClipData().getItemCount()); 回答1: not in every

Android Drag and Drop getClipData returns always null

最后都变了- 提交于 2019-12-20 20:36:35
问题 I am designing a drag and drop operation but I don't know how to access my data. Has anyone experience with Clip Data objects? Here is my code: Starting the drag and drop: ClipData dragData= ClipData.newPlainText("my", "test") ); v.startDrag(dragData, new MyDragShadowBuilder(v), v, 0); Listening on the events: case DragEvent.ACTION_DROP:{ if (event.getClipDescription().getLabel().equals("my")) Log.d("myLog","Data:"+event.getClipData()+" "+event.getClipData().getItemCount()); 回答1: not in every

Java Clip (Sound / Audio) Memory Leak after closing with close()

北战南征 提交于 2019-12-20 06:12:59
问题 The following code creates a new audio clip, plays it, sleeps for 3 seconds and then closes it when it is finished playing. Despite the call to close(), I am watching the memory usage of the jvm go up by the size of the sound clip every time the while loop is run. I'm participating in a game coded in java, and am handling the sound. I cannot have the memory i'm using increase everytime a sound is played. What am I missing? import java.io.File; import javax.sound.sampled.*; public class

Clip-path SVG polygon Internet Explorer

萝らか妹 提交于 2019-12-20 04:26:09
问题 This code does not work in IE, I need to use it because I have to make an arrow that follows a point on the map. div { width: 100%; height: 100%; position: absolute; top: 0px; right: 0px; background: red; clip-path: url(#cliparrow); -webkit-clip-path: polygon(777px 285px, 0px 303px, 777px 315px); } svg { width: 0; height: 0; float: left; position: absolute; } <div></div> <svg height="0" width="0"> <defs> <clipPath id="cliparrow"> <polygon points="777,285 0,303 777,315" ></polygon> </clipPath>

Animate the clip: rect property?

怎甘沉沦 提交于 2019-12-19 00:57:17
问题 I want to animate the css property clip: rect with jQuery's .animate() but can't find if this is possible anywhere. Have tried: $(".img1").animate({ clip: "rect(1px, 945px, 499px, 1px)" },300); without any luck. Does anyone know? Thanks 回答1: Anything is possible, but there probably are easier ways to do what you want without using clip , but if you use jQuery animate's fx.step function, you can animate anything, but you need to do some calculations to figure out values and stuff, but it goes

Play audio clips sequentially in JApplet

≯℡__Kan透↙ 提交于 2019-12-18 09:26:57
问题 I'm trying to play audio clips sequentially, but they all play at the same time. I'm not sure what I am doing wrong. Could you Please help. I'm using JFrame, and this code is giving runtime error. AudioClip click; AudioClip click2; URL urlClick1 = DisplayMath.class.getResource("number11.wav"); click = Applet.newAudioClip(urlClick1); URL urlClick2 = DisplayMath.class.getResource("number12.wav"); click2 = Applet.newAudioClip(urlClick2); click.play(); click.notify(); try { click2.wait(); } catch

Play audio clips sequentially in JApplet

六月ゝ 毕业季﹏ 提交于 2019-12-18 09:25:52
问题 I'm trying to play audio clips sequentially, but they all play at the same time. I'm not sure what I am doing wrong. Could you Please help. I'm using JFrame, and this code is giving runtime error. AudioClip click; AudioClip click2; URL urlClick1 = DisplayMath.class.getResource("number11.wav"); click = Applet.newAudioClip(urlClick1); URL urlClick2 = DisplayMath.class.getResource("number12.wav"); click2 = Applet.newAudioClip(urlClick2); click.play(); click.notify(); try { click2.wait(); } catch

How to round out corners when using CSS clip-path

二次信任 提交于 2019-12-18 05:43:16
问题 I want to be able to round out the 3 leftmost corners on this shape that I have created, any idea how that can be done? div { position: absolute; z-index: 1; width: 423px; height: 90px; background-color: #b0102d; color: white; right: 0; margin-top: 10vw; -webkit-clip-path: polygon(100% 0%, 100% 50%, 100% 100%, 25% 100%, 0% 50%, 25% 0%); clip-path: polygon(100% 0%, 100% 50%, 100% 100%, 25% 100%, 0% 50%, 25% 0%); } <div></div> 回答1: I've recently found success experimenting with approaches like