Text in Intervals

Is there any way to change a text object in between intervals? I can simply create a new text object and attach it to aspect2d, but I don’t want the 2 text objects to appear at the same time.

I have an interval that takes a text object and changes its scale. Then, for the next interval, I want to change the text.

I guess you’ll find this snippet interesting

It’s nice, but it’s not what I’m looking for. I want to change the text itself between intervals. I can do that if I know which interval is currently playing inside the sequence. Is there any way to know that? I tried looking at the Sequence API but no luck.

I would like to know what you means with “change a text object” If you just need to change the text content over each sequence so do a youronscreentextobject.setText(your_text_variable) at the beginning of the sequence. But I bet you’re going to say to me ’ it’s not what I’m looking for" - if so, try to be more specific

Actually you are pretty much spot on. I want to change the text content. However, I want to do that in between intervals.

I’ll be more specific: The first interval changes the scale of a text object. After the 1st interval, I want to change the text content, and then run another interval that changes the scale of the text object again (the one with the new content)

However, I can’t write something like that:

self.myTextSeq = Sequence(self.textInterval1, self.logo.setText("Bla bla"), self.textInterval2) 


now it’s clear
you need to make a function for change your text and wrap it to an interval:

def changemytext():

self.intervalchangemytext= Func(changemytext)

therefore you’ll add it to your sequence:

self.myTextSeq = Sequence(self.textInterval1, self.intervalchangemytext, self.textInterval2)

that’s all about
check the manual chapter intervals to know more.

Thanks, but that’s what I did and it doesn’t work for me (assertion error)

Here is the code:

self.textInterval1 = LerpScaleInterval(self.logoRoot, 3, 0.25, 0)
self.textInterval2 = LerpScaleInterval(self.logoRoot, 3, 0.25, 0.25)
self.myTextSeq = Sequence(self.textInterval1, self.changeText, self.textInterval2) 


def changeText():
	self.logo.setText('Bla bla')

	self.intervalName = Func(changeText) 

P.S - I’ve tried putting self as a method argument and in the Func(self.changeText) - it doesn’t work.

I just realized I have to use Func in the sequence as well.

Thanks for all the help and patience :slight_smile:

you’re welcome
Next time just remember this:

do you know what I mean?

Yeah, I’ll try :slight_smile: