6.8 -
Exemplos
6.8.1
- PositionInterpolator
Exemplo
61: Deslocamento de uma Bola seguindo o caminho
-6 0 0, 0 4 0, 6 0 0, 0 -4 0,
-6 0 0
Inline { Anexa um outro
arquivo de extensão wrl
url ["Eixos03.wrl"]
}
DEF Bola Transform{
children
[
Shape {
appearance Appearance {
material Material {
diffuseColor 0 0 1
}
}
geometry Sphere {
radius 0.5
}
}
]
}
DEF PI PositionInterpolator {
key
[ 0 0.25 0.5 0.75
1 ]
keyValue
[ -6 0 0, 0 4 0, 6 0 0, 0
-4 0, -6 0 0 ]
}
DEF TS TimeSensor {
loop
TRUE
cycleInterval
5
}
ROUTE TS.fraction_changed TO PI.set_fraction
ROUTE PI.value_changed TO Bola.translation
Exemplo
62: Movimentos combinados
Background
{ # determina a cor de fundo
skyColor 0.7 0.3 0
}
DEF TR Transform {
children [
DEF Esfera Transform {
children Shape {
appearance Appearance {
material DEF mat Material { diffuseColor 1 0 0 }
}
geometry Cone {
bottomRadius 1.0
height 2
}
}
}
DEF OI OrientationInterpolator {
key [ 0 1 ]
keyValue [ 0 1 0 0, 0 1 0 3.14, 0 0
1 3.14]
}
DEF TS TimeSensor {
cycleInterval 4
loop TRUE
}
DEF Cubo Transform {
children Shape { # define um bloco de um objeto (Shape)
appearance Appearance { # define a aparência do Shape
material Material {
diffuseColor 0.3 1.0 0.0 # r g b
transparency 0.7 # entre 0 e 1
} # fim do Material
texture ImageTexture {
url ["C:/Sites/Imagens/Imagem96.jpg"]
}
}
geometry Box {
size 2.0 2.0 2.0 # larg, altura, prof
}
} # fim do shape
}
DEF OI2 PositionInterpolator {
key [ 0.00, 0.50, 1.00 ]
keyValue [ -4.0 0.0 0.0, 4.0 0.0 0.0,
-4.0 0.0 0.0 ]
# Observe a equivalência de quantidade de posições e tempos
# chave
}
DEF TS2 TimeSensor {
cycleInterval 4
loop TRUE
}
DEF Cubo2 Transform {
children Shape { # define um bloco de um objeto (Shape)
appearance Appearance { # define a aparência do Shape
material Material {
diffuseColor 0.0 1.0 0.3 # r g b
} # fim do Material
texture ImageTexture {
url ["C:/Sites/Imagens/Imagem97.jpg"]
} # fim do Texture
} # fim do Appearance
geometry Cylinder {
height 2.0 # (altura)
radius 1.0 # (raio)
}
} # fim do shape
}
DEF OI3 PositionInterpolator {
key [ 0.00, 0.20, 0.40, 0.60, 0.80, 1.00 ]
keyValue [ 0.0 -4.0 0.0, 0.0 4.0 0.0, 0.0 -4.0 0.0,
0.0 4.0 0.0, 0.0 -4.0 0.0, 0.0
4.0 0.0 ]
# Observe a equivalência de quantidade de posições e tempos chave
}
DEF TS3 TimeSensor {
cycleInterval 16
loop TRUE
}
]
}
ROUTE ts.fraction_changed TO oi.set_fraction
ROUTE oi.value_changed TO Esfera.set_rotation
ROUTE ts2.fraction_changed TO oi2.set_fraction
ROUTE oi2.value_changed TO Cube.set_translation
ROUTE ts3.fraction_changed TO oi3.set_fraction
ROUTE oi3.value_changed TO Cube2.set_translatio