GameSalad

Constant interpolate

SEMASEMA Posts: 156Member

I am making an actor be constantly changing color, with a interpolate behavior but it only does it once. I want it to be constantly interpolating.(sorry for my bad grammar).

Comments

  • SocksSocks London, UK.Posts: 12,698Member, PRO

    @SEMA said:
    I am making an actor be constantly changing color, with a interpolate behavior but it only does it once. I want it to be constantly interpolating.(sorry for my bad grammar).

    What colour is it changing from and to ?

  • -Timo--Timo- Posts: 2,258Member, PRO
    edited July 5

    You could use the sinus function.

    Example from yellow to light blue.

    Constrain self.color.red to 0.5sin(100self.Time)+0.5
    Constrain self.color.blue to 0.5sin(100self.Time+180)+0.5

    You can also interpolate the color back.

    If self.color.red = 0
    interpolate self.color.red to 1

    if self.color.red = 1
    interpolate self.color.red to 0

  • SocksSocks London, UK.Posts: 12,698Member, PRO

    cycle thro> @-Timo- said:

    You could use the sinus function.

    Example from yellow to light blue.

    Constrain self.color.red to 0.5sin(100self.Time)+0.5
    Constrain self.color.blue to 0.5sin(100self.Time+180)+0.5

    You can also interpolate the color back.

    If self.color.red = 0
    interpolate self.color.red to 1

    if self.color.red = 1
    interpolate self.color.red to 0

    multiplication symbols were lost in Timo's post, it should read:

    Constrain self.color.red to 0.5*sin(100*self.Time)+0.5
    Constrain self.color.blue to 0.5*sin(100*self.Time+180)+0.5

  • SEMASEMA Posts: 156Member

    I am taking the colors from a table. I have an attribute called "color", which states the row of the color

  • RThurmanRThurman Posts: 2,726Member, Sous Chef, PRO

    Check out the attached demo project. It might be useful.

Sign In or Register to comment.