Clock effect _ raphael. js

Source: Internet
Author: User

Clock effect: A long time ago, flash provided a variety of interesting web pages. In recent years, canvas played a game with it after html5 launched canvas. Now we are talking about implementing the clock effect with raphaeljs.

Raphaeljs encapsulates svg and vml operations, and SVG (Scalable Vector Graphics) scales Vector Graphics. The Vector Markup Language (VML) Vector Markup Language.


First full eye, win7 clock effect show, see:




The clock to be unveiled next (the super texture of metallic luster) can be found:


Briefly describe the implementation principle:
Step 1: draw a clock. Clock disc, clock hour minute second pointer, scale, time. The drawing method is circle, rect, and text.

r.circle(150, 150, 140).attr({fill:"r(0.5,0.5)#ffffff-#efefef",stroke:"#cecece","stroke-width":1r.rect(144,150,8,100,4).attr({fill:"#ccc",stroke:"none"r.rect(28,145,10,4).attr({fill:"#999",stroke:"none"r.text(150,220,(dh+":"+dm+":"+ds)).attr({font: "14px Arial", fill: "#000"});


Step 2: Move the pointer.

 d =  ds = dm = dh = dD = dM = d.getMonth()+1 dY =+30+(dm/60)+(ds/(60*60)))*30,150,150+30+(ds/60))*6,150,150); s.rotate((ds+30)*6,150,150setInterval(= ===== d.getMonth()+1=6/(60*60),150,150);    m.rotate(6/60,150,150);    s.rotate(6,150,1501000);

 

Step 3: display the year and month.

Txt = r. text (150,220, (dh + ":" + dm + ":" + ds )). attr ({font: "14px Arial", fill: "#000" txt1 = r. text (150,200, dY + "year" + dM + "month" + dD + "day week" + txtT. charAt (dT )). attr ({font: "14px Arial", fill: "#000" setInterval (+ ":" + dm + ": "+ +" year "+ dM +" month "+ dD +" day week "+ 1000 );

 


If you are interested, you can use your imagination to make more clock effects.


Note: I am looking for a front-end job. QQ: 1173290990. (If your parents are not far away, you must visit the game)




DEMO:

</P>

Run code

Related Article

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.