FYI, Word Clock works great for me on Raisins on OS X. Memory usage and CPU both seem modest and reasonable. Cool!

In principle, it ought to be possible to do the whole thing without swapping and clearing; you should be able to modify styles directly on existing elements.

Experimenting, I found that I could do this with para's, but not with span's. I guess this is a bug? Spans are supposed to have a stroke style, and setting the stroke style on a span works, just not modifying it.

Maybe you could use a flow full of para's instead of a para full of span's, for the words. It should look about the same.

Demo of in-place style modification with para's:

Shoes.app do
  button "colorize 1" do
    @text1.style(:stroke => rgb(rand,rand,rand))
  end
  button "colorize 2" do
    @text2.style(:stroke => rgb(rand,rand,rand))
  end
  flow do
    @text1 = para "First Text"
    @text2 = para "Second Text"
  end
end

This stopped working when I wrapped the strings in spans and tried to change the styles on the spans, instead of changing the styles on the para's.


On Apr 22, 2009, at 10:29 AM, Robert Poor wrote:

All:

Thanks for all the answers and suggestions. Due to popular demand, I've posted my sophomoric Ruby code for Word Clock to the ShoeBox:

        http://the-shoebox.org/apps/150

For the Shoes experts reading this, what I *think* I want is an abstraction where I can pre-generate all the <span> elements, and use <element>.replace to swap in highlighted and un-highlighted versions of the text. That seems tantamount to computing things off- screen, and I haven't figured out how to do that yet.

Enjoy.

- Rob


Reply via email to