»
Tiếng AnhTiếng PhápTiếng Việt

In - Đoạn thẳng quay - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Đồ họa » Đoạn thẳng quay
URL: https://www.javascriptbank.com/spinning-line.html

Đoạn thẳng quay © JavaScriptBank.comHiệu ứng tạo một đoạn thẳng tự quay với các thông số về chiều dài và chiều cao.

Phiên bản đầy đủ: jsB@nk » Đồ họa » Đoạn thẳng quay
URL: https://www.javascriptbank.com/spinning-line.html



CSS
<style>v\:* {BEHAVIOR: url(#default#VML)}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script language="javascript"><!--// USER FUNCTIONS function Effect1(){F_StartPosx = 420; F_StartPosy = 250; F_RadiusX = 100; F_RadiusY = 100; F_Start = 180F_End = 360; F_Step = 10; F_Fullcircle = 1; F_Direction = 1T_StartPosx = 420; T_StartPosy = 250; T_RadiusX = 100; T_RadiusY = 100; T_Start = 0T_End = 360; T_Step = 10; T_Fullcircle = 1; T_Direction = 1Scrolling=0Text_Scroll = 10text.string = "Spinning"Initialise()}// END USER FUNCTIONS // MAIN FUNCTIONS function Initialise(){if(F_Direction==1){F_Radian=0.017453292519943295} // Clockwiseelse{F_Radian= -0.017453292519943295 } // Anti-ClockwiseF_Start_Angle = F_Radian * F_StartF_Step_Angle = F_Radian * F_StepF_End_Angle = F_Radian * F_EndF_A=F_Start_AngleF_cx=F_StartPosx//+RadiusF_cy=F_StartPosy//+RadiusF_timer=""F_MoveArc()if(T_Direction==1){T_Radian=0.017453292519943295} // Clockwiseelse{T_Radian= -0.017453292519943295 } // Anti-ClockwiseT_Start_Angle = T_Radian * T_StartT_Step_Angle = T_Radian * T_StepT_End_Angle = T_Radian * T_EndT_A=T_Start_AngleT_cx=T_StartPosx//+RadiusT_cy=T_StartPosy//+RadiusT_timer=""T_MoveArc()document.getElementById("obj").style.visibility="visible"}function F_MoveArc(){clearTimeout(F_timer)F_A+=F_Step_AngleF_cos=Math.cos(F_A)F_sin=Math.sin(F_A)F_PosX=(F_RadiusX*F_cos)+F_cxF_PosY=(F_RadiusY*F_sin)+F_cyobj.from=parseInt(F_PosX/1.3333)+','+parseInt(F_PosY/1.3333)Scroll_Text() // if(F_Direction==1){if(F_Fullcircle==1){F_whole()F_timer=setTimeout("F_MoveArc()",100)return}F_reverse_clockwise()}else{if(F_Fullcircle==1){F_whole()F_timer=setTimeout("F_MoveArc()",100)return}F_reverse_anti_clockwise()}F_timer=setTimeout("F_MoveArc()",100)} function F_reverse_clockwise(){ // Reverse path in Clockwise directionif(F_A>F_End_Angle || F_A<F_Start_Angle){F_Step_Angle = -F_Step_Anglereturn}}function F_reverse_anti_clockwise(){ // Reverse path in Anti-Clockwise directionif(F_A<F_End_Angle || F_A>F_Start_Angle){F_Step_Angle = -F_Step_Anglereturn}}function F_whole(){if(F_Direction==1){if(F_End_Angle>360){F_End_Angle=F_Start_Angle}else{if(F_Direction==0){if(F_End_Angle<0){F_End_Angle=F_Start_Angle}}}}}function T_MoveArc(){clearTimeout(T_timer)T_A+=T_Step_AngleT_cos=Math.cos(T_A)T_sin=Math.sin(T_A)T_PosX=(T_RadiusX*T_cos)+T_cxT_PosY=(T_RadiusY*T_sin)+T_cyobj.to=parseInt(T_PosX/1.3333)+','+parseInt(T_PosY/1.3333) if(T_Direction==1){if(T_Fullcircle==1){T_whole()T_timer=setTimeout("T_MoveArc()",100)return}T_reverse_clockwise()}else{if(T_Fullcircle==1){T_whole()T_timer=setTimeout("T_MoveArc()",100)return}T_reverse_anti_clockwise()}T_timer=setTimeout("T_MoveArc()",100)} function T_reverse_clockwise(){ // Reverse path in Clockwise directionif(T_A>T_End_Angle || T_A<T_Start_Angle){T_Step_Angle = -T_Step_Anglereturn}}function T_reverse_anti_clockwise(){ // Reverse path in Anti-Clockwise directionif(T_A<T_End_Angle || T_A>T_Start_Angle){T_Step_Angle = -T_Step_Anglereturn}}function T_whole(){if(T_Direction==1){if(T_End_Angle>360){T_End_Angle=T_Start_Angle}else{if(T_Direction==0){if(T_End_Angle<0){T_End_Angle=T_Start_Angle}}}}}// END MAIN FUNCTIONS //SCROLL FUNCTIONS txt=new Array()txt[0]="This function"txt[1]="Is still under"txt[2]="Construction"txt[3]="But should be"txt[4]="Ready soon"index=0Scrolling=0//Text_Scroll = 0 // position at which the text is changed, added to user functionsfunction Scroll_Text(){if(Scrolling==0){index=0return}if(index==txt.length){index=0}Text_Change_Position=Math.floor(Math.acos(F_cos)/F_Radian) // convert to degrees and round upstep=F_StepDisplay.innerText="Position "+Text_Change_Position+" Change at "+Text_Scroll//Math.floor(Text_Scroll/step)*stepif(Text_Change_Position== Text_Scroll){text.string=txt[index]index++}}//END SCROLL FUNCTIONS setTimeout("Effect1()",1000)// --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<p><!--[if gte vml 1]><v:line id="obj" o:spid="_x0000_s1025" from="8.25pt,137.25pt" to="8.25pt,887.25pt" _x002c_="" _x0030_px="" filled="t" fillcolor="red"> <v:fill>   <v:path textpathok="true">    <v:textpath id="text" on="true" string="" fitpath="true"></v:textpath>   </v:path> </v:fill></v:line><![endif]--><![if !vml]><img border=0 width=2 height=1002src="spinning_line_files/image001.gif" v:shapes="obj"><![endif]></p><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->