GetScaleAtTime

This function returns a scale value for a given time.

Syntax

Parameters

Returns

This function returns a float with a value between 0.0 and 1.0 designating the scale at that time. 0.0 being tiny and 1.0 corresponding to max scale.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
float time = 0.5;

Leadwerks::Window* window = Leadwerks::Window::Create();
Context* context = Context::Create(window);
World* world = World::Create();
Camera* camera = Camera::Create();
camera->SetRotation(35, 0, 0);
camera->Move(0, 0, -3);

//Create an emitter
Emitter* emitter = Emitter::Create(100);
emitter->AddScaleControlPoint(0, 0);
emitter->AddScaleControlPoint(1, 1);

while (true)
{
if (window->Closed() || window->KeyDown(Key::Escape)) return false;

Leadwerks::Leadwerks::Time::Update();
world->Update();
world->Render();

if (window->KeyDown(Key::Up) && time < 1.0)
{
time += .01;
}
else if (window->KeyDown(Key::Down) && time > 0.0)
{
time -= .01;
}
time = Math::Clamp(time, 0, 1);

context->SetBlendMode(Blend::Alpha);
context->DrawText("At " + String(time * 100) + " percent of the particles life scale will be :" + String(emitter->GetScaleAtTime(time)), 2, 2);
context->SetBlendMode(Blend::Solid);

context->Sync();
}
}