Create
detFriendly

How to chase variable with custom behavior 🏃

This code is over 6 months old. The code may have expired and might no longer function.

This project is under review to make it universal with cubic-bezier function.

If this work highly contributes to your one, please consider giving me credit, thank you!

What's this?

The general method to change the position of an entity smoothly is using the CHASE VARIABLE action.
However, the current workshop has no option to customize the behavior of it.
Don't you worry. Since we have access to time (TOTAL TIME ELAPSED) and there are a few math functions, we can create our own CUSTOM CHASE VARIABLE operation.

So in a nutshell, this work deals with the compact implementation of changing the position of a given entity over time, but not only with the linear fashion.

Features

Pros

  • Behavior options with explanations.
  • Easy-to-use pause/unpause operation.

Meh

  • Perhaps, you have to replace all variables with your own. I don't recommend opening the actions in the workshop.

Cons (planned to solve)

  • Duration (period time variable) reevaluation will not work.
  • Destination (array of positions) reevaluation will not work.

Insight of the different behaviors

Name Feeling Formula
LINEAR The same method used by the Workhop, when the value changes evenly. mod(TIME/p, 1)
"LIGHT" SINUS The illusion of rapidness, it starts quickly and gradually slows down (every period!). sin(TIME/p * π/2 - floor(TIME/p) * π/2)
"HEAVY" SINUS The illusion of slowness, it starts gently and gradually speeds up (every period!). abs(sin(TIME/p * π/2 - ceil(TIME/p) * π/2) + 1)

Hindsight

This project is not only about this specific issue, but an encouragement to use TOTAL TIME ELAPSED when repeatedly changing something based on time. Here are some minor examples of how elegant can this make other, more simple tasks.

from Shield as parachute from unreleased content from Chamber hop-on

Credit for the thumbnail goes to Nesskain, check out his amazing works as well!

Players | 1 - 12
Categories: Tools
Heroes: D.va, Orisa, Reinhardt, Roadhog, Sigma, and 27 more...
Created at:
Last updated:
Current version: 2021.06.02

Snippet

Loading...

Users Also Like

Similar Codes

Join the Workshop.codes Discord