Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » html rotation

html rotation

Reply
  #1 (permalink)  
Old 11-08-09, 07:22 AM
hemi hemi is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 57
Thanks: 3
Thanked 0 Times in 0 Posts
html rotation

hi

can any one tell me how to rotate text from the center

ex: abcdef


it should rotate from the center when we click on it or dynamically
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-09-09, 07:16 AM
wirehopper's Avatar
wirehopper wirehopper is offline
Community Liaison
 
Join Date: Feb 2006
Posts: 1,540
Thanks: 1
Thanked 22 Times in 22 Posts
Does the text rotate on the display or is there a set of text that changes to be different text as it is rotated?

Is this changing the content or presentation?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-10-09, 01:32 AM
hemi hemi is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 57
Thanks: 3
Thanked 0 Times in 0 Posts
actualli how i want is , suppose there is a vertical text on my page if i click on it, it should be slowly rotated(depending on the speed we give) to normal position(horizontal) can this be possible
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-10-09, 08:38 AM
therocket954's Avatar
therocket954 therocket954 is offline
Community Liaison
 
Join Date: Jul 2007
Location: Michigan, USA
Posts: 304
Thanks: 0
Thanked 4 Times in 4 Posts
I'm not aware of any JS library that can do plain-text rotation. However there's a bunch that do image rotation (google jQuery image rotation)... but that would require converting your text to images... :-/

The other option is <bad word> Flash </bad word>
__________________
--Eric Allison
Twitter: http://www.twitter.com/Eric_Allison
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-12-09, 12:33 AM
hemi hemi is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 57
Thanks: 3
Thanked 0 Times in 0 Posts
ok thanks for suggestion but there is another doubt for me (this may be 2 much, its just doubt)

can i joom a text from one plaece to another place what i mean to say is

at one end of the page iam having a text (THE ROCK ) and at the center of the page iam having another text(AUSTIN, this will be in vertical or in any degree) now when i click on AUSTIN (any degree or vertical) it should be rotated to normal text(means horizontal position) with zoom effect .
Just i want to know is it possible or not (only with HTML and JS ) please dont tell this is possible in FLASH . If it is possible tell me how and where can i find tht example
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-12-09, 08:50 AM
therocket954's Avatar
therocket954 therocket954 is offline
Community Liaison
 
Join Date: Jul 2007
Location: Michigan, USA
Posts: 304
Thanks: 0
Thanked 4 Times in 4 Posts
Here's a grab-bag of some jQuery text effects:
jQuery Grab Bag - Text Effects Plugin

You can also find some examples of slide in / out (use Google to search).

A very important thing not to forget.... Is this animation effect really this critical to your visitor's experience? (This is the "marketing guy" in me talking)
__________________
--Eric Allison
Twitter: http://www.twitter.com/Eric_Allison
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 11-12-09, 09:37 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,650
Thanks: 0
Thanked 20 Times in 20 Posts
There is a javascript library called "Raphael" located here: Raphaël?JavaScript Library
With this library you can manipulate text and images in any way imaginable.

Here is a simple example that rotates some text 90 degrees on mouseover and back again on mouseout.
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script src="raphael.js" type="text/javascript" charset="utf-8"></script>
<script>
var rot=0;
var degrees=90;
var speed=3;
var interval=10;
var txt,R,cw,ccw;

function initObj()
{
 var container = document.getElementById("holder");
 var text = container.getElementsByTagName("span")[0];
 var attr1 = {font: '24px Fontin-Sans, Arial', opacity: 1};
 R = Raphael("holder", 225, 225);
 txt = R.text(110, 110, text.innerHTML).attr(attr1).attr({fill: "#00f"});
 text.style.visibility = "hidden";
 }
 
function rotateClockwise()
{
 if(ccw){clearTimeout(ccw);}
 if(rot<degrees)
 {
  rot+=speed;
  txt.rotate(rot, true);
  R.safari();
  cw = setTimeout("rotateClockwise()",interval);
  }
 }
 
function rotateCounterClockwise()
{
 if(cw){clearTimeout(cw);}
 if(rot>0)
 {
  rot-=speed;
  txt.rotate(rot, true);
  R.safari();
  ccw = setTimeout("rotateCounterClockwise()",interval);
  }
 }
</script>
</head>
<body onload="initObj()">
<div id="holder" onmouseover="cw = setTimeout('rotateClockwise()',interval);" onmouseout="ccw = setTimeout('rotateCounterClockwise()',interval);">
<span>Mouseover to rotate</span>
</div>
</body>
</html>
__________________
Jerry Broughton

Last edited by job0107; 11-12-09 at 09:44 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
The Following User Says Thank You to job0107 For This Useful Post:
hemi (11-12-09)
  #8 (permalink)  
Old 11-12-09, 11:32 PM
hemi hemi is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 57
Thanks: 3
Thanked 0 Times in 0 Posts
it is working fine but whn i insert another div that one is not working
that mean

<body onload="initObj()">
<div id="holder" onclick="cw = setTimeout('rotateClockwise()',interval);" onchange="ccw = setTimeout('rotateCounterClockwise()',interval);">
<span>hema </span>

</div>

<div id="holder" onclick="cw = setTimeout('rotateClockwise()',interval);" onchange="ccw = setTimeout('rotateCounterClockwise()',interval);">
<span>chandra</span>

</div>

the second div is not working
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 11-13-09, 08:41 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,650
Thanks: 0
Thanked 20 Times in 20 Posts
Quote:
Originally Posted by hemi View Post
it is working fine but whn i insert another div that one is not working
that mean

<body onload="initObj()">
<div id="holder" onclick="cw = setTimeout('rotateClockwise()',interval);" onchange="ccw = setTimeout('rotateCounterClockwise()',interval);">
<span>hema </span>

</div>

<div id="holder" onclick="cw = setTimeout('rotateClockwise()',interval);" onchange="ccw = setTimeout('rotateCounterClockwise()',interval);">
<span>chandra</span>

</div>

the second div is not working
The way you have it setup, each object must have it's own canvas.
And each canvas must be defined separately.
The div's that are used as the canvases must have their own id's.

You can not assign the same id to different elements.
Each element must have a unique id.

You can also use one canvas with multiple objects and each object on the canvas can be manipulated separately.

Here is an example of two objects using separate canvases.
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script src="raphael.js" type="text/javascript" charset="utf-8"></script>
<script>
var rot1=0;
var rot2=0;
var degrees=90;
var speed=3;
var interval=10;
var txt1,txt2,R,cw1,cw2,ccw1,ccw2,obj;

function initObj()
{

 var container1 = document.getElementById("holder1");
 var text1 = container1.getElementsByTagName("span")[0];
 var attr1 = {font: '24px Fontin-Sans, Arial', opacity: 1};
 R1 = Raphael("holder1", 225, 225);
 txt1 = R1.text(110, 110, text1.innerHTML).attr(attr1).attr({fill: "#f0f"});
 text1.style.visibility = "hidden";
 
 var container2 = document.getElementById("holder2");
 var text2 = container2.getElementsByTagName("span")[0];
 var attr2 = {font: '24px Fontin-Sans, Arial', opacity: 1};
 R2 = Raphael("holder2", 225, 225);
 txt2 = R2.text(110, 110, text2.innerHTML).attr(attr2).attr({fill: "#f0f"});
 text2.style.visibility = "hidden";
 }
 
function rotateClockwise(obj)
{
 if(obj==1)
 {
  if(ccw1){clearTimeout(ccw1);}
  if(rot1<degrees)
  {
   rot1+=speed;
   txt1.rotate(rot1, true);
   R1.safari();
   cw1 = setTimeout("rotateClockwise(1)",interval);
   }
  }
 if(obj==2)
 {
  if(ccw2){clearTimeout(ccw2);}
  if(rot2<degrees)
  {
   rot2+=speed;
   txt2.rotate(rot2, true);
   R2.safari();
   cw2 = setTimeout("rotateClockwise(2)",interval);
   }
  }
 }
 
function rotateCounterClockwise(obj)
{
 if(obj==1)
 {
  if(cw1){clearTimeout(cw1);}
  if(rot1>0)
  {
   rot1-=speed;
   txt1.rotate(rot1, true);
   R1.safari();
   ccw1 = setTimeout("rotateCounterClockwise(1)",interval);
   }
  }
 if(obj==2)
 {
  if(cw2){clearTimeout(cw2);}
  if(rot2>0)
  {
   rot2-=speed;
   txt2.rotate(rot2, true);
   R2.safari();
   ccw2 = setTimeout("rotateCounterClockwise(2)",interval);
   }
  }
 }
</script>
</head>
<body onload="initObj()">
<div id="holder1" onclick="cw1 = setTimeout('rotateClockwise(1)',interval);" onchange="ccw1 = setTimeout('rotateCounterClockwise(1)',interval);">
<span>hema </span>
</div>

<div id="holder2" onclick="cw2 = setTimeout('rotateClockwise(2)',interval);" onchange="ccw2 = setTimeout('rotateCounterClockwise(2)',interval);">
<span>chandra</span>
</div>

</body>
</html>
I am not sure how you are going to use the onchange event listener.
But if you read the documentation you will see that you can assign events to each object separately.

I do not know all the different ways you can use the Raphael library,
because I have not used it myself.
I just happened upon the Raphael library when I was trying to help you.
It took me a little while to figure out how to set it up to make this program work.

So you are going to have to study it and play around with it yourself.
I am not going to hold your hand and do all the learning and programming for you.
There are plenty examples on the Raphael website that you can learn from.
__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Space Above Form xavier039 CSS 1 07-13-09 11:52 PM
[SOLVED] CSS Error digioz CSS 12 07-06-09 04:09 PM
html tutoral thefrtman HTML/XHTML/XML 5 04-27-09 11:25 AM
Strip HTML blinn_shade PHP 9 10-24-07 05:37 PM
HTML Form 1 -> Perl -> return response to HTML form 2 Oleks Perl 13 10-18-06 05:59 PM


All times are GMT -5. The time now is 09:58 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.