Rotate Content #694
-
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            johannes-wolf
          
      
      
        Sep 6, 2024 
      
    
    Replies: 2 comments
-
| 
         Cetz'   | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| 
         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("slope.1", "slope.1.1")
  draw-bike("slope.3", "slope.3.05")
  draw-bike("slope.5", "slope.5.1")
  draw-bike("slope.8", "slope.8.1")
}) | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        Loewe1000
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    

Example: