diff options
author | racarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3> | 2007-02-16 20:01:53 +0000 |
---|---|---|
committer | racarr <racarr@d7aaf104-2d23-0410-ae22-9d23157bf5a3> | 2007-02-16 20:01:53 +0000 |
commit | 801676b4eca4fdb304d4aef7dbbed13105ed6adb (patch) | |
tree | 64b553735ed1aafc8e785e070766a9de93795d0d | |
parent | 4e8aa41149e3881e7a42d46fc90f30e7c9d5904f (diff) | |
download | marex-dev-801676b4eca4fdb304d4aef7dbbed13105ed6adb.tar.gz marex-dev-801676b4eca4fdb304d4aef7dbbed13105ed6adb.tar.bz2 |
Add quadratic acceleration animation to move for wall
git-svn-id: file:///beryl/trunk@4113 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r-- | beryl-plugins/src/wall.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/beryl-plugins/src/wall.c b/beryl-plugins/src/wall.c index 389ecca..535eb37 100644 --- a/beryl-plugins/src/wall.c +++ b/beryl-plugins/src/wall.c @@ -1577,15 +1577,29 @@ static void wallPaintTransformedScreen(CompScreen * s, int i, j; - matrixTranslate(&sTransform, ((1 - - left) * ws->destx) * (s->width / - (float)s->outputDev[output]. - width), - (-(1 - left) * ws->desty) * (s->height / - (float)s->outputDev[output]. - height), 0); + // 1.44 isn't a magic number, it can be easily derived from the + // following + // integral x^2=x^3/3, then solve for x = 1 as we want to translate by 1 + // total, you get 1.44 and the (tx-1.44) is to translate the parabola + // right by 1.44 + float tx = (1-left) * 1.4422495; + float dx = (tx-1.4422495)*(tx-1.4422495)/2; + + dx = 1-dx; + + dx*=s->width/(float)s->outputDev[output].width; + dx*=ws->destx; + + + float dy = (tx-1.4422495)*(tx-1.4422495)/2; + dy = 1-dy; + dy *= (s->height)/(float)s->outputDev[output].height; + dy*=ws->desty; + matrixTranslate(&sTransform, dx, -dy, 0); + int lbx; + int lby; for (i = -abs(ws->destx); i < s->hsize; i++) // TODO: Add a slight bit of intelligence to not be so ineffecient { |