Press [Q] to make the distortion positive. Press [W] to make the distortion negative. Press [E] to make the distortion radial. Press [R] to make the distortion spiral. Go to the project's Turbowarp link https://turbowarp.org/918381837?fps=60&hqpen to allow the project to run faster.
Hey, it's been a while. I have implemented distortions to my project that serves as the backbone of my future projects. Distortions are quite expensive to calculate. The rough formula of the distortion is as follows: ΔZ = S * M * e^(-M) * (cos(θ), sin(θ)) new_pos = pos + ΔZ where ΔZ (vector) is the amount of "push" applied to the vertex, S (scalar) is the distortion strength, M (scalar) is the magnitude of the difference vector, and θ is the angle of the difference vector. The difference vector is the position of the vertex minus the position of the distortion's center. Scratch does not support vector variables, so the following equations are the cartesian version of the aforementioned equation: Δx = S * M * e^(-M) * cos(θ) Δy = S * M * e^(-M) * sin(θ) new_x = x + Δx new_y = y + Δy where Δx is the horizontal push, and Δy is the vertical push. The reason this is computationally expensive (hence the lag) is that a displacement is calculated for each vertex. In the example, the lines of the grid are segmented, meaning that each line is actually broken down into several smaller line parts connecting each other to form a "larger" line, requiring more vertices. Lines that are near distortions do not appear "warped", so segmentation allows it with the cost of performance. Distortions make segmented lines reasonable. Credit to @-Rex- for Pen Text Engine++