Jump to content

Making an object invisible using the ‘transparent’ property: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
This snippet demonstrates how to connect different voices using ties. Normally, ties only connect two notes in the same voice. By introducing a tie in a different voice, and blanking the first up-stem in that voice, the tie appears to cross voices.
This snippet demonstrates how to connect different voices using ties. Normally, ties only connect two notes in the same voice. By introducing a tie in a different voice, and blanking the first up-stem in that voice, the tie appears to cross voices.


<lilypond version="2.24.0">
<lilypond version="2.24">
\relative {
\relative {
   \time 2/4
   \time 2/4
Line 20: Line 20:
     }
     }
   >>
   >>
}
\paper {
  line-width = 40\mm
  ragged-right = ##f
}
}
</lilypond>
</lilypond>
Line 27: Line 32:
[[Category:Simultaneous notes]]
[[Category:Simultaneous notes]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 09:11, 10 December 2025

Setting the transparent property will cause an object to be printed in “invisible ink”: the object is not printed, but all its other behavior is retained. The object still takes up space, it takes part in collisions, and slurs, ties and beams can be attached to it.

This snippet demonstrates how to connect different voices using ties. Normally, ties only connect two notes in the same voice. By introducing a tie in a different voice, and blanking the first up-stem in that voice, the tie appears to cross voices.

\version "2.24"

\relative {
  \time 2/4
  <<
    {
      \once \hide Stem
      \once \override Stem.length = #8
      b'8 ~ 8\noBeam
      \once \hide Stem
      \once \override Stem.length = #8
      g8 ~ 8\noBeam
    }
    \\
    {
      b8 g g e
    }
  >>
}

\paper {
  line-width = 40\mm
  ragged-right = ##f
}