【问题标题】:Arc stroke smoothness圆弧行程平滑度
【发布时间】:2018-01-11 12:24:25
【问题描述】:

我目前正在用 quil 和 Daniel Shiffman's video tutorial 制作时钟,但我在绘制 arc 时遇到了麻烦,因为弧线的笔划比 line 差一点。

我不知道问题出在哪里,或者我的代码有问题,或者创建arc,所以,这是我的代码。

(defn draw-state [state]
  ; Clear the sketch by filling it with light-grey color.
  (q/background 150)

  (let [max-scale-h (- 1 (/ 1 12))
        max-scale-m (- 1 (/ 1 60))
        max-scale-s (- 1 (/ 1 60))]
    (let
      [
        h (q/map-range
           (if (> (q/hour) 12) (- (q/hour) 12) (q/hour)) 0 11 0 max-scale-h)
        m (q/map-range (q/minute) 0 59 0 max-scale-m)
        s (q/map-range (q/seconds) 0 59 0 max-scale-s)

        half-width (/ (q/width) 2)
        half-height (/ (q/height) 2)
        ]

      ;; let body
      (q/translate half-width half-height)
      (q/rotate (* -1 q/HALF-PI))

      (q/stroke-weight 8)
      (q/no-fill)

      (let [angle (* q/TWO-PI h)]
        (q/stroke 255 100 150)
        (q/arc 0 0 300 300 0 angle)

        (q/push-style)
        (q/rotate angle)
        (q/line 0 0 60 0)
        (q/pop-style))

      (let [angle (* q/TWO-PI m)]
        (q/stroke 150 100 255)
        (q/arc 0 0 280 280 0 angle)

        (q/push-style)
        (q/rotate angle)
        (q/line 0 0 70 0)
        (q/pop-style))

      (let [angle (* q/TWO-PI s)]
        (q/stroke 150 255 100)
        (q/arc 0 0 260 260 0 angle)

        (q/push-style)
        (q/rotate angle)
        (q/line 0 0 128 0)
        (q/pop-style)
        ))))

更新

我在设置中将(q/smooth) 添加为this stackoverflow post,但还是一样。

(defn setup []
  (q/smooth)
  (q/frame-rate 30)
  (q/color-mode :rgb)
  )

更新 我尝试在processing 中使用smooth,它可以工作,但与网络版本没有任何变化。

左边是网页,右边是处理

更新

Sad Developer 在 github 中创建问题以关注 the problem

【问题讨论】:

  • @cfrick :我添加了平滑,但它仍然是一样的
  • 我在 GitHub (github.com/quil/quil/issues/229) 上提交了一个问题,因为它不会发生在 Processing.js 或基于 JVM 的 Quil 中。
  • @SadDeveloper:谢谢
  • @Ampersanda 查看 GitHub 上的讨论 - 锯齿状是由 processing.js 中的更改引起的。

标签: clojure processing clojurescript quil


【解决方案1】:

升级到 quil 3.0.0 将解决此问题。 Quil 现在使用 p5js 而不是 processing.js,它没有锯齿线的问题。见http://quil.info/sketches/show/snippet_arc

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-30
    • 1970-01-01
    • 2019-02-17
    • 2012-08-21
    • 2020-05-07
    • 1970-01-01
    相关资源
    最近更新 更多