Plasma
pendulumcurve.cpp
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2010 Bruno Abinader <bruno.abinader@indt.org.br> 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #include "pendulumcurve_p.h" 00019 00025 static qreal pendulumFunction(qreal progress) 00026 { 00027 if (progress <= 0.25) { 00028 progress *= 4; 00029 } else if (progress <= 0.50) { 00030 progress -= 0.25; 00031 progress *= 4; 00032 progress = 1 - progress; 00033 } else if (progress <= 0.75) { 00034 progress -= 0.50; 00035 progress *= -4; 00036 } else { 00037 progress -= 0.75; 00038 progress *= 4; 00039 progress = 1 - progress; 00040 progress *= -1; 00041 } 00042 return progress; 00043 } 00044 00045 namespace Plasma 00046 { 00047 00048 PendulumCurve::PendulumCurve() 00049 : QEasingCurve() 00050 { 00051 setCustomType(pendulumFunction); 00052 } 00053 00054 } // namespace Plasma
KDE 4.6 API Reference