Tuesday, September 21, 2010

CSS3 Star Wars Tweet Scroller

I've been playing around with some new CSS3 3-D transforms and whipped up this Star Wars scroller for Tweets:

Caveat: This currently only works on Safari.  It may work on a bleeding edge Chrome dev build but I haven't tried that.

There are some other examples of this type of scrolling effect out there but I wanted to make one for tweets.  I also noticed that there are some odd effects if you naively keep appending content to a div that's been rotated in 3-D.  As it reaches a certain height, webkit apparently starts downsampling (I guess to save memory in the rendering pipeline?  A limitation of hardware?  Who knows) and you get this pixelated effect:

This isn't a downsampled down screen shot.  It actually looks like this if you let the rotated div get too large.
As you can see, it becomes unreadable after a while.  It also starts eating up an increasing amount of CPU: it got to 100% (out of 400%) on my quad core iMac after a few minutes.  Not good.

So instead of putting all of the tweets into the same rotated div, I rotate each tweet element individually and that seems to fix the problem.  Also, I start deleting tweets at the top (where you can no longer see them anyways) after a while, just to keep the dom size down.  They are now readable and the CPU is happy.

Other stuff:

Instead of using CSS3 animations, I opted for javascript because I was loading the tweets with JS already and I'd have to manipulate the animations with JS anyways.

Also, the background is generated dynamically using the Canvas element.  I wanted a more realistic looking star field so I did some research on the distribution of star sizes and colors to see if I could perhaps simulate it with a Pareto distribution.  Turns out the distribution of star colors and brightness is some other weird distribution so I just made it more or less random, with smaller stars slightly more frequent than larger stars.


  1. that's an amazing post, read more to know about my blog.

  2. such a great word which you use in your article and article is amazing knowledge. thank you for sharing it.

    Get SAP HANA Training in Bangalore from Real Time Industry Experts with 100% Placement Assistance in MNC Companies. Book your Free Demo with Softgen Infotech.

  3. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    360DigiTMG artificial intelligence course in hyderabad

  4. It looks like you spend a lot of effort and time on your blog. I have bookmarked it and I am looking forward to reading new articles.
    Python Hyderabad

    Python Training in Coimbatore
    Python Training in Chennai

    Python Training in Training

    Python Training in Bangalore

  5. Truly mindblowing blog went amazed with the subject they have developed the content. These kind of posts really helpful to gain the knowledge of unknown things which surely triggers to motivate and learn the new innovative contents. Hope you deliver the similar successive contents forthcoming as well.

    360DigiTMG Machine Learning Course

  6. Good Post! , it was so good to read and useful to improve my knowledge as an updated one, keep blogging. After seeing your article I want to say that also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.
    Salesforce Online Training

  7. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    data science course in noida

  8. Wow! Such an amazing and helpful post this is. I really really love it. I hope that you continue to do your work like this in the future also.

    Best Tableau Training Institute in Pune
    Apache Spark Training Institute in Pune

  9. Really Nice Information It's Very Helpful All courses Checkout Here.
    data science in malaysia

  10. This is a fantastic website , thanks for sharing.
    ai course in pune

  11. Very good message. I came across your blog and wanted to tell you that I really enjoyed reading your articles.

    Business Analytics Course

  12. It's like you've got the point right, but forgot to include your readers. Maybe you should think about it from different angles.
    Data Analytics Bangalore

  13. This comment has been removed by the author.

  14. Thanks for the information about Blogspot very informative for everyone
    data analytics course aurangabad

  15. Before visiting Dissertation Editing Services and reading your blog, there was a lot of chaos in my life. But as soon as I started following your instructions, everything got on track.

  16. Are you planning to start Data Science Training Online, then enroll with 360DigiTMG to get trained by the world-class trainers with a well-designed curriculum, LMS Access, real-time projects, and assignments that will help you in upscaling your skills to grab the highest paid job.

    Best Data Science Training institute in Bangalore

  17. Join the Best institute for Data Science in Bangalore to achieve your career goals. Learn to manage, store, and protect data that will further help in analyzing customer behavior and provide feedback to make critical decisions. Learn the art of storytelling using the facts derived out of data and present the same user data visualization tools. With the right skills and techniques, you can achieve your career goals in this lucrative field.

    Data Science Course in Bangalore

  18. Are you planning to start Data Science Training Online, then enroll with 360DigiTMG to get trained by the world-class trainers with a well-designed curriculum, LMS Access, real-time projects, and assignments that will help you in upscaling your skills to grab the highest paid job.'

    Data Science in Bangalore