我有一个带边框的WPF项目使用以下样式.计划是当鼠标移过边界时使发光效果淡入淡出,并在离开时淡出淡出效果.
<Style x:Key="BorderGlow" TargetType="Border">
<Style.Resources>
<Storyboard x:Key="GlowOn">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(DropShadowEffect.Opacity)">
<SplineDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="GlowOff">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(DropShadowEffect.Opacity)">
<SplineDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Style.Resources>
<Setter Property="CornerRadius" Value="6,1,6,1" />
<Setter Property="BorderBrush" Value="{StaticResource SelectedBorder}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Background" Value="{StaticResource DeselectedBackground}" />
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
<Setter Property="TextBlock.Foreground" Value="{StaticResource SelectedForeground}" />
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="90"/>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="0" BlurRadius="8" Color="#FFB0E9EF"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource GlowOn}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard …Run Code Online (Sandbox Code Playgroud) 如何实现跨浏览器不透明度渐变(不是颜色渐变)?请参阅以下代码:
<div style="background-color:Red;display:block;height:500px;width:500px;filter:alpha(Opacity=100, FinishOpacity=0, Style=1, StartX=0, StartY=0, FinishX=0, FinishY=500)"></div>
Run Code Online (Sandbox Code Playgroud)
它在IE中运行良好,但在其他浏览器中没有,如firefox,safari ..等.什么是firefox的等效语法?请不要建议我使用渐变图像.
我有一个div设置透明与rgba并希望在该div上输入字段也具有透明背景.问题是输入字段背景不呈现透明.如果我opacity:0.8;在div上使用它,但是文本是透明的,那么它是有效的,所以我需要rgba.对于透明div rgba工作之外的第二个输入字段.
这是我的示例代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Insert title here</title>
<style type="text/css">
.term {
background-color: rgba(0,0,0,0.8);
color: #5fba3d;
width: 200px;
height: 100px;
}
input {
background-color: rgba(0,0,0,0.8);
color: #FFF;
border: none;
}
</style>
</head>
<body>
<div style="background-color:yellow; width:300px;">
<div class="term">
Input 1 <input type="text" value="Test" />
</div>
<br />
<input type="text" value="Input 2" />
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
谢谢!
拿但业
我想改变我在MATLAB中的图中绘制的线条的不透明度.我读过有关alpha和facealpha命令的某处,但无法确定如何使用它们.有人可以告诉我该怎么做?
我有NSPopover一个Cocoa应用程序,并且自狮子 - 它呈现为半透明,所以它覆盖的任何文本字段,表格等 - 这些现在显示在它下面,它看起来很奇怪.我检查了Apple的类引用文档,但似乎没有办法将其更改为不透明.似乎可用于指定外观的唯一两个属性值是NSPopoverAppearanceMinimal,和NSPopoverAppearanceHUD- 但这些值似乎都与alpha或不透明度无关.NSPopover通过覆盖drawRect 来制作不透明的唯一方法是什么?还是有人知道更好的方法吗?它似乎适用UIPopover于iOS,但不适NSPopover用于Cocoa ......
我已经有了一个以图像为背景的元素.是否有可能使文本最终淡出,就像在这个例子中一样
问题是背景图像已经有了渐变,我需要它上面的文字才能变得透明而不需要在后台进行任何修改.
它有可能做到吗?只是在CSS中,就像这张图片一样,所以我的意思是如果我放上<div>标签背景图片,我需要它从上到下透明.
我想创建类似于下图的内容:

我希望通过在适当的时候使我的视图不透明来提高性能.我有一个UIButton 在模拟器中显示红色 - 它只是按钮文本周围的红色,而不是整个框架.在故事板中,我启用了不透明并将背景颜色从清晰变为白色,但在模拟器中仍显示红色.
如何将其更改为绿色以使其完全不透明而不尝试使用透明度?
请注意,UILabel当您更改背景并且不透明为YES时,s为全绿色.
我在理解WPF中的不透明度时遇到了问题.我在下面发布了代码.我的问题是:
我希望,当我用颜色选择器窥探颜色时,黑色和50%的不透明度会渲染#7F7F7F,但我会得到#C2C2C2用于较小的TextBlock,而预期的#7F7F7F用于较大的字体和矩形.
问题已在https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/408部分询问,但未得到妥善解答.
任何帮助表示赞赏!
代码是:
<Window x:Class="WpfPlay.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfPlay"
mc:Ignorable="d"
Title="MainWindow" Height="800" Width="800" Background="White">
<Window.Resources>
<SolidColorBrush x:Key="ForeBrush" Color="Black" Opacity="0.5"/>
<SolidColorBrush x:Key="BackBrush" Color="White" Opacity="1.0"/>
<Style TargetType="TextBlock" x:Key="TextBlockStyle">
<Setter Property="Foreground" Value="{StaticResource ForeBrush}"/>
<Setter Property="Background" Value="{StaticResource BackBrush}"/>
<Setter Property="FontSize" Value="48"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
<Style TargetType="TextBlock" x:Key="TextBlockLargeStyle">
<Setter Property="Foreground" Value="{StaticResource ForeBrush}"/>
<Setter Property="Background" Value="{StaticResource BackBrush}"/>
<Setter Property="FontSize" Value="100"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
</Window.Resources>
<StackPanel Orientation="Vertical" Background="White">
<TextBlock Text="Click me" HorizontalAlignment="Center" Style="{StaticResource TextBlockStyle}" Margin="20"/>
<TextBlock Text="Click me" …Run Code Online (Sandbox Code Playgroud) 我的div列表越来越多。用户可以单击按钮以将新的div追加到底部。
该列表具有淡入淡出的动画,以便用户可以看到列表何时加载(它从服务器获取数据)。
当添加新行时,我不想使用淡入动画。
我尝试使用:
div:last-child {
animation: none;
}
Run Code Online (Sandbox Code Playgroud)
这仅在第一次添加新的div时有效。在以下所有附加内容上,无论如何都会应用动画。
请在下面查看此演示以了解我的意思:
div:last-child {
animation: none;
}
Run Code Online (Sandbox Code Playgroud)
function addRow(text) {
var d = document.createElement('div');
d.innerHTML = text;
var root = document.querySelector('main');
root.appendChild(d);
}Run Code Online (Sandbox Code Playgroud)
body {
background: #222;
}
main > div {
background: #444;
border: 1px solid green;
animation: fade-in 1s;
}
div:last-child {
background: #999;
animation: none;
}
@keyframes fade-in {
from { opacity: 0 }
to { opacity: 1 }
}Run Code Online (Sandbox Code Playgroud)
如何确保动画第一次在整个列表上运行,但在以后的添加中阻止它呢?
opacity ×10
css ×5
css3 ×2
html ×2
wpf ×2
alpha ×1
animation ×1
cocoa ×1
colors ×1
css-shapes ×1
effects ×1
fadeout ×1
html-input ×1
image ×1
ios ×1
javascript ×1
matlab ×1
nspopover ×1
objective-c ×1
plot ×1
rendering ×1
rgba ×1
storyboard ×1
transparency ×1
uibutton ×1