Christmas greetings from Chrome-special Christmas Tree Animation Effects

Source: Internet
Author: User

The amazing effect of the 3D Christmas tree below is Spain.ProgramMember Roman Cortes's js1k programming competition entries. It is also a good test of the browser's JavaScript Engine capabilities. Only modern browsers (programmers, you know) can be viewed normally.

After testing, Chrome is very smooth (download and installation), opera 11 is normal, Firefox is slow, ie 9 is very slow, and versions earlier than IE 9 cannot be displayed.

The 3D Christmas tree consists of JavaScript within 1024 bytes.CodeThe Code is as follows:

M = math; q = m. random; j = []; u = 16; t = m. sin; E = m. SQRT; For (O = k = 0; X = z = J = I = k <200;) with (M [k] = K? C. clonenode (0): C) {width = height = K? 32: W = 446; with (getcontext ('2d ') if (k> 10 |! K) for (font = '60px impact ', V = 'rgba ('; I = I * u, fillstyle = K? K = 13? V + '2014,. 15) ': V + (205,205,215 + I) +', '+ (K % 2? 128 + I: 0) + ',' + I + ',. 5) ':' # CCA ', I <7;) beginpath (fill (ARC (u-I/3, 24-I/2, K = 13? 4-(I ++)/2: 8-I ++, 0, M. pI * 2, 1); else for (; X = T (I), Y = Q () * 2-1, D = x * x + y * y, B = E (D-x /. 9-1.5 * Y + 1), r = 67 * (B + 1) * (L = K/9 +. 8)> 1, I ++ <W;) if (d <1) beginpath (strokestyle = V + R + ', '+ (R + B * L> 0) +', 40 ,. 1) '), moveTo (U + x * 8, U + y * 8), lineto (U + x * u, u + y * U), stroke (); for (y = H = K + E (K ++) * 25, r = Q () * w; P = 3, j 

For implementation principles, refer to the author's blog.

This article is from: csdn

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.