Phase synthesizer implementation
This commit is contained in:
@@ -13,7 +13,7 @@ public class DrawCircles extends DrawBlock{
|
||||
|
||||
public int amount = 5, sides = 15;
|
||||
public float strokeMin = 0.2f, strokeMax = 2f, timeScl = 160f;
|
||||
public float radius = 12f;
|
||||
public float radius = 12f, radiusOffset = 0f, x = 0f, y = 0f;
|
||||
public Interp strokeInterp = Interp.pow3In;
|
||||
|
||||
public DrawCircles(Color color){
|
||||
@@ -36,9 +36,9 @@ public class DrawCircles extends DrawBlock{
|
||||
float life = ((Time.time / timeScl + i/(float)amount) % 1f);
|
||||
|
||||
Lines.stroke(build.warmup() * strokeInterp.apply(strokeMax, strokeMin, life));
|
||||
Lines.poly(build.x, build.y, sides, life * radius);
|
||||
Lines.poly(build.x + x, build.y + y, sides, radiusOffset + life * radius);
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
|
||||
39
core/src/mindustry/world/draw/DrawMultiWeave.java
Normal file
39
core/src/mindustry/world/draw/DrawMultiWeave.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package mindustry.world.draw;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
/** Not standalone. */
|
||||
public class DrawMultiWeave extends DrawBlock{
|
||||
public TextureRegion weave, glow;
|
||||
public float rotateSpeed = 1f, rotateSpeed2 = -0.9f;
|
||||
public Color glowColor = new Color(1f, 0.4f, 0.4f, 0.8f);
|
||||
public float pulse = 0.3f, pulseScl = 10f;
|
||||
|
||||
@Override
|
||||
public void drawBase(Building build){
|
||||
Draw.rect(weave, build.x, build.y, build.totalProgress() * rotateSpeed);
|
||||
Draw.rect(weave, build.x, build.y, build.totalProgress() * rotateSpeed * rotateSpeed2);
|
||||
|
||||
Draw.blend(Blending.additive);
|
||||
|
||||
Draw.color(glowColor, build.warmup() * (glowColor.a * (1f - pulse + Mathf.absin(pulseScl, pulse))));
|
||||
|
||||
Draw.rect(glow, build.x, build.y, build.totalProgress() * rotateSpeed);
|
||||
Draw.rect(glow, build.x, build.y, build.totalProgress() * rotateSpeed * rotateSpeed2);
|
||||
|
||||
Draw.blend();
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(Block block){
|
||||
weave = Core.atlas.find(block.name + "-weave");
|
||||
glow = Core.atlas.find(block.name + "-weave-glow");
|
||||
}
|
||||
|
||||
}
|
||||
42
core/src/mindustry/world/draw/DrawSpikes.java
Normal file
42
core/src/mindustry/world/draw/DrawSpikes.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package mindustry.world.draw;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
public class DrawSpikes extends DrawBlock{
|
||||
public Color color = Color.valueOf("7457ce");
|
||||
|
||||
public int amount = 10, layers = 1;
|
||||
public float stroke = 2f, rotateSpeed = 0.8f;
|
||||
public float radius = 6f, length = 4f, x = 0f, y = 0f, layerSpeed = -1f;
|
||||
|
||||
public DrawSpikes(Color color){
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public DrawSpikes(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){}
|
||||
|
||||
@Override
|
||||
public void drawBase(Building build){
|
||||
if(build.warmup() <= 0.001f) return;
|
||||
|
||||
Draw.color(color, build.warmup() * color.a);
|
||||
|
||||
Lines.stroke(stroke);
|
||||
float curSpeed = 1f;
|
||||
for(int i = 0; i < layers; i++){
|
||||
Lines.spikes(build.x + x, build.y + y, radius, length, amount, build.totalProgress() * rotateSpeed * curSpeed);
|
||||
curSpeed *= layerSpeed;
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user