Talk:Canvas snippets: Difference between revisions

Jump to navigation Jump to search
m
Line 88: Line 88:
shuttle_symbol.setScale(0.20); # 20%  
shuttle_symbol.setScale(0.20); # 20%  


# position the image (this could be done dynamically using a maketimer() callback)
var update_shuttle = func() {
# you'd want to use the current lat/lon here and recompute the x/y position using the Mercator projection
var lat = getprop('/position/latitude-deg');
var lon = getprop('/position/longitude-deg');
 
var (x,y) = position2Pixels(lat:lat,lon:lon);
shuttle_symbol.setTranslation(x,y,);
}
 
# can use maketimer() to call this regularly
update_shuttle();


shuttle_symbol.setTranslation(image_width/2+x_offset, image_height/2+y_offset);
</syntaxhighlight>
</syntaxhighlight>


Navigation menu