-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Left to right rendering effect #263
Comments
Makes sense. I get the idea... Would you be interested in implementing it? Should be relatively easy to use |
Yep, PR incoming :^) It was relatively easy using the |
I was able to implement this by extending When I instantiate an object of the class mentioned above, I pass in the text I want to be printed one character at a time, and save the state of how much of that text has been consumed inside an instance attribute, each time The API to use this class looks similar to this:
@peterbrittain What do you think about the implementation? I can work on creating a PR based on the fixes / API changes that you suggest. Also, I'm not sure how it should work with Should it also have an option to print the text all at once instead of one character at a time? Or should that be left to another |
Thanks @vinayak-mehta . That looks great! Sorry for the delay... I've been thinking about the best way to handle these things. After much musing, I think that it makes most sense for this to be a chained renderer that takes another renderer as input and gradually displays the content of that renderer using similar logic to your existing renderer. Key benefit is that this allows more composition (e.g. for another renderer that supports coloured text, which could be the existing This slightly complicates your simple case (just type some pre-defined text), but only by adding one more function call. For example:
What do you think? Is that worth the change to your code? BTW - I don't think we should worry about FigletText. Frankly, doing that a letter at a time will require detailed knowledge of the figlet font and so will be a separate custom renderer (which we can worry about another day). |
@peterbrittain Sorry for the late reply, this week has been hectic but I'm planning to work on this over the weekend!
This is a great suggestion and makes a lot of sense, I hadn't thought about this. A future syntax highlightning renderer would be awesome! Can you give me some pointers on how to make something like syntax highlighting work? Right now I'm using
The suggestion makes a lot of sense. I guess instead of extending
👍 |
@vinayak-mehta I'm not quite sure what you're getting at for possible implementation... Let me try to elucidate what I meant. Have a look at the To create a syntax colouring option, I suggest we create a renderer that can use a parser to convert a blob of text into text/colour map. The next step would be to create a pygments parser to use in that renderer. |
Thanks for the pointer! I'll have to look into the Rainbow renderer and learn how color maps work. I took a look at the I'll try to work on the On a separate note, would you like a PR to add a |
Thanks for the offer, but I don't think we should add more attributes. I've tried to keep asciimatics limited to stuff that you can do in all environments and deliberately avoided the less well supported ones. In the case for italics, it is only possible to do that in recent builds of Windows 10 (that support ansi escape codes). It might make sense to try that out once I have added support for that screen type, but not just yet. |
Makes sense 👍 Sorry for being inactive on the implementation. I've been busy with some other deadlines + a medical emergency at home. I will get back to this as soon as I can find time. |
NP. Real life always comes first... |
This issue has various ideas in it, which are still worth doing at some point. For now I just wanted to flag that the AnsiArtPlayer and AsciinemaPlayer renderers may do what you want in some cases. |
Is your feature request related to a problem? Please describe.
I would like for an effect to render text (or ASCII characters) from left to right, like it's being typed out.
Describe the solution you'd like
Similar to the mirage effect (where text can be rendered one character at a time, only randomly), it would be cool to have text rendered one letter at a time from left to right, so it appears to be typed in real-time.
The text was updated successfully, but these errors were encountered: