Project

General

Profile

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

magiccube / src / main / java / org / distorted / effect / UnscrambleEffectSpin.java @ ff065f8f

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;
21

    
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

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

    
31
public class UnscrambleEffectSpin extends UnscrambleEffect
32
  {
33
  public void createEffectsPhase0(int duration)
34
    {
35
    mCubeEffectPosition[0] = new int[] {3};
36
    mCubeEffects[0]        = new Effect[mCubeEffectPosition[0].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.add(new Static1D( 0*36));
44
    /*
45
    d0.add(new Static1D( 1*36));
46
    d0.add(new Static1D( 3*36));
47
    d0.add(new Static1D( 6*36));
48
    */
49
    d0.add(new Static1D(10*36));
50
    mCubeEffects[0][0] = new MatrixEffectRotate(d0,axis,center);
51
    }
52

    
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54

    
55
  public void createEffectsPhase1(int duration)
56
    {
57
    mCubeEffectPosition[1] = new int[] {3};
58
    mCubeEffects[1]        = new Effect[mCubeEffectPosition[1].length];
59

    
60
    Static3D axis  = new Static3D(1,0,0);
61
    Static3D center= new Static3D(0,0,0);
62

    
63
    Dynamic1D d1 = new Dynamic1D(duration/2, 1.0f);
64
    d1.setMode(Dynamic.MODE_JUMP);
65
    d1.add(new Static1D( 0*36));
66
    /*
67
    d1.add(new Static1D( 4*36));
68
    d1.add(new Static1D( 7*36));
69
    d1.add(new Static1D( 9*36));
70
    */
71
    d1.add(new Static1D(10*36));
72
    mCubeEffects[1][0] = new MatrixEffectRotate(d1,axis,center);
73
    }
74

    
75
///////////////////////////////////////////////////////////////////////////////////////////////////
76
// Enable all effects used in this Effect. Called by reflection from the parent class.
77

    
78
  @SuppressWarnings("unused")
79
  static void enable()
80
    {
81

    
82
    }
83
  }
(9-9/9)