static void getZoomCenterScaleFull (CompWindow *w, Point *pCurCenter, Point *pCurScale, Point *pWinCenter, Point *pIconCenter, float *pRotateProgress) { ANIM_WINDOW(w); Point winCenter = {(WIN_X(w) + WIN_W(w) / 2.0), (WIN_Y(w) + WIN_H(w) / 2.0)}; Point iconCenter = {aw->com.icon.x + aw->com.icon.width / 2.0, aw->com.icon.y + aw->com.icon.height / 2.0}; Point winSize = {WIN_W(w), WIN_H(w)}; winSize.x = (winSize.x == 0 ? 1 : winSize.x); winSize.y = (winSize.y == 0 ? 1 : winSize.y); float scaleProgress; float moveProgress; float rotateProgress = 0; if (aw->com.curAnimEffect == AnimEffectSidekick) { fxZoomAnimProgress (w, &moveProgress, &scaleProgress, FALSE); rotateProgress = moveProgress; } else if (aw->com.curAnimEffect == AnimEffectZoom) { fxZoomAnimProgress (w, &moveProgress, &scaleProgress, FALSE); } else { // other effects use this for minimization fxZoomAnimProgress (w, &moveProgress, &scaleProgress, TRUE); } Point curCenter = {(1 - moveProgress) * winCenter.x + moveProgress * iconCenter.x, (1 - moveProgress) * winCenter.y + moveProgress * iconCenter.y}; Point curScale = {((1 - scaleProgress) * winSize.x + scaleProgress * aw->com.icon.width) / winSize.x, ((1 - scaleProgress) * winSize.y + scaleProgress * aw->com.icon.height) / winSize.y}; // Copy calculated variables if (pCurCenter) *pCurCenter = curCenter; if (pCurScale) *pCurScale = curScale; if (pWinCenter) *pWinCenter = winCenter; if (pIconCenter) *pIconCenter = iconCenter; if (pRotateProgress) *pRotateProgress = rotateProgress; }
Bool fxDreamModelStep(CompScreen *s, CompWindow *w, float time) { if (!defaultAnimStep(s, w, time)) return FALSE; ANIM_SCREEN(s); ANIM_WINDOW(w); Model *model = aw->model; float forwardProgress; if ((aw->curWindowEvent == WindowEventMinimize || aw->curWindowEvent == WindowEventUnminimize) && animGetB(as, aw, ANIM_SCREEN_OPTION_DREAM_Z2TOM)) { float dummy; fxZoomAnimProgress(as, aw, &forwardProgress, &dummy, TRUE); } else forwardProgress = defaultAnimProgress(aw); int i; for (i = 0; i < model->numObjects; i++) fxDreamModelStepObject(w, model, &model->objects[i], forwardProgress); return TRUE; }
static void applyGlideTransform(CompWindow *w, CompTransform *transform) { ANIM_SCREEN(w->screen); ANIM_WINDOW(w); float finalDistFac; float finalRotAng; float thickness; fxGlideGetParams(as, aw, &finalDistFac, &finalRotAng, &thickness); float forwardProgress; if (fxGlideZoomToTaskBar(as, aw)) { float dummy; fxZoomAnimProgress(as, aw, &forwardProgress, &dummy, TRUE); } else forwardProgress = fxGlideAnimProgress(aw); float finalz = finalDistFac * 0.8 * DEFAULT_Z_CAMERA * w->screen->width; Vector3d rotAxis = {1, 0, 0}; Point3d rotAxisOffset = {WIN_X(w) + WIN_W(w) / 2.0f, WIN_Y(w) + WIN_H(w) / 2.0f, 0}; Point3d translation = {0, 0, finalz * forwardProgress}; float rotAngle = finalRotAng * forwardProgress; aw->glideModRotAngle = fmodf(rotAngle + 720, 360.0f); // put back to window position matrixTranslate (transform, rotAxisOffset.x, rotAxisOffset.y, 0); resetAndPerspectiveDistortOnZ (transform, -1.0 / w->screen->width); // animation movement matrixTranslate (transform, translation.x, translation.y, translation.z); // animation rotation matrixRotate (transform, rotAngle, rotAxis.x, rotAxis.y, rotAxis.z); // intentional scaling of z by 0 to prevent weird opacity results and // flashing that happen when z coords are between 0 and 1 (bug in ecomp?) matrixScale (transform, 1.0f, 1.0f, 0.0f); // place window rotation axis at origin matrixTranslate (transform, -rotAxisOffset.x, -rotAxisOffset.y, 0); }
void fxZoomUpdateWindowAttrib (CompWindow * w, WindowPaintAttrib * wAttrib) { ANIM_WINDOW(w); float forwardProgress; float dummy; fxZoomAnimProgress (w, &dummy, &forwardProgress, FALSE); wAttrib->opacity = (GLushort) (aw->com.storedOpacity * (1 - forwardProgress)); }
Bool fxCurvedFoldModelStep(CompScreen *s, CompWindow *w, float time) { if (!defaultAnimStep(s, w, time)) return FALSE; ANIM_SCREEN(s); ANIM_WINDOW(w); Model *model = aw->model; float forwardProgress; if ((aw->curWindowEvent == WindowEventMinimize || aw->curWindowEvent == WindowEventUnminimize) && animGetB(as, aw, ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM)) { float dummy; fxZoomAnimProgress(as, aw, &forwardProgress, &dummy, TRUE); } else forwardProgress = defaultAnimProgress(aw); float curveMaxAmp = animGetF(as, aw, ANIM_SCREEN_OPTION_CURVED_FOLD_AMP) * WIN_W(w) * pow(WIN_H(w) / (s->height * 1.2f), 0.7); int i; for (i = 0; i < model->numObjects; i++) fxCurvedFoldModelStepObject (w, model, &model->objects[i], forwardProgress, curveMaxAmp); return TRUE; }