我有一个参考图像,我想用SVG实现的效果.

在Photoshop中,可以通过使用100%不透明度并将混合模式设置为"倍增"来实现效果
颜色的十六进制值为:
红色:#EA312F,蓝色:#3A5BA6和重叠区域:#35111F
我已经尝试了许多使用SVG滤镜来实现类似效果的方法,但我很难理解混合模式如何计算值.

您可以在此JSBin http://jsbin.com/iPePuvoD/1/edit中查看每个SVG代码
我真的很难理解匹配垂直条蓝色和重叠区域颜色的最佳方法.
这些形状的每一个我也想利用动画库,如http://snapsvg.io/,所以我希望能单纯依靠过滤器,而不是裁剪或其它操作,以达到预期的效果-但我愿意接受建议.
实际上,最终尝试的SVG(4.)是这样的:
<svg viewBox="0 0 96 146" version="1.1" id="f-multiply-opacity" preserveAspectRatio="xMinYMin meet">
<defs>
<filter id="f_multiply" filterUnits="objectBoundingBox" x="0%" y="0%" width="100%" height="100%">
<feBlend in="SourceGraphic" mode="multiply"/>
<feBlend in="SourceGraphic" mode="multiply"/>
</filter>
</defs>
<g id="f_shape">
<rect x="0" y="0" width="96" height="32" fill="#EA312F" />
<rect x="0" y="50" width="96" height="32" fill="#EA312F" />
<rect x="0" y="50" width="32" height="96" opacity="0.8" fill="#3A5BA6" filter="url(#f_multiply)" />
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)
非常感谢有关这方面的一些建议,我已经在SVG上找到了一些很好的资源,但是这个领域似乎仍然很难获得好的信息.
谢谢!
我正在尝试使用记录的model.reload()函数轮询更多数据
App.ModelViewRoute = Ember.Route.extend({
actions: {
reload: function() {
this.get('model').reload();
}
}
});
Run Code Online (Sandbox Code Playgroud)
但是我收到一条错误消息说......
undefined is not a function TypeError: undefined is not a function
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来做到这一点,似乎我无法以这种方式从路线访问模型?
这是路由器
App.Router.map(function() {
this.route('video', { path: '/videos/:video_id' });
});
Run Code Online (Sandbox Code Playgroud)
这是路线
App.VideoRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('video', params.video_id);
},
actions: {
reloadModel: function() {
// PROBLEM HERE
// this.get('model').reload();
Ember.Logger.log('reload called!');
}
}
});
Run Code Online (Sandbox Code Playgroud)
这是模型
App.Video = DS.Model.extend({
title: DS.attr('string'),
status: DS.attr('string')
});
Run Code Online (Sandbox Code Playgroud)
和模板
<script type="text/x-handlebars" data-template-name="application">
<h1>Testing model reloading</h1>
{{#link-to "video" 1}}view …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Rails项目中使用Paperclip gem,因此遵循文档并首先使用Homebrew配方安装Imagemagick.
我在我的模型中添加了我的附件
has_attached_file :screenshot
Run Code Online (Sandbox Code Playgroud)
这工作正常,文件上传按预期运行
然后我想为此添加缩略图,所以再次按照文档添加到模型中
has_attached_file :screenshot,
:styles => { :medium => "300x300>",
:thumb => "100x100>" }
Run Code Online (Sandbox Code Playgroud)
此时上传不再有效
我查看了开发日志并注意到了这一点:
[32mCommand[0m :: identify -format %wx%h '/var/folders/ky/r5gsdhbn6yggbglsg727cc900000gn/T/stream20120302-60051-eh17n7.png[0]'
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError:
/var/folders/ky/r5gsdhbn6yggbglsg727cc900000gn/T/stream20120302-60051-eh17n7.png is not recognized by the 'identify' command.>
Run Code Online (Sandbox Code Playgroud)
在一些谷歌搜索之后,我认为将默认路径设置为环境变量可能是个问题
Paperclip.options[:command_path] = "/usr/local/bin/"
Run Code Online (Sandbox Code Playgroud)
但我检查了这是正确的使用
which identify
Run Code Online (Sandbox Code Playgroud)
它回归了这条道路
/usr/local/bin/identify
Run Code Online (Sandbox Code Playgroud)
正如所料
然后我尝试从命令行运行识别作为测试并得到此错误
dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /usr/local/bin/identify
Reason: Incompatible library version: identify requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0
Trace/BPT trap: 5 …Run Code Online (Sandbox Code Playgroud) 我正努力在Ember控制器中链接承诺.
此处还包括Ember代码:
App.IndexController = Ember.Controller.extend({
result_of_request: 'nothing',
first_request: function() {
// create a promise which is immediately resolved
var promise = new Ember.RSVP.Promise(function(resolve, reject){
resolve("first resolved");
});
// once the promise has resolved it should call the next function?
promise.then(function(data) {
// does log the data (has resolved)...
console.log("data is : " + data);
// but neither this
this.set("result_of_request", "first");
// nor this work
second_request();
});
}.property(),
second_request: function() {
console.log("second request");
}.property()
});
Run Code Online (Sandbox Code Playgroud)
任何意见,将不胜感激.
我觉得我已经很接近了,但遇到了困难,所以希望得到一些建议。
\n\n我的目标是能够使用 Chrome 运行我的系统测试并(截取屏幕截图)。
\n\n非 JS 测试通过使用:rack_test.
当由(我的 Chrome 设置)驱动时,我可以访问一条路径,截取显示此站点无法到达127.0.0.1 拒绝连接的:remote_browser屏幕截图。
另外值得一提的是,如果我尝试使用 vnc,则会open vnc://localhost:5900收到错误Connection failed to \xe2\x80\x9clocalhost\xe2\x80\x9d Unable to communications with \xe2\x80\x9clocalhost\xe2\x80\x9d。确保远程计算机可用并且防火墙未阻止屏幕共享。
我知道我\xe2\x80\x99m 缺少一些东西,但我不知道什么。
\n\n这是我的docker-compose.yml文件。I\xe2\x80\x99m 使用独立的 Chrome 映像。
version: \'3\'\n\nservices:\n\n app: &app\n build: .\n tmpfs:\n - /tmp\n\n backend: &backend\n <<: *app\n stdin_open: true\n tty: true\n volumes:\n - .:/usr/src/app:cached\n - rails_cache:/usr/src/app/tmp/cache\n - bundle:/usr/local/bundle\n - node_modules:/app/node_modules\n - packs:/app/public/packs\n env_file:\n - .env/development/database\n - .env/development/web\n environment:\n …Run Code Online (Sandbox Code Playgroud) 使用此方法适用于 Firefox/Chrome,但不适用于 Safari
let videoElement = document.querySelector(`#my-video`);
let track = videoElement.textTracks[0];
track.mode = 'hidden';
Run Code Online (Sandbox Code Playgroud)
我也试过::cuecss 选择器
::cue {
visibility: hidden;
}
Run Code Online (Sandbox Code Playgroud)
这会隐藏文本本身,但不会隐藏半透明的黑色背景。
当我在其他地方渲染内容时,我需要保持文本轨道,但我不希望它在视频中重复。
有没有办法做到这一点,我错过了什么吗?
javascript ×3
ember.js ×2
blending ×1
capybara ×1
colors ×1
css ×1
docker ×1
ember-data ×1
freetype ×1
homebrew ×1
imagemagick ×1
osx-lion ×1
paperclip ×1
promise ×1
selenium ×1
svg ×1
svg-filters ×1
video ×1