Verse Library verse

01 Device

Continuously pulses a light source intensity up and down using a time-based sine wave loop.

verse-library/create-light-effects-in-unreal-editor-for-fortnite/01-device.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Native }

# This is our beacon device.
BeaconDevice := class(creative_device):
    # This is the intensity value we will pulse.
    var intensity : float = 0.0

    # This function runs every frame.
    OnBegin<override>()<suspends>:void=
        # We will loop forever.
        var time : float = 0.0
        loop:
            # Increment time manually.
            set time = time + 0.016
            # Calculate a pulse value.
            pulse:=Sin(time*2.0)*0.5+0.5
            # Apply the pulse to the intensity variable.
            set intensity = pulse
            # Wait a tiny bit before next frame.
            Sleep(0.016)

Comments

    Sign in to vote, comment, or suggest an edit. Sign in