Project

General

Profile

Download (3.24 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / effect / win / WinEffectSpin.java @ bee1d997

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.effect.win;
21

    
22
import org.distorted.library.effect.Effect;
23
import org.distorted.library.effect.MatrixEffectRotate;
24
import org.distorted.library.type.Dynamic;
25
import org.distorted.library.type.Dynamic1D;
26
import org.distorted.library.type.Static1D;
27
import org.distorted.library.type.Static3D;
28

    
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

    
31
public class WinEffectSpin extends WinEffect
32
  {
33
  public void createEffects(int duration)
34
    {
35
    mCubeEffectPosition = new int[] {3};
36
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
37

    
38
    Static3D axis  = new Static3D(1,0,0);
39
    Static3D center= new Static3D(0,0,0);
40

    
41
    Dynamic1D d0 = new Dynamic1D(duration/2, 1.0f);
42
    d0.setMode(Dynamic.MODE_JUMP);
43
    d0.setConvexity(0.0f);          // otherwise speed of the rotation would be strangely uneven
44
    d0.add(new Static1D( 0*36));
45
    d0.add(new Static1D( 1*36));
46
    d0.add(new Static1D( 3*36));
47
    d0.add(new Static1D( 6*36));
48
    d0.add(new Static1D(10*36));
49
    d0.add(new Static1D(14*36));
50
    d0.add(new Static1D(17*36));
51
    d0.add(new Static1D(19*36));
52
    d0.add(new Static1D(20*36));
53

    
54
    mCubeEffects[0] = new MatrixEffectRotate(d0,axis,center);
55
    }
56

    
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58
// Enable all effects used in this Effect. Called by reflection from the parent class.
59

    
60
  @SuppressWarnings("unused")
61
  static void enable()
62
    {
63

    
64
    }
65
  }
(4-4/4)