One line of text that stays on one line: when it is wider than width it slides back and forth inside a clipped window (marqueeOffset), driven by update(dt). Under reduced motion it holds still, cut short with an ellipsis, instead of moving.
width
marqueeOffset
update(dt)
import { MarqueeLabel } from '@datamoc/mwg/two-d/ui';const title = new MarqueeLabel({ width: 160, text: 'A very long track title that cannot fit' });title.update(1 / 60); // once a frame from the scene Copy
import { MarqueeLabel } from '@datamoc/mwg/two-d/ui';const title = new MarqueeLabel({ width: 160, text: 'A very long track title that cannot fit' });title.update(1 / 60); // once a frame from the scene
where the text is shifted to now (0 until it has waited out its first pause)
Protected
the text's width in pixels; its own method so a test can supply it
One line of text that stays on one line: when it is wider than
widthit slides back and forth inside a clipped window (marqueeOffset), driven byupdate(dt). Under reduced motion it holds still, cut short with an ellipsis, instead of moving.Example