Go.animate pingpong not cycling? (SOLVED)

I have the following code to cause the object to scale up and down:
(scale starts at .28)

go.animate(go.get_id(), “scale”, go.PLAYBACK_LOOP_PINGPONG, .33, go.EASING_LINEAR, 0.25)

It animates up to the larger scale but never animates down. Am I using this correctly?

It works for me:

scale_pingpong

From where are you calling go.animate()?

1 Like

In response to a message. I will get the code in the morning.

1 Like

Are you perhaps receiving multiple messages? Or are you cancelling the animation somewhere else in your code?

2 Likes

Here’s my code:

function on_message(self, message_id, message, sender)
	if(message_id == hash("update")) then
		set_sprite(self)
	elseif(message_id == hash("highlight")) then
		go.animate(go.get_id(), "scale", go.PLAYBACK_LOOP_PINGPONG, .33, go.EASING_LINEAR, 0.25, 0.25)
	elseif(message_id == hash("end_highlight")) then
		go.cancel_animations(go.get_id(), "scale")
	end	
end

It should just pulse until it receives the “end_highlight” message, however I never send the end_highlight messages when I’m testing. I even just now commented out the cancel_animations code and it still only expands up once.

I’m using Editor2 if this makes a difference.

Does it perhaps receive multiple “highlight” messages?

1 Like

Yes it does, it shouldn’t but it does. I put some code around it to only call it once and it works. I should track down why the multiple messages. Aaand it just pointed out a bug, too. Super.

Thanks britzl, you rock.

3 Likes