This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > December 2003 > cascade animation does not work in my scene:





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author cascade animation does not work in my scene:
Robert Ludewig

2003-12-04, 1:01 pm

I try to cascade animation. But it is not working, any idea why?
See my scene below. Poth cones start the animation at the same time.
Also, at the end I want to make a animation that has a queue of more
than 1000 such animations that all need to be played one ofter the
other.
How can I avoid to make 1000 timers and 1000 interplators
-----------------cut here ------------------
#VRML V2.0 utf8

DEF script_delay Script
{
eventIn SFTime set_startstop
eventOut SFTime startTime
eventOut SFTime stopTime
eventOut SFTime cycleInterval
field SFTime delay 1
url "vrmlscript:
function set_startstop(now)
{
startTime= now;
stopTime= now + delay;
cycleInterval=stopTime-startTime;
print(startTime);
print(stopTime);
}
"
}

DEF trans Transform
{
children Shape
{
appearance Appearance
{
material Material
{
}
}
geometry Cone
{
}
}
}

DEF trans1 Transform
{
children Shape
{
appearance Appearance
{
material Material
{
}
}
geometry Cone
{
}
}
}


DEF tocher TouchSensor
{
enabled TRUE
}

DEF Timer1 TimeSensor
{
loop FALSE
}
DEF Timer2 TimeSensor
{
loop FALSE
}
DEF inpl1 PositionInterpolator
{
key [0,1]
keyValue [0 0 0 ,1 0 0]
}
DEF inpl2 PositionInterpolator
{
key [0,1]
keyValue [1 0 0 ,1 0 1]
}

ROUTE tocher.touchTime TO script_delay.set_startstop
ROUTE script_delay.startTime TO Timer1.startTime
ROUTE script_delay.stopTime TO Timer1.stopTime
ROUTE script_delay.cycleInterval TO Timer1.cycleInterval
ROUTE Timer1.fraction_changed TO inpl1.set_fraction
ROUTE inpl1.value_changed TO trans.translation

ROUTE Timer1.stopTime TO script_delay.set_startstop
ROUTE script_delay.startTime TO Timer2.startTime
ROUTE script_delay.stopTime TO Timer2.stopTime
ROUTE script_delay.cycleInterval TO Timer2.cycleInterval
ROUTE Timer2.fraction_changed TO inpl2.set_fraction
ROUTE inpl2.value_changed TO trans1.translation
Joerg Scheurich aka MUFTI

2003-12-04, 1:01 pm

> Also, at the end I want to make a animation that has a queue of more
quote:

> than 1000 such animations that all need to be played one ofter the
> other.
> How can I avoid to make 1000 timers and 1000 interplators



By using a PROTO.
The more interesting question is, how to avoid 1000 ROUTES.
Maybe 1000 ROUTES can be avoided by directOutput and setting of
TimeSensor.startTime and TimeSensor.stopTime to the values
"currentTime + some offset"

so long
MUFTI
Robert Ludewig

2003-12-04, 1:01 pm


could you maybe give me a little example how to cascade maybe three
animations one after the other. Maybe also with the use of proto ?


Joerg Scheurich aka MUFTI

2003-12-04, 1:01 pm

Robert Ludewig <schwertfischtrombose@gmx.de> wrote:
quote:

> could you maybe give me a little example how to cascade maybe three
> animations one after the other. Maybe also with the use of proto ?



The following is possibly not exactly, cause each node start will relativly
to "the loading time of the script" script3, but i think, you get the idea.

so long
MUFTI


#VRML V2.0 utf8

PROTO AnimateDelay
[
field MFNode node []
field SFTime delay 0
]
{
DEF Transform1 Transform
{
children IS node
scale 0.3 0.3 0.3
}

DEF TimeSensor1 TimeSensor
{
}

DEF PositionInterpolator1 PositionInterpolator
{
key
[
0
1
]
keyValue
[
0 0 0
1 0 0
]
}

ROUTE TimeSensor1.fraction_changed TO PositionInterpolator1.set_fraction
ROUTE PositionInterpolator1.value_changed TO Transform1.set_translation

DEF Script1 Script
{
eventIn SFInt32 dummyForTimeStamp
eventOut SFTime time1_out
field SFTime delay IS delay
url
[
"java script:

// field SFTime delay //
// eventOut SFTime time1_out //

function dummyForTimeStamp(value, timestamp)
{
time1_out = timestamp + delay;
}
"
]
}

ROUTE Script1.time1_out TO TimeSensor1.set_startTime

DEF Script3 Script
{
eventOut SFInt32 dummyEvent
url
[
"java script:

function initialize()
{
dummyEvent = 42;
}

"
]
}

ROUTE Script3.dummyEvent TO Script1.dummyForTimeStamp
}

Transform
{
children
[
AnimateDelay
{
node
[
Shape
{
appearance Appearance
{
material Material
{
}
}
geometry Cone
{
}
}
]
}
]
}

Transform
{
children
[
AnimateDelay
{
node
[
Shape
{
appearance Appearance
{
material Material
{
}
}
geometry Sphere
{
}
}
]
delay 1
}
]
translation 1 0 0
}

Transform
{
children
[
AnimateDelay
{
node
[
Shape
{
appearance Appearance
{
material Material
{
}
}
geometry Cylinder
{
}
}
]
delay 2
}
]
translation 2 0 0
}

WorldInfo
{
info
[
"This program is free software; you can redistribute it and/or modify"
"it under the terms of the GNU General Public License as published by"
"the Free Software Foundation; either version 2 of the License, or"
"(at your option) any later version."
]
}
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews