XML Elves

XML Elves

<community>of XML and SVG Developers</community>


how to show svg dig step by step

This is a discussion on how to show svg dig step by step within the SVG Questions forums, part of the SVG Forums category; I want to print 3 circles step by step, ie display ist then pose then display next I am using ...


Go Back   XML Elves > SVG Forums > SVG Questions

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Notices


Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-14-2004, 09:50 AM
chore_ashwin
Guest
 
Posts: n/a
Default how to show svg dig step by step

I want to print 3 circles step by step, ie display ist then pose then display next
I am using setTimeout() function as follows but it is not working, whole dig seems to be drawn at the same time
please help me out how to use setTimeout(), or anyother way to do the same



<svg onload="init(evt)" >
<script language="javascript">
<![CDATA[
var svgDocument=null;
var svgns ="http://www.w3.org/2000/svg";
var node;

function init(event){

svgDocument= event.target.ownerDocument;
for(var i=0;i<3;i++){
node = svgDocument.createElementNS(svgns, "circle");
node.setAttributeNS(null, "id",i);
node.setAttributeNS(null, "cx",i*50);
node.setAttributeNS(null, "cy",50);
node.setAttributeNS(null, "r", 15);
node.setAttributeNS(null,"fill", "yellow");
svgDocument.documentElement.appendChild(node);
setTimeout("timeout()",1000);
}
}

function timeout(){

}
window.timeout=timeout;
]]>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-14-2004, 10:46 AM
Anonymous
Guest
 
Posts: n/a
Default how to show svg dig step by step

hi chore_ashwin

try like this :

<svg onload="init(evt)" >
<script language="javascript">
<![CDATA[
var svgDocument=null;
var svgns ="http://www.w3.org/2000/svg";
var node;
var svgDocument;
var Timer=0

function init(event){
svgDocument= event.target.ownerDocument;
Timer=setTimeout("createCircle(1)",1000);
}

function createCircle(c){
var i=c
node = svgDocument.createElementNS(svgns, "circle");
node.setAttributeNS(null, "id",i);
node.setAttributeNS(null, "cx",i*50);
node.setAttributeNS(null, "cy",50);
node.setAttributeNS(null, "r", 15);
node.setAttributeNS(null,"fill", "yellow");
svgDocument.documentElement.appendChild(node);


if(i<3){
i++
Timer=setTimeout("createCircle("+i+")",1000);
}
}

]]>

hope it helps
Holger
http://www.treebuilder.de[/quote]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-16-2004, 08:22 AM
chore_ashwin
Guest
 
Posts: n/a
Default thanks

Thanks for ur support
It is working fine

But i have another problem. It seems that after calling afunction with setTimeout() Execution proceeds imidiately to the next statement......
If i want to acess the elements that are created in a function called with setTimeout(), I cant acess them as the element is not created yet so It flags the Err as "null is null or not an object"

How do i control that this statement is executed after the element is created

ex
<svg onload="init(evt)" >
<script language="javascript">
<![CDATA[
var svgDocument=null;
var svgns ="http://www.w3.org/2000/svg";
var node;
var svgDocument;
var Timer=0

function init(event){
svgDocument= event.target.ownerDocument;
Timer=setTimeout("createCircle(1)",1000);
// i think err is flaged due to this statement as element is yet not created
//Am i correct
var tgtElement=svgDocument.getElementById(0);
tgtElement.setAttribute("fill","blue");

}




function createCircle(c){
var i=c
node = svgDocument.createElementNS(svgns, "circle");
node.setAttributeNS(null, "id",i);
node.setAttributeNS(null, "cx",i*50);
node.setAttributeNS(null, "cy",50);
node.setAttributeNS(null, "r", 15);
node.setAttributeNS(null,"fill", "yellow");
svgDocument.documentElement.appendChild(node);




if(i<3){

i++

Timer=setTimeout("createCircle("+i+")",1000);

}

}

]]>
</script>
</svg>

please tell me how do i solve it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-16-2004, 11:18 AM
Anonymous
Guest
 
Posts: n/a
Default how to show svg dig step by step

Hi chore
i see no need in doing so.
you can easily acess the created element from the function whitch creates the elements.
like this:
<svg onload="init(evt)" >
<script language="javascript">
<![CDATA[
var svgDocument=null;
var svgns ="http://www.w3.org/2000/svg";
var node;
var svgDocument;
var Timer=0

function init(event){
svgDocument= event.target.ownerDocument;
Timer=setTimeout("createCircle(1)",1000);
}




function createCircle(c){
var i=c
node = svgDocument.createElementNS(svgns, "circle");
node.setAttributeNS(null, "id",i);
node.setAttributeNS(null, "cx",i*50);
node.setAttributeNS(null, "cy",50);
node.setAttributeNS(null, "r", 15);
node.setAttributeNS(null,"fill", "yellow");
svgDocument.documentElement.appendChild(node);

//place any function that needs acess to circle i here e.g.
node.setAttributeNS(null,"fill", "blue");


if(i<3){

i++

Timer=setTimeout("createCircle("+i+")",1000);

}

}

]]>
</script>
</svg>
hth
Holger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-17-2004, 08:18 AM
chore_ashwin
Guest
 
Posts: n/a
Default thanks

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-04-2004, 04:21 AM
Anonymous
Guest
 
Posts: n/a
Default how to show svg dig step by step

Quote:
Originally Posted by Anonymous
Hi chore
i see no need in doing so.
you can easily acess the created element from the function whitch creates the elements.
like this:
<svg onload="init(evt)" >
<script language="javascript">
<![CDATA[
var svgDocument=null;
var svgns ="http://www.w3.org/2000/svg";
var node;
var svgDocument;
var Timer=0

function init(event){
svgDocument= event.target.ownerDocument;
Timer=setTimeout("createCircle(1)",1000);
}




function createCircle(c){
var i=c
node = svgDocument.createElementNS(svgns, "circle");
node.setAttributeNS(null, "id",i);
node.setAttributeNS(null, "cx",i*50);
node.setAttributeNS(null, "cy",50);
node.setAttributeNS(null, "r", 15);
node.setAttributeNS(null,"fill", "yellow");
svgDocument.documentElement.appendChild(node);

//place any function that needs acess to circle i here e.g.
node.setAttributeNS(null,"fill", "blue");


if(i<3){

i++

Timer=setTimeout("createCircle("+i+")",1000);

}

}

]]>
</script>
</svg>
hth
Holger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-07-2004, 08:43 AM
Anonymous
Guest
 
Posts: n/a
Default text

Quote:
Originally Posted by Anonymous
Hi chore
i see no need in doing so.
you can easily acess the created element from the function whitch creates the elements.
like this:
<svg onload="init(evt)" >
<script language="javascript">
<![CDATA[
var svgDocument=null;
var svgns ="http://www.w3.org/2000/svg";
var node;
var svgDocument;
var Timer=0

function init(event){
svgDocument= event.target.ownerDocument;
Timer=setTimeout("createCircle(1)",1000);
}




function createCircle(c){
var i=c
node = svgDocument.createElementNS(svgns, "circle");
node.setAttributeNS(null, "id",i);
node.setAttributeNS(null, "cx",i*50);
node.setAttributeNS(null, "cy",50);
node.setAttributeNS(null, "r", 15);
node.setAttributeNS(null,"fill", "yellow");
svgDocument.documentElement.appendChild(node);

//place any function that needs acess to circle i here e.g.
node.setAttributeNS(null,"fill", "blue");


if(i<3){

i++

Timer=setTimeout("createCircle("+i+")",1000);

}

}

]]>
</script>
</svg>
hth
Holger
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
dig, show, step, svg


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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -6. The time now is 02:36 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

Epson Ink Cartridges
Order your Epson ink cartridges here and UK delivery is free.

ink for printer
Get ink for your printer online and make a great saving! We are specialist suppliers for home business and trade users. Excellence in ink.

hard disk drive data recovery cheshire
Do you urgently need data recovery from your hard disk drive done in Cheshire? We have an unrivalled success rate.

ink cartridges Free UK Delivery on ink cartridges such as Canon, Dell, Epson, hp & Lexmark.

1 2 3 4 5 6 7 8 9 10