Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

How about add a progress bar? #24

Closed
knktc opened this issue Jul 4, 2018 · 5 comments
Closed

How about add a progress bar? #24

knktc opened this issue Jul 4, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@knktc
Copy link

knktc commented Jul 4, 2018

Thank you for the awesome project!
How about add a progress bar to the recorded svg? It will show length of the animation.

adb_show.svg.zip

The attachment above is just a example, we manually add the progress bar to svg file.(sorry, I don't know how to attach svg file directly)

@vuuv
Copy link

vuuv commented Jul 4, 2018

In fact, we just add an animated rect element before </svg>.

here is the code snip:

  <rect width="0" height="2" fill="#ff5722">
    <animate attributeType="XML" attributeName="width" from="0" to="100%"
        dur="33333ms" begin="0ms;anim_last.end+0ms"/>
  </rect>
</svg>

just change attribute dur to a suitable time.

I recommend adding 2 new options:

-p show progress bar.
-P progress bar code. `%(total_ms)s' for total time spent, in milliseconds.

-P is used for customize, default value could be:

progress_bar = """
<rect width="0" height="2" fill="#ff5722">
    <animate attributeType="XML" attributeName="width" from="0" to="100%"
        dur="%(total_ms)s" begin="0ms;anim_last.end+0ms"/>
  </rect>"""

Thanks.

@nbedos
Copy link
Owner

nbedos commented Jul 4, 2018

Good idea! It requires reading an SVG file though, and that can't be done with the Python package I'm currently using for handling SVG (svgwrite). I'll probably have to replace it with lxml or something else first.

@nbedos nbedos added the enhancement New feature or request label Jul 4, 2018
@vuuv
Copy link

vuuv commented Jul 5, 2018

my friend @knktc share this svg to me. I must to say its a great creative!
I think it should has a progress bar, that more cool, so I learned svg animation yesterday and hacked a new file through Chrome and vim command.

customize code is optional. and I hav'nt find a better plan yet.
I just worry that my progress bar is so simple, and someone will wanna to prettify it.

@Earnestly
Copy link

Earnestly commented Jul 11, 2018

I'm not too familiar with svg, however instead of providing -P as @vuuv described, why not generalise the idea and provide a kind of --footer option which takes an arbitrary svg file and merges it at the end? This would probably provide for the majority of features people would like to have without ruining the simplicity of the tool itself.

On the other hand svg is already a standard format so it should be possible to external write tools to modify the file without needing to implement more and more in termtosvg itself (including the already mentioned --footer. This would be far more ideal in my opinion.

@nbedos
Copy link
Owner

nbedos commented Jul 29, 2018

This use case will be covered by SVG templates. See #53 for further discussion.

@nbedos nbedos closed this as completed Jul 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants