25 |
25 |
|
26 |
26 |
import org.distorted.library.message.EffectListener;
|
27 |
27 |
import org.distorted.library.type.Data1D;
|
|
28 |
import org.distorted.library.type.Data2D;
|
28 |
29 |
import org.distorted.library.type.Data3D;
|
29 |
30 |
import org.distorted.library.type.Data4D;
|
30 |
31 |
import org.distorted.library.type.Dynamic;
|
... | ... | |
762 |
763 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
763 |
764 |
// Vertex-based effects
|
764 |
765 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
765 |
|
// DISTORT
|
766 |
766 |
/**
|
767 |
767 |
* Distort a (possibly changing in time) part of the Object by a (possibly changing in time) vector of force.
|
768 |
|
*
|
769 |
|
* @param vector 2- or 3-dimensional Dynamic that returns a 2- or 3-dimensional Point which
|
770 |
|
* represents the vector the Center of the Effect is currently being dragged with.
|
771 |
|
* @param region Region that masks the effect of the Distortion.
|
772 |
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
773 |
|
* the Center of the Effect.
|
774 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
775 |
|
*/
|
776 |
|
public long distort(Dynamic vector, Static4D region, Dynamic2D center)
|
777 |
|
{
|
778 |
|
return mV.add(EffectNames.DISTORT, vector, region, center);
|
779 |
|
}
|
780 |
|
|
781 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
782 |
|
/**
|
783 |
|
* Distort part of the Object by a (possibly changing in time) vector of force.
|
784 |
768 |
* <p>
|
785 |
|
* Difference between this and the previous method is that here the center of the Effect stays constant.
|
786 |
|
*
|
787 |
|
* @param vector 2- or 3-dimensional Dynamic that returns a 2- or 3-dimensional Point which
|
788 |
|
* represents the vector the Center of the Effect is currently being dragged with.
|
789 |
|
* @param region Region that masks the effect of the Distortion.
|
790 |
|
* @param center Center of the Effect.
|
791 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
|
769 |
* Only at most one of the 'center' and 'region' can be a Dynamic!
|
|
770 |
*
|
|
771 |
* @param vector 3-dimensional Vector which represents the force the Center of the Effect is
|
|
772 |
* currently being dragged with.
|
|
773 |
* @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
|
|
774 |
* @param region Region that masks the Effect.
|
|
775 |
* @return ID of the effect added, or -1 if we failed to add one.
|
792 |
776 |
*/
|
793 |
|
public long distort(Dynamic vector, Static4D region, Static2D center)
|
|
777 |
public long distort(Data3D vector, Data2D center, Data4D region)
|
794 |
778 |
{
|
795 |
|
return mV.add(EffectNames.DISTORT, vector, region, center);
|
|
779 |
return mV.add(EffectNames.DISTORT, vector, center, region);
|
796 |
780 |
}
|
797 |
781 |
|
798 |
782 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
799 |
783 |
/**
|
800 |
784 |
* Distort the whole Object by a (possibly changing in time) vector of force.
|
801 |
|
*
|
802 |
|
* @param vector 2- or 3-dimensional Dynamic that returns a 2- or 3-dimensional Point which
|
803 |
|
* represents the vector the Center of the Effect is currently being dragged with.
|
804 |
|
* @param center Center of the Effect.
|
|
785 |
*
|
|
786 |
* @param vector 3-dimensional Vector which represents the force the Center of the Effect is
|
|
787 |
* currently being dragged with.
|
|
788 |
* @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
|
805 |
789 |
* @return ID of the effect added, or -1 if we failed to add one.
|
806 |
790 |
*/
|
807 |
|
public long distort(Dynamic vector, Static2D center)
|
808 |
|
{
|
809 |
|
return mV.add(EffectNames.DISTORT, vector, null, center);
|
810 |
|
}
|
811 |
|
|
812 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
813 |
|
/**
|
814 |
|
* Distort part of the Object by a vector of force that changes from (0,0,0) to v.
|
815 |
|
*
|
816 |
|
* @param vector Maximum vector of force.
|
817 |
|
* @param region Region that masks the effect of the Distortion.
|
818 |
|
* @param center Center of the Effect.
|
819 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
820 |
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
821 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
822 |
|
*/
|
823 |
|
public long distort(Static3D vector, Static4D region, Static2D center, int duration, float count)
|
824 |
|
{
|
825 |
|
Dynamic3D di = new Dynamic3D();
|
826 |
|
di.setCount(count);
|
827 |
|
di.setDuration(duration);
|
828 |
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
829 |
|
di.add(vector);
|
830 |
|
|
831 |
|
return mV.add(EffectNames.DISTORT, di, region, center);
|
832 |
|
}
|
833 |
|
|
834 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
835 |
|
/**
|
836 |
|
* Distort the whole Object by a vector of force that changes from (0,0,0) to v.
|
837 |
|
*
|
838 |
|
* @param vector Maximum vector of force.
|
839 |
|
* @param center Center of the Effect.
|
840 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
841 |
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
842 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
843 |
|
*/
|
844 |
|
public long distort(Static3D vector, Static2D center, int duration, float count)
|
845 |
|
{
|
846 |
|
Dynamic3D di = new Dynamic3D();
|
847 |
|
di.setCount(count);
|
848 |
|
di.setDuration(duration);
|
849 |
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
850 |
|
di.add(vector);
|
851 |
|
|
852 |
|
return mV.add(EffectNames.DISTORT, di, null, center);
|
853 |
|
}
|
854 |
|
|
855 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
856 |
|
/**
|
857 |
|
* Distort the whole Object by a vector of force that changes from (0,0,0) to v.
|
858 |
|
* <p>
|
859 |
|
* Difference between this and the previous method is that here the vector of force will get interpolated
|
860 |
|
* to the maximum v and the effect will end. We are thus limited to count=0.5.
|
861 |
|
*
|
862 |
|
* @param vector Maximum, final vector of force.
|
863 |
|
* @param center Center of the Effect.
|
864 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
865 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
866 |
|
*/
|
867 |
|
public long distort(Static3D vector, Static2D center, int duration)
|
868 |
|
{
|
869 |
|
Dynamic3D di = new Dynamic3D();
|
870 |
|
di.setCount(0.5f);
|
871 |
|
di.setDuration(duration);
|
872 |
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
873 |
|
di.add(vector);
|
874 |
|
|
875 |
|
return mV.add(EffectNames.DISTORT, di, null, center);
|
876 |
|
}
|
877 |
|
|
878 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
879 |
|
/**
|
880 |
|
* Distort the whole Object by a vector of force v.
|
881 |
|
* <p>
|
882 |
|
* Here we apply a constant vector of force.
|
883 |
|
*
|
884 |
|
* @param vector Vector of force.
|
885 |
|
* @param center Center of the Effect.
|
886 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
887 |
|
*/
|
888 |
|
public long distort(Static3D vector, Static2D center )
|
889 |
|
{
|
890 |
|
Dynamic3D di = new Dynamic3D();
|
891 |
|
di.setCount(0.5f);
|
892 |
|
di.setDuration(0);
|
893 |
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
894 |
|
di.add(vector);
|
895 |
|
|
896 |
|
return mV.add(EffectNames.DISTORT, di, null, center);
|
897 |
|
}
|
|
791 |
public long distort(Data3D vector, Data2D center)
|
|
792 |
{
|
|
793 |
return mV.add(EffectNames.DISTORT, vector, center);
|
|
794 |
}
|
898 |
795 |
|
899 |
796 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
900 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
901 |
|
// DEFORM
|
902 |
797 |
/**
|
903 |
798 |
* Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
|
904 |
799 |
* a (possibly changing in time) point on the Object.
|
905 |
800 |
*
|
906 |
|
* @param vector Dynamic that, at any given time, returns a Static2D representing vector of
|
907 |
|
* force that deforms the shape of the whole Object.
|
908 |
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
909 |
|
* the Center of the Effect.
|
|
801 |
* @param vector Vector of force that deforms the shape of the whole Object.
|
|
802 |
* @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
|
910 |
803 |
* @return ID of the effect added, or -1 if we failed to add one.
|
911 |
804 |
*/
|
912 |
|
public long deform(Dynamic vector, Dynamic2D center)
|
|
805 |
public long deform(Data3D vector, Data2D center)
|
913 |
806 |
{
|
914 |
|
return mV.add(EffectNames.DEFORM, vector, null, center);
|
|
807 |
return mV.add(EffectNames.DEFORM, vector, center);
|
915 |
808 |
}
|
916 |
809 |
|
917 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
918 |
|
/**
|
919 |
|
* Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
|
920 |
|
* a constant point on the Object.
|
921 |
|
*
|
922 |
|
* @param vector Dynamic that, at any given time, returns a Static2D representing
|
923 |
|
* vector of force that deforms the shape of the whole Object.
|
924 |
|
* @param center Center of the Effect.
|
925 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
926 |
|
*/
|
927 |
|
public long deform(Dynamic vector, Static2D center)
|
928 |
|
{
|
929 |
|
return mV.add(EffectNames.DEFORM, vector, null, center);
|
930 |
|
}
|
931 |
|
|
932 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
933 |
|
/**
|
934 |
|
* Deform the shape of the whole Object with a vector of force smoothly changing from (0,0,0) to v
|
935 |
|
* applied to a constant point on the Object.
|
936 |
|
*
|
937 |
|
* @param vector Vector of force.
|
938 |
|
* @param center Center of the Effect.
|
939 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
940 |
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
941 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
942 |
|
*/
|
943 |
|
public long deform(Static3D vector, Static2D center, int duration, float count)
|
944 |
|
{
|
945 |
|
Dynamic3D di = new Dynamic3D();
|
946 |
|
di.setCount(count);
|
947 |
|
di.setDuration(duration);
|
948 |
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
949 |
|
di.add(vector);
|
950 |
|
|
951 |
|
return mV.add(EffectNames.DEFORM, di, null, center);
|
952 |
|
}
|
953 |
|
|
954 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
955 |
|
/**
|
956 |
|
* Deform the shape of the whole Object with a vector of force smoothly changing from (0,0,0) to v
|
957 |
|
* applied to a constant point on the Object.
|
958 |
|
* <p>
|
959 |
|
* Identical to calling the previous method with count=0.5.
|
960 |
|
*
|
961 |
|
* @param vector Final vector of force.
|
962 |
|
* @param center Center of the Effect.
|
963 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
964 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
965 |
|
*/
|
966 |
|
public long deform(Static3D vector, Static2D center, int duration)
|
967 |
|
{
|
968 |
|
Dynamic3D di = new Dynamic3D();
|
969 |
|
di.setCount(0.5f);
|
970 |
|
di.setDuration(duration);
|
971 |
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
972 |
|
di.add(vector);
|
973 |
|
|
974 |
|
return mV.add(EffectNames.DEFORM, di, null, center);
|
975 |
|
}
|
976 |
|
|
977 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
978 |
|
/**
|
979 |
|
* Deform the shape of the whole Object with a constant vector of force applied to a constant
|
980 |
|
* point on the Object.
|
981 |
|
*
|
982 |
|
* @param vector Vector of force.
|
983 |
|
* @param center Center of the Effect.
|
984 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
985 |
|
*/
|
986 |
|
public long deform(Static3D vector, Static2D center )
|
987 |
|
{
|
988 |
|
Dynamic3D di = new Dynamic3D();
|
989 |
|
di.setCount(0.5f);
|
990 |
|
di.setDuration(0);
|
991 |
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
992 |
|
di.add(vector);
|
993 |
|
|
994 |
|
return mV.add(EffectNames.DEFORM, di, null, center);
|
995 |
|
}
|
996 |
|
|
997 |
810 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
998 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
999 |
|
// SINK
|
1000 |
811 |
/**
|
1001 |
|
* Pull all points around the center of the effect towards the center (if degree>=1) or push them
|
|
812 |
* Pull all points around the center of the Effect towards the center (if degree>=1) or push them
|
1002 |
813 |
* away from the center (degree<=1)
|
1003 |
|
*
|
1004 |
|
* @param sink 1-dimensional Dynamic which, at any given time, returns a Point1D representing
|
1005 |
|
* the current degree of the effect.
|
1006 |
|
* @param region Region that masks the effect of the Sink.
|
1007 |
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
1008 |
|
* the Center of the Effect.
|
1009 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1010 |
|
*/
|
1011 |
|
public long sink(Dynamic1D sink, Static4D region, Dynamic2D center)
|
1012 |
|
{
|
1013 |
|
return mV.add(EffectNames.SINK, sink, region, center);
|
1014 |
|
}
|
1015 |
|
|
1016 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1017 |
|
/**
|
1018 |
|
* Pull all points around the center of the effect towards the center (if degree>=1) or push them
|
1019 |
|
* away from the center (degree<=1).
|
1020 |
|
* <p>
|
1021 |
|
* Here the Center stays constant.
|
1022 |
|
*
|
1023 |
|
* @param sink 1-dimensional Dynamic which, at any given time, returns a Point1D
|
1024 |
|
* representing the current degree of the effect.
|
1025 |
|
* @param region Region that masks the effect of the Sink.
|
1026 |
|
* @param center Center of the Effect.
|
1027 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1028 |
|
*/
|
1029 |
|
public long sink(Dynamic1D sink, Static4D region, Static2D center)
|
1030 |
|
{
|
1031 |
|
return mV.add(EffectNames.SINK, sink, region, center);
|
1032 |
|
}
|
1033 |
|
|
1034 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1035 |
|
/**
|
1036 |
|
* Pull all points around the center of the effect towards the center (if degree>=1) or push them
|
1037 |
|
* away from the center (degree<=1).
|
1038 |
814 |
* <p>
|
1039 |
|
* Here we can only interpolate between 1 and degree.
|
1040 |
|
*
|
1041 |
|
* @param sink How much to push or pull. Between 0 and infinity.
|
1042 |
|
* @param region Region that masks the effect of the Sink.
|
1043 |
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
1044 |
|
* the Center of the Effect.
|
1045 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1046 |
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1047 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1048 |
|
*/
|
1049 |
|
public long sink(float sink, Static4D region, Dynamic2D center, int duration, float count)
|
1050 |
|
{
|
1051 |
|
Dynamic1D di = new Dynamic1D();
|
1052 |
|
di.setCount(count);
|
1053 |
|
di.setDuration(duration);
|
1054 |
|
di.add(new Static1D(1));
|
1055 |
|
di.add(new Static1D(sink));
|
1056 |
|
|
1057 |
|
return mV.add(EffectNames.SINK, di, region, center);
|
1058 |
|
}
|
1059 |
|
|
1060 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1061 |
|
/**
|
1062 |
|
* Pull all points around the center of the effect towards the center (if degree>=1) or push them
|
1063 |
|
* away from the center (degree<=1).
|
1064 |
|
*
|
1065 |
|
* @param sink How much to push or pull. Between 0 and infinity.
|
1066 |
|
* @param region Region that masks the effect of the Sink.
|
1067 |
|
* @param center Center of the Effect.
|
1068 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1069 |
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1070 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1071 |
|
*/
|
1072 |
|
public long sink(float sink, Static4D region, Static2D center, int duration, float count)
|
1073 |
|
{
|
1074 |
|
Dynamic1D di = new Dynamic1D();
|
1075 |
|
di.setCount(count);
|
1076 |
|
di.setDuration(duration);
|
1077 |
|
di.add(new Static1D(1));
|
1078 |
|
di.add(new Static1D(sink));
|
1079 |
|
|
1080 |
|
return mV.add(EffectNames.SINK, di, region, center);
|
1081 |
|
}
|
1082 |
|
|
1083 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1084 |
|
/**
|
1085 |
|
* Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
|
1086 |
|
* away from the center (degree<=1).
|
1087 |
|
*
|
1088 |
|
* @param sink How much to push or pull. Between 0 and infinity.
|
1089 |
|
* @param center Center of the Effect.
|
1090 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1091 |
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1092 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
|
815 |
* Only at most one of the 'center' and 'region' can be a Dynamic!
|
|
816 |
*
|
|
817 |
* @param sink The current degree of the Effect.
|
|
818 |
* @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
|
|
819 |
* @param region Region that masks the Effect.
|
|
820 |
* @return ID of the effect added, or -1 if we failed to add one.
|
1093 |
821 |
*/
|
1094 |
|
public long sink(float sink, Static2D center, int duration, float count)
|
|
822 |
public long sink(Data1D sink, Data2D center, Data4D region)
|
1095 |
823 |
{
|
1096 |
|
Dynamic1D di = new Dynamic1D();
|
1097 |
|
di.setCount(count);
|
1098 |
|
di.setDuration(duration);
|
1099 |
|
di.add(new Static1D(1));
|
1100 |
|
di.add(new Static1D(sink));
|
1101 |
|
|
1102 |
|
return mV.add(EffectNames.SINK, di, null, center);
|
|
824 |
return mV.add(EffectNames.SINK, sink, center, region);
|
1103 |
825 |
}
|
1104 |
826 |
|
1105 |
827 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1106 |
828 |
/**
|
1107 |
|
* Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
|
1108 |
|
* away from the center (degree<=1).
|
1109 |
|
* <p>
|
1110 |
|
* Equivalent to calling the previous method with count=0.5.
|
1111 |
|
*
|
1112 |
|
* @param sink How much to push or pull. Between 0 and infinity.
|
1113 |
|
* @param center Center of the Effect.
|
1114 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1115 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
|
829 |
* Pull all points around the center of the Effect towards the center (if degree>=1) or push them
|
|
830 |
* away from the center (degree<=1)
|
|
831 |
*
|
|
832 |
* @param sink The current degree of the Effect.
|
|
833 |
* @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
|
|
834 |
* @return ID of the effect added, or -1 if we failed to add one.
|
1116 |
835 |
*/
|
1117 |
|
public long sink(float sink, Static2D center, int duration)
|
1118 |
|
{
|
1119 |
|
Dynamic1D di = new Dynamic1D();
|
1120 |
|
di.setCount(0.5f);
|
1121 |
|
di.setDuration(duration);
|
1122 |
|
di.add(new Static1D(1));
|
1123 |
|
di.add(new Static1D(sink));
|
1124 |
|
|
1125 |
|
return mV.add(EffectNames.SINK, di, null, center);
|
1126 |
|
}
|
|
836 |
public long sink(Data1D sink, Data2D center)
|
|
837 |
{
|
|
838 |
return mV.add(EffectNames.SINK, sink, center);
|
|
839 |
}
|
1127 |
840 |
|
1128 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1129 |
|
/**
|
1130 |
|
* Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
|
1131 |
|
* away from the center (degree<=1).
|
1132 |
|
* <p>
|
1133 |
|
* Equivalent of calling the previous method with duration=0; i.e. we pull immediately.
|
1134 |
|
*
|
1135 |
|
* @param sink How much to push or pull. Between 0 and infinity.
|
1136 |
|
* @param center Center of the Effect.
|
1137 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1138 |
|
*/
|
1139 |
|
public long sink(float sink, Static2D center)
|
1140 |
|
{
|
1141 |
|
Dynamic1D di = new Dynamic1D();
|
1142 |
|
di.setCount(0.5f);
|
1143 |
|
di.setDuration(0);
|
1144 |
|
di.add(new Static1D(1));
|
1145 |
|
di.add(new Static1D(sink));
|
1146 |
|
|
1147 |
|
return mV.add(EffectNames.SINK, di, null, center);
|
1148 |
|
}
|
1149 |
|
|
1150 |
841 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1151 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1152 |
|
// SWIRL
|
1153 |
|
/**
|
1154 |
|
* Rotate part of the Object around the Center of the Effect by a certain angle (as returned by the
|
1155 |
|
* Dynamic).
|
1156 |
|
*
|
1157 |
|
* @param swirl 1-dimensional Dynamic which, at any given time, returns a Point1D representing
|
1158 |
|
* the degree of Swirl.
|
1159 |
|
* @param region Region that masks the effect of the Swirl.
|
1160 |
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
1161 |
|
* the Center of the Effect.
|
1162 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1163 |
|
*/
|
1164 |
|
public long swirl(Dynamic1D swirl, Static4D region, Dynamic2D center)
|
1165 |
|
{
|
1166 |
|
return mV.add(EffectNames.SWIRL, swirl, region, center);
|
1167 |
|
}
|
1168 |
|
|
1169 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1170 |
842 |
/**
|
1171 |
|
* Rotate part of the Object around the Center of the Effect by a certain angle (as returned by the
|
1172 |
|
* Dynamic).
|
|
843 |
* Rotate part of the Object around the Center of the Effect by a certain angle.
|
1173 |
844 |
* <p>
|
1174 |
|
* Here the Center stays constant.
|
1175 |
|
*
|
1176 |
|
* @param swirl 1-dimensional Dynamic which, at any given time, returns a Point1D representing
|
1177 |
|
* the degree of Swirl.
|
1178 |
|
* @param region Region that masks the effect of the Swirl.
|
1179 |
|
* @param center Center of the Effect.
|
1180 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
|
845 |
* Only at most one of the 'center' and 'region' can be a Dynamic!
|
|
846 |
*
|
|
847 |
* @param swirl The degree of Swirl. Positive values swirl clockwise.
|
|
848 |
* @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
|
|
849 |
* @param region Region that masks the Effect.
|
|
850 |
* @return ID of the effect added, or -1 if we failed to add one.
|
1181 |
851 |
*/
|
1182 |
|
public long swirl(Dynamic1D swirl, Static4D region, Static2D center)
|
|
852 |
public long swirl(Data1D swirl, Data2D center, Data4D region)
|
1183 |
853 |
{
|
1184 |
|
return mV.add(EffectNames.SWIRL, swirl, region, center);
|
1185 |
|
}
|
1186 |
|
|
1187 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1188 |
|
/**
|
1189 |
|
* Rotate part of the Object around the Center of the Effect by 'degree' angle.
|
1190 |
|
*
|
1191 |
|
* @param swirl Angle of rotation. Unit: degrees.
|
1192 |
|
* @param region Region that masks the effect of the Swirl.
|
1193 |
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
1194 |
|
* the Center of the Effect.
|
1195 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1196 |
|
*/
|
1197 |
|
public long swirl(int swirl, Static4D region, Dynamic2D center)
|
1198 |
|
{
|
1199 |
|
Dynamic1D di = new Dynamic1D();
|
1200 |
|
di.setCount(0.5f);
|
1201 |
|
di.setDuration(0);
|
1202 |
|
di.add(new Static1D(0));
|
1203 |
|
di.add(new Static1D(swirl));
|
1204 |
|
|
1205 |
|
return mV.add(EffectNames.SWIRL, di, region, center);
|
|
854 |
return mV.add(EffectNames.SWIRL, swirl, center, region);
|
1206 |
855 |
}
|
1207 |
856 |
|
1208 |
857 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1209 |
858 |
/**
|
1210 |
|
* Rotate part of the Object around the Center of the Effect by 'degree' angle.
|
1211 |
|
* <p>
|
1212 |
|
* Here the Center stays constant.
|
1213 |
|
*
|
1214 |
|
* @param swirl Angle of rotation. Unit: degrees.
|
1215 |
|
* @param region Region that masks the effect of the Swirl.
|
1216 |
|
* @param center Center of the Effect.
|
1217 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1218 |
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1219 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1220 |
|
*/
|
1221 |
|
public long swirl(int swirl, Static4D region, Static2D center, int duration, float count)
|
1222 |
|
{
|
1223 |
|
Dynamic1D di = new Dynamic1D();
|
1224 |
|
di.setCount(count);
|
1225 |
|
di.setDuration(duration);
|
1226 |
|
di.add(new Static1D(0));
|
1227 |
|
di.add(new Static1D(swirl));
|
1228 |
|
|
1229 |
|
return mV.add(EffectNames.SWIRL, di, region, center);
|
1230 |
|
}
|
1231 |
|
|
1232 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1233 |
|
/**
|
1234 |
|
* Rotate the whole Object around the Center of the Effect by 'degree' angle.
|
1235 |
|
*
|
1236 |
|
* @param swirl Angle of rotation. Unit: degrees.
|
1237 |
|
* @param center Center of the Effect.
|
1238 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1239 |
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1240 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1241 |
|
*/
|
1242 |
|
public long swirl(int swirl, Static2D center, int duration, float count)
|
1243 |
|
{
|
1244 |
|
Dynamic1D di = new Dynamic1D();
|
1245 |
|
di.setCount(count);
|
1246 |
|
di.setDuration(duration);
|
1247 |
|
di.add(new Static1D(0));
|
1248 |
|
di.add(new Static1D(swirl));
|
1249 |
|
|
1250 |
|
return mV.add(EffectNames.SWIRL, di, null, center);
|
1251 |
|
}
|
1252 |
|
|
1253 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1254 |
|
/**
|
1255 |
|
* Rotate the whole Object around the Center of the Effect by 'degree' angle.
|
1256 |
|
* <p>
|
1257 |
|
* Equivalent to calling the previous method with count=0.5.
|
1258 |
|
*
|
1259 |
|
* @param swirl Angle of rotation. Unit: degrees.
|
1260 |
|
* @param center Center of the Effect.
|
1261 |
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1262 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1263 |
|
*/
|
1264 |
|
public long swirl(int swirl, Static2D center, int duration)
|
1265 |
|
{
|
1266 |
|
Dynamic1D di = new Dynamic1D();
|
1267 |
|
di.setCount(0.5f);
|
1268 |
|
di.setDuration(duration);
|
1269 |
|
di.add(new Static1D(0));
|
1270 |
|
di.add(new Static1D(swirl));
|
1271 |
|
|
1272 |
|
return mV.add(EffectNames.SWIRL, di, null, center);
|
1273 |
|
}
|
1274 |
|
|
1275 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1276 |
|
/**
|
1277 |
|
* Rotate the whole Object around the Center of the Effect by 'degree' angle.
|
1278 |
|
* <p>
|
1279 |
|
* Equivalent to calling the previous method with duration=0.
|
1280 |
|
*
|
1281 |
|
* @param swirl Angle of rotation. Unit: degrees.
|
1282 |
|
* @param center Center of the Effect.
|
1283 |
|
* @return ID of the effect added, or -1 if we failed to add one.
|
|
859 |
* Rotate the whole Object around the Center of the Effect by a certain angle.
|
|
860 |
*
|
|
861 |
* @param swirl The degree of Swirl. Positive values swirl clockwise.
|
|
862 |
* @param center 2-dimensional Data that, at any given time, returns the Center of the Effect.
|
|
863 |
* @return ID of the effect added, or -1 if we failed to add one.
|
1284 |
864 |
*/
|
1285 |
|
public long swirl(int swirl, Static2D center)
|
1286 |
|
{
|
1287 |
|
Dynamic1D di = new Dynamic1D();
|
1288 |
|
di.setCount(0.5f);
|
1289 |
|
di.setDuration(0);
|
1290 |
|
di.add(new Static1D(0));
|
1291 |
|
di.add(new Static1D(swirl));
|
1292 |
|
|
1293 |
|
return mV.add(EffectNames.SWIRL, di, null, center);
|
1294 |
|
}
|
1295 |
|
|
1296 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1297 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1298 |
|
// WAVE
|
1299 |
|
|
|
865 |
public long swirl(Data1D swirl, Data2D center)
|
|
866 |
{
|
|
867 |
return mV.add(EffectNames.SWIRL, swirl, center);
|
|
868 |
}
|
1300 |
869 |
}
|
Major push towards simplifying DistortedObject's public API.
Beginning of work on VERTEX Effects - does not compile ATM!