Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "AnimationManager.hpp"
- int main()
- {
- float yPos = 20;
- float ySize = 10;
- float xSize = 300;
- sf::RectangleShape back;
- back.setSize(sf::Vector2f(xSize, ySize));
- back.setPosition(0, yPos);
- back.setFillColor(sf::Color(230, 230, 230));
- back.setOutlineColor(sf::Color(188, 188, 188));
- back.setOutlineThickness(1.0f);
- sf::RectangleShape shape;
- shape.setSize(sf::Vector2f(xSize / 5, ySize));
- shape.setPosition(sf::Vector2f(xSize / 5, yPos));
- shape.setFillColor(sf::Color(6, 176, 37));
- sf::RenderWindow window(sf::VideoMode(300, 50), "Loading...");
- PhysicalAnimator ani;
- while (window.isOpen())
- {
- sf::Event event;
- while (window.pollEvent(event))
- {
- if (event.type == sf::Event::EventType::Closed)
- {
- window.close();
- }
- }
- if (ani.tasks.empty())
- {
- shape.setPosition(sf::Vector2f(-shape.getSize().x, shape.getPosition().y));
- ani.addTranslationTask(shape, sf::Vector2f(window.getSize().x, shape.getPosition().y), EaseType::CubicEaseInOut, 2000, false);
- }
- ani.Update();
- window.clear(sf::Color::White);
- window.draw(back);
- window.draw(shape);
- window.display();
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment