# Sketching: Flying Lines

**URL:** <https://racket.discourse.group/t/sketching-flying-lines/580>\
**Category:** Show & Tell\
**Created:** [January 16, 2022, 7:08pm UTC](https://racket.discourse.group/t/sketching-flying-lines/580 "2022-01-16T19:08:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [January 16, 2022, 7:08pm UTC](https://racket.discourse.group/t/sketching-flying-lines/580/1 "2022-01-16T19:08:10Z")

</div>

![flying-lines](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/7439da536569e08b106541fe7142d0fa7c15df9f.gif)

```scheme
#lang sketching
; Line segments with start and end points on a Lissajous curve.

(define fr 30) ; frame rate

(define A 1)
(define B 1)
(define a 3.) ; experiment with different 
(define b 2.) ; values for a, b and δ
(define δ (* 0.5 π))  
  
(define (lissajous t)
  (define x (* A (sin (+ (* a t) δ))))
  (define y (* B (sin (* b t))))
  (vector x y))

(define (setup)
  (size 600 600)
  (:= A (* 0.5 width))
  (:= B (* 0.5 height))
  ; fill and text color
  (fill "black")
  ; color mode
  (color-mode 'hsb 100) ; hsb = hue, saturation, brightness
  ; our expected frame rate (actual might be lower)
  (frame-rate fr))
  
(define (draw)
  (background "white")
  ; Put (0,0) in the middle
  (translate (* 0.5 width) (* 0.5 height))
  ; Time
  (define t frame-count)
  ; We are going to draw n line segments.
  (define n 20)
  ; A line segments begins at P and ends at Q.
  (define P (for/vector ([i n]) (lissajous (/ (+ t i 0.) fr))))
  (define Q (for/vector ([i n]) (lissajous (/ (+ t i 20.) fr))))
  (for ([i n])
    (define Pi P[i])
    (define Qi Q[i])
    (stroke (+ (* 2 t) ; time shifts the hue
               (* 5 i)) ; each line get its own hue
            50 80)
    (stroke-weight 2)
    (line Pi[0] Pi[1] Qi[0] Qi[1])))

```

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [January 16, 2022, 9:58pm UTC](https://racket.discourse.group/t/sketching-flying-lines/580/2 "2022-01-16T21:58:40Z")

</div>

I think you need to submit this as your entry!

---

<div class="post-metadata">

**Author:** ![joskoot](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/joskoot/32/1964_2.png) [@joskoot](https://racket.discourse.group/u/joskoot)\
**Post date:** [January 16, 2022, 10:40pm UTC](https://racket.discourse.group/t/sketching-flying-lines/580/3 "2022-01-16T22:40:17Z")

</div>

Very nice.

Where can I find #lang sketching ?

Jos

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [January 16, 2022, 11:20pm UTC](https://racket.discourse.group/t/sketching-flying-lines/580/4 "2022-01-16T23:20:12Z")

</div>

Hi @joskoot

More information about sketching can be found at the repo

[https://github.com/soegaard/sketching](https://github.com/soegaard/sketching)

best

Stephen

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [January 17, 2022, 7:47am UTC](https://racket.discourse.group/t/sketching-flying-lines/580/5 "2022-01-17T07:47:23Z")

</div>

The reference is here:  
[2&nbsp;Reference](https://soegaard.github.io/sketching/Reference.html)

Thank you for letting me use `noise`. The noise functions are available as `noise` and `simplex-noise`.  
I see that I forgot to add them to the documentation.

Can I persuade you to comment on this issue?

> <https://github.com/soegaard/sketching/issues/58>
>
> @all-contributors please add @joskoot for code

It will it easier to add you to the list of contributors.
