小编rma*_*ado的帖子

当路径长度变化时,保持stroke-dasharray一致

我有一个由用户绘制的路径,使用D3.js.

我想在我的用户绘制路径上定义一个dasharray,但是,当它改变其形状和长度时,破折号表现不一致,并且间隙在移动并变小.

这是一个codepen:

https://codepen.io/Richacinas/pen/YjXpBE

随意分叉..绘制用户路径的功能是这样的:

DrawItGraph.prototype.draw = function() {
    ...

    var pos = this.d3.mouse(event.target)
    if (pos[1] > this.chartHeight) return

    var date = this.clamp(this.middleValue + 2629743, this.maxValue, this.convection.x.invert(pos[0]))
    var value = this.clamp(0, this.convection.y.domain()[1], this.convection.y.invert(pos[1]))

    this.userData.forEach(function (d) {
        if (Math.round(Math.abs(d.date - date) / 60000000) < 50) {
            d.value = value
            d.defined = true
        }
    })

    this.yourDataSel.at({d: this.line.defined(this.format('defined'))(this.userData)})

    if (this.d3.mean(this.userData, this.format('defined')) === 1) {
        this.graphCompleted = true
    }
}
Run Code Online (Sandbox Code Playgroud)

我怀疑我必须根据路径长度动态改变stroke-dashoffset和/或stroke-dasharray,但是,我不知道正确的公式是什么...

非常感谢

javascript svg d3.js

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

FFMPEG - 获取创建和/或修改日期

我正在努力从我服务器上托管的MP4文件中获取修改日期.

我尝试了以下库:

ffmpeg -i video.mp4
Run Code Online (Sandbox Code Playgroud)

没有运气.我得到的只是持续时间和其他一些领域,但我无法获得修改日期.我也尝试了ffprobe,它也不存在.

有什么建议??

非常感谢

mp4 ffmpeg html5-video

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

标签 统计

d3.js ×1

ffmpeg ×1

html5-video ×1

javascript ×1

mp4 ×1

svg ×1