チョウのようなものの群れが飛んで行く
https://gyazo.com/1e048759f8db84fba69785e4c5e1d4bc
code:whites.cpp
#include <Siv3D.hpp> // OpenSiv3D v0.6.11 void Main()
{
std::list<std::tuple<Vec2, int, int>> whites;
Iota(32).each(&(auto) { whites.push_back(std::make_tuple(RandomVec2(Scene::Rect()), 0, Random(5, 9))); }); Array<Vec2> bones{ 6 };
bones0 = Circular{ 10, 170_deg }; bones1 = Circular{ 18, 85_deg }; bones2 = Circular{ 8, -60_deg }; bones3 = Circular{ 10, 140_deg }; bones4 = Circular{ 16, 60_deg }; bones5 = Circular{ 7, 40_deg }; double timeSpawned = 0;
while (System::Update())
{
Scene::Rect().draw(Color(120));
if (Scene::Time() - timeSpawned > 0.016 * 4)
{
whites.push_back(std::make_tuple(Vec2{ Scene::Width(), Random(Scene::Height()) }, 0, Random(5, 9)));
timeSpawned = Scene::Time();
}
for (auto& w : whites)
{
const int t = (std::get<1>(w) / std::get<2>(w)) % 2;
const Array<Vec2> r{ 4, Arg::generator = []() { return RandomVec2(2.0); } };
Triangle{ Vec2{} + r0, bonest * 3 + 1 + r1, bonest * 3 + 0 + r2 }.movedBy(std::get<0>(w)).draw(Color(240)); Triangle{ Vec2{} + r0, bonest * 3 + 2 + r3, bonest * 3 + 0 + r2 }.movedBy(std::get<0>(w)).draw(Color(230)); std::get<0>(w) += Vec2{ Random(-6.0, 2.0), Random(-4.0, 4.0) };
std::get<1>(w)++;
}
whites.remove_if([](auto& w) { return !Scene::Rect().intersects(std::get<0>(w)); });
}
}