Last active
May 15, 2017 02:02
-
-
Save voidproc/486f0229b095272fc611ebca1319750c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Siv3D.hpp> | |
struct Twinkle : IEffect | |
{ | |
Vec2 pos; | |
double angle; | |
double scale; | |
Twinkle(const Vec2 pos) : pos(pos), angle(RandomSelect({ 0_deg, 45_deg })), scale(Random(0.2, 1.0)) | |
{ | |
} | |
bool update(double t) override | |
{ | |
scale *= 0.988; | |
const double outer = (4 + 25 + 25 * Sin(t * 6_pi)) * scale; | |
const double inner = (0.5 + 1 + 1 * Sin(t * 6_pi)) * scale; | |
Geometry2D::CreateNStar(4, outer, inner, angle, pos).draw(Alpha(1 + 120 + 120 * Sin(t * 6_pi))); | |
return t < 0.50; | |
} | |
}; | |
void Main() | |
{ | |
Effect effect; | |
while (System::Update()) | |
{ | |
if (System::FrameCount() % 2) | |
effect.add<Twinkle>(Mouse::Pos() + RandomVec2(Random(80.0))); | |
effect.update(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Polygon に対する毎フレームの scaled, rotated, movedBy を避けるよう修正(https://twitter.com/Reputeless/status/782582249950617601)