Version 1 (modified by landauf, 17 years ago) (diff) |
---|
QuickAnimation
This is an archived page! This page is very old and the content is not up to date. Not everything (if any) which is written here will be in the final game! |
file: source:/trunk/src/lib/particles/quick_animation.h
whats this
QuickAnimation is a wrapped lookup-table, that returns Values from Positions between 0.0 and 1.0
The Joke is, that one can add Key-Frames (with any values, and position between 0.0 and 1.0) and then retrieve a Value between those KeyFrames.
Acctually it is like a curve from 0.0 to 1.0.
usage
QuickAnimation test; test.addKey(.5, 10.0); test.addKey(.6, 3); test.addKey(.6, 3); test.changeValue(.6, 4); test.addKey(.0, 1); test.debug(); for (float f = 0.0; f < 1.0; f+= .1) printf("%f - %f\n", f, test.getValue(f));
outputs:
QuickAnimation:: key at position 0.600000 already added. Use changeValue instead QuickAnim(KeyFrames:3, Resolution:100)::(position, value) (0.000000, 1.000000)->(0.500000, 10.000000)->(0.600000, 4.000000)-> 0.000000 - 1.000000 0.100000 - 2.800000 0.200000 - 4.600000 0.300000 - 6.400000 0.400000 - 8.200000 0.500000 - 10.000000 0.600000 - 4.000003 0.700000 - 4.000000 0.800000 - 4.000000 0.900000 - 4.000000