小编Cra*_*aig的帖子

多个SVG clipPath在不同位置使用元素

直到最近,在Firefox(v25)中正确呈现了以下SVG代码,它怎么也不再(v33).我测试过的所有其他浏览器(Chrome 33,Safari 6,IE 10).

http://jsfiddle.net/9btoveeL/

<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="1000px" width="1000px" y="0px" x="0px" version="1.1">
<defs>
    <clipPath id="clip1">
        <rect height="100" width="10" y="0" x="0"/>
    </clipPath>
    <clipPath id="clip2">
        <rect height="100" width="10" y="0" x="10"/>
    </clipPath>
    <clipPath id="clip3">
        <rect height="100" width="10" y="0" x="20"/>
    </clipPath>
    <symbol id="fill_texture">
        <g>
            <rect height="10" width="10" x="0" y="0" fill="#ff0000"/>
            <rect height="10" width="10" x="3" y="5" fill="#0ff000"/>
            <rect height="10" width="10" x="6" y="10" fill="#0000ff"/>
            <rect height="10" width="10" x="9" y="15" fill="#ffff00"/>
            <rect height="10" width="10" x="12" y="20" fill="#ff00ff"/>
            <rect height="10" width="10" x="15" y="25" fill="#00ffff"/>
        </g> 
    </symbol> …
Run Code Online (Sandbox Code Playgroud)

svg clipping

3
推荐指数
1
解决办法
2375
查看次数

设置 SVG 可见性动画的关键时间

我正在尝试使用 SVG 创建一个闪烁的闪电图标,但我无法让 keyTimes 工作。目的是设置一个更真实的闪光灯,在打开和关闭之间具有不均匀的步骤,但为了这个问题的目的,我简化了 SVG,如下所示

<g id="lightning">
    <polygon fill="#FFD744" points="55.724,91.297 41.645,91.297 36.738,105.038 47.483,105.038 41.622,124.568 62.783,98.526 51.388,98.526" />

    <animate attributeType="CSS"
         attributeName="visibility"
         from="hidden" 
         to="hidden"
         values="hidden;visible;hidden"
         keyTimes="0; 0.5; 0.6"
         dur="2s"
         repeatCount="indefinite"/>


</g>
Run Code Online (Sandbox Code Playgroud)

但是,如果我有 keyTimes 属性,所有闪烁都会停止,并且闪电在屏幕上是静态的。如果我删除该属性,闪烁会很慢,因为循环有两秒长,而且它只是轻轻地来回振荡。

animation svg

3
推荐指数
1
解决办法
1486
查看次数

角度日期管“YYYY”与“完整”不匹配

我正在尝试从 API 提供的简单字符串中打印月份和年份。到目前为止,它是正确的,但Jan 1st 2022它打印的是 2021。我正在新西兰运行它,目前在新西兰运行GMT+12,但将+13在每年 1 月 1 日运行

正如下面的示例所示,它在 2020 年和 2023 年是正确的,但在 2021 年和 2022 年则不然

输入

{{ '2020-01-01' | date : 'full' }} | {{ '2020-01-01' | date : 'MMM YYYY'}}
{{ '2021-01-01' | date : 'full' }} | {{ '2021-01-01' | date : 'MMM YYYY'}}
{{ '2022-01-01' | date : 'full' }} | {{ '2022-01-01' | date : 'MMM YYYY'}}
{{ '2023-01-01' | date : 'full' }} | {{ …
Run Code Online (Sandbox Code Playgroud)

angular

3
推荐指数
1
解决办法
2862
查看次数

Symfony2验证将无效整数更改为0

我在表单中添加了验证,发现在某些情况下,它正在丢失我提供的无效数据并保存0.底部的输出显示,如果我将纬度发布为' zzzzzz',这显然不是数字,也不在-90和90之间,则表单被声明为有效并与值一起保存0.

鉴于我已声明输入必须是数字,怎么会发生?

ProxyType.php buildForm():

$builder
        ->add('siteName', null, array('label' => 'Site name'))
        ....
        ->add('latitude', 'number', array('label' => 'Latitude'))
        ->add('longitude', 'number', array('label' => 'Longitude'))
        ....
    ;
Run Code Online (Sandbox Code Playgroud)

ProxyController.php createAction:

    ....
    $postData = $request->request->get('niwa_pictbundle_proxytype');
    $this->get('logger')->info('Posted latitude = '.$postData['latitude']);

    $form    = $this->createForm(new ProxyType(), $entity);
    $form->bindRequest($request);

    if ($form->isValid()) {
        $this->get('logger')->info('Form declared valid : latlong ('.$entity->getLatitude().','.$entity->getLongitude().')');
        ....
Run Code Online (Sandbox Code Playgroud)

validation.yml:

Acme\PictBundle\Entity\Proxy:
properties: 
    longitude:
        - Min: { limit: -180 }
        - Max: { limit: 180 }
    latitude:
        - Max: { limit: 90 }
        - Min: { …
Run Code Online (Sandbox Code Playgroud)

symfony

2
推荐指数
1
解决办法
2031
查看次数

Swift可选和double的默认值

我试图根据可选响应中的double设置文本提供程序的值.我觉得应该有一个更短的方法来做到这一点,但当我尝试使用默认值时,它坚持默认必须是一个双,我想要一个字符串来替换它.

伪代码:

If we have a current value 
    use it
 else
    use "--"
Run Code Online (Sandbox Code Playgroud)

我认为会起作用

let currentValue = uvProduct.currentValue()?.value
currentTextProvider = CLKSimpleTextProvider(text: String( currentValue ?? "--" ))
Run Code Online (Sandbox Code Playgroud)

目前的尝试

let currentValue = uvProduct.currentValue()?.value
let currentTextProvider : CLKSimpleTextProvider

if (currentValue != nil){
    currentTextProvider = CLKSimpleTextProvider(text: String( currentValue! ))
} else {
    currentTextProvider = CLKSimpleTextProvider(text: "--")
}
Run Code Online (Sandbox Code Playgroud)

optional swift

0
推荐指数
1
解决办法
116
查看次数

标签 统计

svg ×2

angular ×1

animation ×1

clipping ×1

optional ×1

swift ×1

symfony ×1