Giter VIP home page Giter VIP logo

tween's Introduction

tween - C++ Tweening Library

tween is a library for interpolating numbers in C++. tween is great for applications such as games and ones with animations.

Features

  • Different easing styles (linear and sine)
  • Timing is done internally, no extra code required
  • Simple and easy interface

Usage

To use tween, just include the single-header to your project.

Example

#include <iostream>
#include <tween.hpp> // Path to

int main() {
	// Variables for the tween
	float initial = 0.f; // Starting value
	float target = 1.f; // Ending value
	int duration = 1000; // In milliseconds
	tween::easing easing_mode = tween::easing::sine_ease_in_out; // Easing mode

  	tween t(initial, target, duration, easing_mode);

	// Step at 60 frames per second
	while (true) {
		float value = t.step(); // Step the tween
		std::cout << value << std::endl;
		if (value == target) break;
		std::this_thread::sleep_for(std::chrono::milliseconds(1000 / 60));
	}
}

tween's People

Contributors

pupppy44 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.