Scrolling Text using Paint Routine
-
How can I make a scrolling text using Paint Routine? I would like to display Artist credits by it.
Content.makeFrontInterface(500, 400); const var Panel1 = Content.getComponent("Panel1"); Panel1.setPaintRoutine(function(g) { g.setColour(Colours.peru); g.drawAlignedText("CREDITS",[0,0,100,10],"centred"); g.setColour(Colours.whitesmoke); g.drawAlignedText("Ramu",[0,0,100,40],"centred"); g.drawAlignedText("Panchu",[0,0,100,70],"centred"); g.drawAlignedText("Hari",[0,0,100,100],"centred"); }); Panel1.setTimerCallback(function() { // How to scroll text? });
-
You can just adjust the Y position of each line every time the timer updates. Unless you want it to loop back around, in which case that's a bit harder :)
var textYPosition = 0; Panel1.setPaintRoutine(function(g) { g.setColour(Colours.peru); g.drawAlignedText("CREDITS",[0,textYPosition,100,10],"centred"); g.setColour(Colours.whitesmoke); g.drawAlignedText("Ramu",[0,textYPosition + 20,100,40],"centred"); g.drawAlignedText("Panchu",[0,textYPosition + 40,100,70],"centred"); g.drawAlignedText("Hari",[0,textYPosition + 60,100,100],"centred"); }); Panel1.setTimerCallback(function() { textYPosition += 20; });
I'm not sure if you'll need to use the Panel1 timer callback or make a generic timer.
-
Actually I am trying to make this type of scrolling text....
-
@Tania-Ghosh Yes:
https://i.gyazo.com/80dd8ce93742c3a115ddc2e2eb62aadf.mp4
Content.makeFrontInterface(600, 500); const var Panel1 = Content.getComponent("Panel1"); var yOffset = 0; const var names = ["D. Healey", "iamlamprey", "Tania Ghosh", "Rudra Ghosh", "dustbro", "Christoph Hart", "ulrik", "Orange", "etc"]; Panel1.setPaintRoutine(function(g) { g.setColour(Colours.lightgrey); g.drawRoundedRectangle([0, 0, this.getWidth(), this.getHeight()], 6.0, 2.0); g.setFont("Arial", 14.0); for (n=0; n<names.length; n++) g.drawAlignedText(names[n], [0, (this.getHeight() / names.length * n) + yOffset, this.getWidth(), 20], "centred"); }); const var textTimer = Engine.createTimerObject(); textTimer.setTimerCallback(function() { yOffset -= 1; Panel1.repaint(); }); textTimer.startTimer(100);
H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t1TdfdioJMybacNf9VXIgcJ2ZtGPytFZwKzc5DGXtutPZiYy.MYeDCtYOx0VIftc9dj+9k6NYNwe766dioFF435bgCBkTz.Xn9yhUQOXLKLrWFkyI56tAvrpap.HkdmQslwohLldR0UgeFqE7W3ZgfEEQ+Dg6SbGvzgIKFu0V.dgLy+23c5R1FtGNZDLInDrq5162V1MpeFPwN7O9DhVwfZE2SySGBS4Co.RDPETlolnlop0R6anMQlgTQTAw+BOSEFXnclJLXlPTJITIecns0vrF+QEb.LIJ9Bl0bOwPiCPEC..6b8a6iRgut30gglPwl.1WrMcVBa99kvlsVBad5RXy1KgM+vRXyy9n1X9vt8x0xTaaBvXvgEipbbNTPfprhJRz+EIBWzD
-
@iamlamprey Wow... Superb (y) .. That's what I was looking for. Thank you :)