0 votes

PROBLEM SOLVED:

After further research I duplicated the Tween node and made the first one call the second, then the second call the first. It's looping fine now, here's my code if you run into the same problem.

func pulse_outline():
    scrollMaterial.shader = load("res://Shaders/outline.shader")
    scrollMaterial.get_shader_param("outline_thickness")

    $ScrollShaderTween1.interpolate_property(scrollMaterial, "shader_param/outline_thickness", tweenValues[0], tweenValues[1], 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
    $ScrollShaderTween1.start()

func _on_ScrollShaderTween1_tween_completed(object, key):
    scrollMaterial.shader = load("res://Shaders/outline.shader")
    scrollMaterial.get_shader_param("outline_thickness")

    $ScrollShaderTween2.interpolate_property(scrollMaterial, "shader_param/outline_thickness", tweenValues[1], tweenValues[0], 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
    $ScrollShaderTween2.start()

func _on_ScrollShaderTween2_tween_completed(object, key):
    pulse_outline()

Hi everyone. I have a Tween that works this way:

func pulse_outline():
    scrollMaterial.shader = load("res://Shaders/outline.shader")
    scrollMaterial.get_shader_param("outline_thickness")

    $ScrollShaderTween.interpolate_property(scrollMaterial, "shader_param/outline_thickness", tweenValues[0], tweenValues[1], 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
    $ScrollShaderTween.start()

func _on_ScrollShaderTween_tween_completed(object, key):
    tweenValues.invert()
    $ScrollShaderTween.interpolate_property(scrollMaterial, "shader_param/outline_thickness", tweenValues[0], tweenValues[1], 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
    $ScrollShaderTween.start()

Basically, when the Tween stops, it sends a signal to start over with inverted values, to make it loop.

When I put pulse_outline() in func _ready(), it works perfectly. However when I decide to put it my signal func _on_CameraTween1_tween_completed(object, key):, the values stop inverting like it says in my code. Any help would be greatly appreciated!

Godot version v3.3.2
in Engine by (54 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.