Skip to content

Rotate Content #694

Closed Answered by johannes-wolf
Loewe1000 asked this question in Q&A
Discussion options

You must be logged in to vote

Example:

#import "@preview/cetz:0.2.2"

#let draw-bike(from, to) = {
  import cetz.draw: *

  group(ctx => {
    let (_, abs-pos, abs-dir) = cetz.coordinate.resolve(ctx, from, to)
    let d = cetz.vector.scale(cetz.vector.norm(cetz.vector.sub(abs-dir, abs-pos)), .5)

    line((rel: cetz.vector.scale(d, -1), to: from), (rel: d, to:  from),
      stroke: red)
    
    // HERE: Pass a second coordinate to `angle:`
    content(from, angle: to, image("rad.svg", width: 1cm), anchor: "south")
  })
}

#cetz.canvas({
  import cetz.draw: *
  
  line((0,-1), (0, 5), mark: (end: ">"))
  line((-1,0), (10, 0), mark: (end: ">"))

  catmull((0, 3), (3, 4), (6, 2.5), (9, 2), name: "slope")

  draw-bike("s…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Loewe1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #692 on September 06, 2024 13:10.