5 Star 13 Fork 1

zhaoyipeng / FMXComponents

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
FMXBezierAnimation.md 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
zhaoyipeng 提交于 2018-03-21 14:33 . update bezier animation classes

TFMXBezierAnimation

FMXBezierAnimation

TFMXBezierAnimation component inherit from TFloatAnimation, you can just drop a TFMXBezierAnimation component same as TFloatAnimation.

use these code to set the cubic-bezier parameters

  BezierAnimation1.Duration := duration; 
  BezierAnimation1.SetData(X1, Y1, X2, Y2);
  BezierAnimation1.Start;

This is the interface of TBezier

  TBezier = class
  public
    constructor Create(p1x, p1y, p2x, p2y: Double);
    procedure SetData(p1x, p1y, p2x, p2y: Double);
    function SampleCurveX(t: Double): Double;
    function SampleCurveY(t: Double): Double;
    function SampleCurveDerivativeX(t: Double): Double;
    function SolveCurveX(x, epsilon: Double): Double;
    function Solve(x, epsilon: Double): Double;
    class function GetLinear: TBezier;
    class function GetEase: TBezier;
    class function GetEaseIn: TBezier;
    class function GetEaseOut: TBezier;
    class function GetEaseInOut: TBezier;
  end;

there are 5 predefined bezier curves, linear, ease, ease-in, ease-out, ease-in-out, you can call corresponding class function to get the curve.

  Ani := TBezier.GetEaseInOut;
  BezierAnimation1.SetBezier(Ani);

or you can defined your curve

  Ani := TBezier.Create(p1x, p1y, p2x, p2y);
Delphi
1
https://gitee.com/zhaoyipeng/FMXComponents.git
git@gitee.com:zhaoyipeng/FMXComponents.git
zhaoyipeng
FMXComponents
FMXComponents
master

搜索帮助