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 SolveEffectSpin extends SolveEffect
|
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.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
|
mCubeEffects[0][0] = new MatrixEffectRotate(d0,axis,center);
|
50
|
}
|
51
|
|
52
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
53
|
|
54
|
public void createEffectsPhase1(int duration)
|
55
|
{
|
56
|
mCubeEffectPosition[1] = new int[] {3};
|
57
|
mCubeEffects[1] = new Effect[mCubeEffectPosition[1].length];
|
58
|
|
59
|
Static3D axis = new Static3D(1,0,0);
|
60
|
Static3D center= new Static3D(0,0,0);
|
61
|
|
62
|
Dynamic1D d1 = new Dynamic1D(duration/2, 1.0f);
|
63
|
d1.setMode(Dynamic.MODE_JUMP);
|
64
|
d1.setConvexity(0.0f);
|
65
|
d1.add(new Static1D( 0*36));
|
66
|
d1.add(new Static1D( 4*36));
|
67
|
d1.add(new Static1D( 7*36));
|
68
|
d1.add(new Static1D( 9*36));
|
69
|
d1.add(new Static1D(10*36));
|
70
|
mCubeEffects[1][0] = new MatrixEffectRotate(d1,axis,center);
|
71
|
}
|
72
|
|
73
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
74
|
// Enable all effects used in this Effect. Called by reflection from the parent class.
|
75
|
|
76
|
@SuppressWarnings("unused")
|
77
|
static void enable()
|
78
|
{
|
79
|
|
80
|
}
|
81
|
}
|