Last active
March 1, 2018 14:01
-
-
Save akirakoizumi/006afef6433dc9d9310ee2027e258e1c to your computer and use it in GitHub Desktop.
OpenSiv3DのTransitonで滑らかにトランジションさせるミニプログラム
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
//Created by Akira Koizumi 2018. | |
//http://movement.hatenablog.jp/entry/siv3dtransiton | |
// | |
//this code is licensed under cc0. | |
# include <Siv3D.hpp> //OpenSiv3D Ver0.2.0 | |
void Main() | |
{ | |
const Texture sun(Emoji(U"🌞"), TextureDesc::Mipped); | |
const Texture moon(Emoji(U"🌝"), TextureDesc::Mipped); | |
const Texture tree(Emoji(U"🌳"), TextureDesc::Mipped); | |
Transition transition(0.3s, 0.301s); | |
while (System::Update()) | |
{ | |
transition.update(MouseL.pressed()); | |
//空 | |
Rect(0, 0, Window::Size()).draw(ColorF(U"#41A7FF").setA(transition.value())); | |
Rect(0, 0, Window::Size()).draw(ColorF(U"#181991").setA(1.0-transition.value())); | |
//大地 | |
Rect(0, 300, Window::Size()).draw(ColorF(U"#95EB00").setA(transition.easeIn(Easing::Sine))); | |
Rect(0, 300, Window::Size()).draw(ColorF(U"#207720").setA(1.0 - transition.easeIn(Easing::Sine))); | |
//木 | |
tree.drawAt(200, 300, ColorF(transition.value()*0.6+0.4)); | |
//月と太陽 | |
sun.drawAt(100, 100, AlphaF(transition.value())); | |
moon.drawAt(Window::Width() - 100, 100, AlphaF(1.0-transition.value())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment