80 |
// A translation RELATIVE to cs: the origin of cs_t is at (150, 125) on screen. |
// A translation RELATIVE to cs: the origin of cs_t is at (150, 125) on screen. |
81 |
int cs_t = vs.coords.translate(0, .5, .5, 0); |
int cs_t = vs.coords.translate(0, .5, .5, 0); |
82 |
|
|
83 |
|
vs.matcher.add(cs, "V1"); |
84 |
|
// Sub key |
85 |
|
vs.matcher.add(cs, cs_t, "X"); |
86 |
</pre> |
</pre> |
87 |
|
Now, cs_t will only be interpolated to a coordinate system whose parent is interpolated |
88 |
|
to cs, and whose key is "X". |
89 |
|
Here, both hierarchies were parallel, and indeed, usually they are. But sometimes |
90 |
|
non-parallel hierarchies are useful. For example, if we are placing images next to a map |
91 |
|
and markers on the map about where those images are, it's easier to do |
92 |
|
<pre> |
93 |
|
void placeImage(int imageCS, int mapCS, String param) { |
94 |
|
// Place image into the image coordsys |
95 |
|
// ... |
96 |
|
int marker_cs = vs.coords.ortho(mapCS, 0, markx, marky, w, h); |
97 |
|
vs.matcher.add(imageCS, marker_cs, "MARK"); |
98 |
|
} |
99 |
|
</pre> |
100 |
|
Here, the marker <i>transformation</i> is a child of the map transformation, but |
101 |
|
as a <i>keyframe object,</i> for matching, its parent is imageCS. |
102 |
|
This allows us to use the constant key "MARK" for all the marks. |
103 |
|
<p> |
104 |
|
However, you'll probably see this situation pretty rarely; most often the hierarchies |
105 |
|
are indeed parallel, and for that case VobScene provides a shortcut: |
106 |
|
<pre> |
107 |
|
int cs = vs.orthoCS(0, "V1", 0, 100, 100, 100, 50); |
108 |
|
int cs_t = vs.translateCS(cs, "X", .5, .5, 0); |
109 |
|
</pre> |
110 |
|
has the same effect as the earlier code. |
111 |
* <p> |
* <p> |
112 |
* |
* |
113 |
*/ |
*/ |