Clo*_*ign 6 css svg css-transitions svg-animate svg-sprite
TL; 博士
symbol-svg-sprite使用创建并插入其片段后svg+use,我想css-variables在 #ShadowDOM 中使用 SVGpresentation attributes来更改例如stroke-width="0"在 中stroke-width="5",并且transition property必须工作,问题是这些stroke-width值在任何事件(:悬停:活动:焦点)下都有效,transition但没有。
<svg style='display:none;' xmlns="http://www.w3.org/2000/svg">
<symbol id='symbol-id' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23 20">
<path style='transition-duration: var(--custom-duration); transition-property: var(--custom-property);' stroke="var(--custom-stroke)" stroke-width="var(--custom-stroke-width)" fill="cyan" d="long..."
</symbol>
</svg>
Run Code Online (Sandbox Code Playgroud)
<svg>
<use class="use-class" xlink:href="../transition-error.svg#symbol-id"></use>
</svg>
Run Code Online (Sandbox Code Playgroud)
svg
outline 1px solid black
width 250px
height 250px
.use-class
--custom-stroke-width 0
--custom-duration .5s
--custom-property all
.use-class:hover
--custom-stroke-width 2
--custom-stroke blue
--custom-duration 2500ms
--custom-property all
Run Code Online (Sandbox Code Playgroud)
当您将鼠标悬停在SVG容器中,变量的值更改和中风stroke-width 0顺利流入stroke-width 2-出现这种情况,但没有 transition,虽然transition分配给<path>这可以被看作
DevTools
<svg>—<svg> <path d="..."> </svg><object></object>带有外部 css 的标签可以在 CodePen 上看到演示
如何CSS transition为之工作external-svg-sprites?我厌倦了与此斗争:(
更新截至 2018 年 9 月,除了 Firefox 之外,这仍然无法在所有地方工作
经过研究,发现这种行为是一个错误。
目前2018年3月11日我在Windows 7下测试的浏览器中,即:
不起作用并且是一个错误
除了
我将感谢那些补充有关以下工作状况信息的人: