[OpenLayers-Users] Tweening pinpoints

Takako Tucker Takako.Tucker at bbc.co.uk
Thu Dec 8 04:24:09 EST 2011


Thanks Casper. Much appreciated. I'll test it now. :) 

________________________________

From: Casper Span [mailto:info at spatially-oriented.com] 
Sent: 07 December 2011 20:56
To: Takako Tucker
Cc: Adam Eskreis; openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] Tweening pinpoints


Hi Takako,

In my example I wanted the map to move.
However, it should be fairly easy to adapt the code to your liking.

Basically what I do is letting the tween class calculate my path &
timing, and on eachStep I move the map. On eachStep, you should move
your pinpoint with something like this: (NOTE: not tested)


someFunc: function() {

// var fromCoord = your starting point
// var toCoord = your destination point
// var duration = number of steps it should take, the more you take, the
smoother the ride & longer it will take. (unless you also change the
INTERVAL constant on Tween)
var callbacks = {
   eachStep: tweenstep
};
var tween = new OpenLayers.Tween(OpenLayers.Easing.Quad.easeInOut);
tween.start(fromCoord, toCoord, duration, {callbacks: callbacks}

},

tweenstep: function (value) {
  // TODO: move your feature to the new coord
  // given in value.x and value.y
},


And another note: the tweenstep function is being called from the tween
class, so you are out of scope and cannot see your feature. That's why,
in my blogpost, I also stored the map object into the tween. You will
probably have to do something similar with your feature.

If you can't get this to work, I might be able to set up a sample
somewhere. Also, you might have some luck looking at the developer
example code:
http://openlayers.org/dev/tests/manual/tween.html

regards,
Casper


On Wed, Dec 7, 2011 at 6:39 PM, Takako Tucker <Takako.Tucker at bbc.co.uk>
wrote:


	
	Hi, so this is what I currently got. 
	 
	http://paste.org/41978
	 
	I can't seem to see Tweening working between pinpoints... Any
advise would be much appreciated. 
	The map shouldn't move and just pinpoints should move...
	 
	Takako

________________________________

	
	From: Casper Span [mailto:info at spatially-oriented.com] 
	Sent: 07 December 2011 10:38
	To: Takako Tucker
	
	Cc: Adam Eskreis; openlayers-users at lists.osgeo.org 

	Subject: Re: [OpenLayers-Users] Tweening pinpoints
	

	I dabbled a bit with this a few weeks ago and posted a small
blog on it... Maybe it helps.
	
http://www.spatially-oriented.com/joomla/tech/34-gis-articles/59-animate
d-zoom-with-openlayers
	
	
	
	On Wed, Dec 7, 2011 at 10:55 AM, Takako Tucker
<Takako.Tucker at bbc.co.uk> wrote:
	

		
		Thanks for this! I had a look at .Tween, but as it
reacts to DOM elements I couldn't be sure if it works with Lon Lat (X.Y)
figure. 
		I'll try again later on though. 

________________________________

		From: Adam Eskreis [mailto:aeskreis at gmail.com] 
		Sent: 06 December 2011 18:03
		To: Takako Tucker
		Cc: openlayers-users at lists.osgeo.org
		Subject: Re: [OpenLayers-Users] Tweening pinpoints
		
		
		There is an OpenLayers.Tween class I believe.
		
		Also, this is something that could easily be done iwth
just regular javascript.  Don't forget, OpenLayers is comprised of DOM
elements, so you can manipulate the map with regular javascript, you
don't have to use an OpenLayers construct.
		
		
		On Tue, Dec 6, 2011 at 12:33 PM, Takako Tucker
<Takako.Tucker at bbc.co.uk> wrote:
		

			

			Hello, 

			I'm currently using
OpenLayers.Control.DragFeature to move pinpoint from one place to
another. 

			        var dragFeature = new
OpenLayers.Control.DragFeature(location); 
	
map.addControl(dragFeature); 
			                         dragFeature.activate();



			But not only moving pinpoints, I need to add
tween animation. 

			Has anyone done tween animation for moving
pinpoints? 

			Any advise would be much appreciated! 

			Thanks 

			Takako 

			 

			http://www.bbc.co.uk
			This e-mail (and any attachments) is
confidential and may contain personal views which are not the views of
the BBC unless specifically stated.
			If you have received it in error, please delete
it from your system.
			Do not use, copy or disclose the information in
any way nor act in reliance on it and notify the sender immediately.
			Please note that the BBC monitors e-mails sent
or received.
			Further communication will signify your consent
to this. 

			_______________________________________________
			Users mailing list
			Users at lists.osgeo.org
	
http://lists.osgeo.org/mailman/listinfo/openlayers-users
			
			


		 

		http://www.bbc.co.uk
		This e-mail (and any attachments) is confidential and
may contain personal views which are not the views of the BBC unless
specifically stated.
		If you have received it in error, please delete it from
your system.
		Do not use, copy or disclose the information in any way
nor act in reliance on it and notify the sender immediately.
		Please note that the BBC monitors e-mails sent or
received.
		Further communication will signify your consent to this.


		_______________________________________________
		Users mailing list
		Users at lists.osgeo.org
		http://lists.osgeo.org/mailman/listinfo/openlayers-users
		
		


	 

	http://www.bbc.co.uk
	This e-mail (and any attachments) is confidential and may
contain personal views which are not the views of the BBC unless
specifically stated.
	If you have received it in error, please delete it from your
system.
	Do not use, copy or disclose the information in any way nor act
in reliance on it and notify the sender immediately.
	Please note that the BBC monitors e-mails sent or received.
	Further communication will signify your consent to this. 
	 

	http://www.bbc.co.uk
	This e-mail (and any attachments) is confidential and may
contain personal views which are not the views of the BBC unless
specifically stated.
	If you have received it in error, please delete it from your
system.
	Do not use, copy or disclose the information in any way nor act
in reliance on it and notify the sender immediately.
	Please note that the BBC monitors e-mails sent or received.
	Further communication will signify your consent to this. 



http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111208/7d465eb9/attachment-0001.html


More information about the Users mailing list