Project

General

Profile

Download (3.01 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / effects / objectchange / ObjectChangeEffectRound.java @ 1eafa9c6

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9

    
10
package org.distorted.objectlib.effects.objectchange;
11

    
12
import org.distorted.library.effect.Effect;
13
import org.distorted.library.effect.MatrixEffectMove;
14
import org.distorted.library.effect.MatrixEffectScale;
15
import org.distorted.library.type.Dynamic;
16
import org.distorted.library.type.Dynamic3D;
17
import org.distorted.library.type.Static3D;
18

    
19
///////////////////////////////////////////////////////////////////////////////////////////////////
20

    
21
class ObjectChangeEffectRound extends ObjectChangeEffect
22
  {
23
  public int createEffectsPhase0(int duration)
24
    {
25
    float X = mObjectNode.getWidth()/3.0f;
26

    
27
    mCubeEffectPosition[0] = new int[] {2,3};
28
    mCubeEffects[0]        = new Effect[mCubeEffectPosition[0].length];
29

    
30
    Dynamic3D d0 = new Dynamic3D(duration/2, 0.5f);
31
    d0.add(new Static3D( 1.00f, 1.00f, 1.00f));
32
    d0.add(new Static3D( 0.01f, 0.01f, 0.01f));
33
    mCubeEffects[0][0] = new MatrixEffectScale(d0);
34

    
35
    Dynamic3D d1 = new Dynamic3D(duration/2, 0.5f);
36
    d1.setMode(Dynamic.MODE_PATH);
37
    d1.add(new Static3D( 0, 0, 0));
38
    d1.add(new Static3D(+X, 0, 0));
39
    d1.add(new Static3D( 0, 0, 0));
40
    mCubeEffects[0][1] = new MatrixEffectMove(d1);
41

    
42
    return 2;
43
    }
44

    
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46

    
47
  public int createEffectsPhase1(int duration)
48
    {
49
    float X = mObjectNode.getWidth()/3.0f;
50

    
51
    mCubeEffectPosition[1] = new int[] {2,3};
52
    mCubeEffects[1]        = new Effect[mCubeEffectPosition[1].length];
53

    
54
    Dynamic3D d0 = new Dynamic3D(duration/2, 0.5f);
55
    d0.add(new Static3D( 0.01f, 0.01f, 0.01f));
56
    d0.add(new Static3D( 1.00f, 1.00f, 1.00f));
57
    mCubeEffects[1][0] = new MatrixEffectScale(d0);
58

    
59
    Dynamic3D d1 = new Dynamic3D(duration/2, 0.5f);
60
    d1.setMode(Dynamic.MODE_PATH);
61
    d1.add(new Static3D( 0, 0, 0));
62
    d1.add(new Static3D(-X, 0, 0));
63
    d1.add(new Static3D( 0, 0, 0));
64
    mCubeEffects[1][1] = new MatrixEffectMove(d1);
65

    
66
    return 2;
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70
// Enable all effects used in this Effect. Called by reflection from the parent class.
71
// Matrix Effects do not have to be enabled.
72

    
73
  @SuppressWarnings("unused")
74
  static void enable()
75
    {
76

    
77
    }
78
  }
79

    
(4-4/6)