- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在缩放仅用于 clip-path
的内联 SVG 时遇到问题。被剪裁的元素的宽度为150px
,高度为150px
。这是我尝试解决此问题的第 2 天,但我感觉就像在原地打转。
在 Chrome(最新版)中,SVG 的正确宽度为 150px
。
在 Opera(最新版)中,SVG 的正确宽度为 150px
在 Firefox (54.0.1) 中,SVG 没有正确的宽度。
body {
background: #333;
}
.image {
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
clip-path: url(#clipPath);
height: 150px;
left: 0;
position: absolute;
top: 0;
width: 150px;
}
#clipPath {
transform: scale(2.63, 2.63);
}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 1 1">
<defs>
<clipPath id="clipPath" clipPathUnits="objectBoundingBox">
<!-- <path d="M28.487,10.847C21.13-6.364,0.18-2.348,0.08,17.628C0,33.538,27.699,46.784,28.531,49.636C29.285,46.675,57,33.785,56.92,17.509C56.823-2.517,35.506-5.678,28.487,10.847z">-->
<path d="M0.189913333333,0.0723133333333C0.140866666667-0.0424266666667,0.0012-0.0156533333333,0.000533333333333,0.11752C0,0.223586666667,0.18466,0.311893333333,0.190206666667,0.330906666667C0.195233333333,0.311166666667,0.38,0.225233333333,0.379466666667,0.116726666667C0.37882-0.01678,0.236706666667-0.0378533333333,0.189913333333,0.0723133333333z">
</clipPath>
</defs>
</svg>
<div class="image" style="background-image: url('https://images.unsplash.com/photo-1468793195345-d9d67818016d?dpr=1&auto=format&fit=crop&w=1500&h=994&q=80&cs=tinysrgb&crop=');"></div>
最佳答案
应用 transform
使用属性,而不是通过 CSS 在 Firefox 中修复此问题。
body {
background: #333;
}
.image {
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
clip-path: url(#clipPath);
height: 150px;
left: 0;
position: absolute;
top: 0;
width: 150px;
}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 1 1">
<defs>
<clipPath id="clipPath" clipPathUnits="objectBoundingBox" transform="scale(2.63, 2.63)">
<path d="M0.189913333333,0.0723133333333C0.140866666667-0.0424266666667,0.0012-0.0156533333333,0.000533333333333,0.11752C0,0.223586666667,0.18466,0.311893333333,0.190206666667,0.330906666667C0.195233333333,0.311166666667,0.38,0.225233333333,0.379466666667,0.116726666667C0.37882-0.01678,0.236706666667-0.0378533333333,0.189913333333,0.0723133333333z">
</path>
</clipPath>
</defs>
</svg>
<div class="image" style="background-image: url('https://images.unsplash.com/photo-1468793195345-d9d67818016d?dpr=1&auto=format&fit=crop&w=1500&h=994&q=80&cs=tinysrgb&crop=');"></div>
关于html - 如何正确调整 svg clipPath 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45543633/
我有一台运行 Android 4.2.2 的 ASUS Nexus 7 我的应用程序在运行以下代码时在 sk_malloc_flags 中生成一个 SIGSEGV: static Picture cr
不确定我是否正确地制定了标题,但问题来了。 我有一个云状的 SVG 路径,我想在 CSS 中使用 clip-path属性。 当我在 HTML 中添加一个 SVG 元素并定义 时使用该路径,浏览器将
我正在尝试使用 svg 创建一个 clipPath 图像。我正在尝试使用 SVG 的 native clipPath 方法来完成它。 My problem is that if I use a pat
如何创建上面的自定义clipPath小部件? (我附上了截图) 我尝试过,但输出不准确 Clipper 类 class MessageClipper extends CustomClipper {
我遇到了这个错误。 Assertion failed: org-dartlang-sdk:///flutter_web_sdk/lib/_engine/engine/surface/path/path
我的CustomClipper从左上角开始,但是,我希望它从右上角开始。 这是我的代码: 快船队: class ProfileBarClipper extends CustomClipper {
这是 this 的延续问题。 这是代码:Plunker 我现在想做的是更新 clipPath 与其他所有内容一致,我无法安静地弄清楚 我尝试了各种方法让它以平滑的方式转换,但每次都得到相同的结果。pl
我想生成一个小部件,其剪辑路径与给定图像中的剪辑路径相似。我在这里谈论的是应用程序屏幕的白色部分,其中包含信息。 下面的代码是我在实验时尝试的,但失败了! Path getClip(Size siz
简而言之,我有一个使用 clipPath 屏蔽的图像,因此它可以在 IE 9+ 中工作。问题是我需要在悬停时隐藏蒙版以显示完整图像,然后在鼠标移开时重新应用。我现在拥有的脚本不起作用。笔在下面。我对
这个问题已经有答案了: 奥 git _a (1 个回答) 已关闭 7 年前。 我有一个图形,上面有三个折线图。 我在图表中添加了一个clipPath,覆盖了所有三个折线图。但每个折线图的顶部都被砍掉了
我想创建一个像这样的路径: 但实际结果边框不好: 现在我想知道如何使用 ClipPath 实现完全圆角。 代码是: class MyClipper extends CustomClipper {
我正在循环增加 clipPath 的大小。循环内部还有另一个循环,它创建了更多的 clipPaths,我用它来绘制降低的 alpha,以便获得过渡效果。但随着 clipPath 大小的增加,转换变得缓
向导, 我在处理 clippath 上的鼠标悬停事件时遇到了一些问题。出于某种原因,它没有触发,我认为这是因为元素正在剪裁 Dude 的图像。 我的目标是提醒悬停元素的用户标识(示例中的 1、2 或
我试图将一个带有 clipPath 的 div 放在页脚中另一个 div 的顶部。这是我要完成的工作的图像。从理论上讲,这听起来很简单,但我似乎在裁剪路径 SVG 的放置和缩放方面苦苦挣扎。 我为剪辑
我有一个 SVG 导航轮,我已经把它放在 jsfiddle SVG navigation wheel 上 这里是实际的 SVG 代码: wheelv2
我正在尝试创建一个 transparent arrow over an image通过 SVG 和 clipPath。这是 jsfiddle与工作解决方案。 当我尝试在我的 div 容器中应用此解决方
我在使用 Canvas clipPath 时收到 UnsupportedOperationException。 这发生在 HTC Sensation XE (4.0.3) 上。它在其他 4.0.3 设
我在 Canvas 上创建了一个圆形剪辑路径,并且有一列数字在 Canvas 上进行了动画处理,因此我看到数字在剪辑部分中进行动画处理并进行动画处理。这是裁剪代码: mClipPath.addCirc
对于我的生活,我无法弄清楚为什么 SVG 不会呈现以下图形: 我发现了以下两件事: 当裁剪路径为基本圆时,图像会被正确裁剪。 当未设置剪辑路径时,图像可以正确呈现。
我有一个布局,里面有几个 View ——工具栏、recyclerview 和几个分隔符(它们是简单的 View ,高度为 2dp,宽度为 match_parent)。我想在布局上放置一个 mask —
我是一名优秀的程序员,十分优秀!