Skip to content

Commit

Permalink
3 new examples, documentation re-generated
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Groß committed Oct 8, 2012
1 parent 74a8b67 commit 3dfaa77
Show file tree
Hide file tree
Showing 45 changed files with 376 additions and 130 deletions.
Binary file modified Ani_Cheat_Sheet.pdf
Binary file not shown.
16 changes: 3 additions & 13 deletions _to_dos.txt
@@ -1,3 +1,6 @@


------------------------
------------------------
AniCore
getSpeed();
Expand All @@ -11,17 +14,4 @@ relative
AniText

-------------------------
Util
heading()

-------------------------
demos

-------------------------
webseite
*datum umbauen
*hintergrund animation

-------------------------
custom easing
custom easing editor
86 changes: 86 additions & 0 deletions examples/Ani_Sequence_Loop/Ani_Sequence_Loop.pde
@@ -0,0 +1,86 @@
/**
* shows how to loop a whole sequence
*
* KEYS
* space : toggle, pause and resume sequence
* s : start or restart sequence
*/

import de.looksgood.ani.*;

float x, y, diameter;
AniSequence seq;

void setup() {
size(512,512);
smooth();
noStroke();
textAlign(CENTER);
background(255);

x = 50;
y = 50;
diameter = 10;

// Ani.init() must be called always first!
Ani.init(this);

// create a sequence
// dont forget to call beginSequence() and endSequence()
seq = new AniSequence(this);
seq.beginSequence();

// step 0
seq.add(Ani.to(this, 1, "diameter", 55));

// step 1
seq.add(Ani.to(this, 2, "x:400,y:100"));

// step 2
seq.add(Ani.to(this, 1, "x:450,y:400"));

// step 3
seq.add(Ani.to(this, 1, "x:100,y:450"));

// step 4
seq.beginStep();
seq.add(Ani.to(this, 1, "x:50,y:50"));
seq.add(Ani.to(this, 2, "diameter", 5, Ani.EXPO_OUT, "onEnd:sequenceEnd"));
seq.endStep();

seq.endSequence();

// start the whole sequence
seq.start();
}

void draw() {
fill(255,5);
rect(0,0,width,height);

//println(seq.isFinished());

fill(0);
ellipse(x,y,diameter,diameter);
}

void sequenceEnd() {
//println("sequenceEnd() restart all again");
seq.start();
}

// pause and resume animation by pressing SPACE
// or press "s" to start the sequence
void keyPressed() {
if (key == 's' || key == 'S') seq.start();
if (key == ' ') {
if (seq.isPlaying()) seq.pause();
else seq.resume();
}
}






72 changes: 72 additions & 0 deletions examples/Ani_Workaround_Android/Ani_Workaround_Android.pde
@@ -0,0 +1,72 @@
/**
* This example is a workaround to get Ani running on android.
* Basically the example mimics the registerPre() mechanism (to hook into
* the draw loop from a library). Unfortunatelly registerPre() is not
* available at processing for android. This sketch is a hack to get around
* this issue: More infos here:
*
* http://wiki.processing.org/w/Android#API_Changed.2C_Gone.2C_or_Forgotten
* https://forum.processing.org/topic/android-api-changes-registering-methods-make-library-also-working-on-android
* https://github.com/b-g/Ani/issues/1#issuecomment-4799082
*/

import de.looksgood.ani.*;

float x = 256;
float y = 256;

ArrayList<Ani> anis; // workaround
ArrayList anisToUnregister; // workaround

void setup() {
size(512, 512);
smooth();
noStroke();

Ani.init(this);

anis = new ArrayList<Ani>(); // workaround
anisToUnregister = new ArrayList(); // workaround
}

void draw() {
background(255);
fill(0);
ellipse(x, y, 120, 120);

updateAnis(); // workaround
}

void mouseReleased() {
Ani.to(this, 1.5, "x", mouseX);
Ani.to(this, 1.5, "y", mouseY);
}

// workaround -------------------------------------------
void updateAnis(){
if (anis.size() == 0) return;

for (int i=0; i < anis.size(); i++) {
Ani aniTmp = (Ani)anis.get(i);
aniTmp.pre();
}

if(anisToUnregister.size() > 0) {
for (int i=0; i < anisToUnregister.size(); i++) {
anis.remove(i);
anisToUnregister.remove(i);
println("removed");
}
}
println(anis.size());
}

void registerPre(Object obj) {
anis.add( (Ani)obj );
}

void unregisterPre(Object obj) {
int index = anis.indexOf( (Ani)obj );
anisToUnregister.add(index);
}
// workaround -------------------------------------------
62 changes: 62 additions & 0 deletions examples/Ani_in_Classes_Bang/Ani_in_Classes_Bang.pde
@@ -0,0 +1,62 @@
/**
* shows how to use Ani in your own classes and
* how to trigger/bang an animation (via keyboard).
*
* KEYS
* space : bang the circle
*/

import de.looksgood.ani.*;

Cirlce cirlce;

void setup() {
size(512, 512);
smooth();
noStroke();
textAlign(CENTER);

// Ani.init() must be called always first!
Ani.init(this);
cirlce = new Cirlce();
}

void draw() {
background(255);
cirlce.draw();
}

void keyReleased() {
if (key == ' ') cirlce.bang();
}

class Cirlce {
float x = random(0, width);
float y = random(0, height);
color c = color(0);

Ani diameterAni;
float diameterStart = 200;
float diameterEnd = 5;
float diameter = diameterStart;
float duration = 0.9;

Cirlce() {
// diameter animation
diameterAni = new Ani(this, duration, "diameter", diameterEnd);
diameterAni.pause();
diameter = diameterEnd;
}

void bang() {
diameter = diameterStart;
diameterAni.seek(0);
diameterAni.resume();
}

void draw() {
fill(c);
ellipse(x, y, diameter, diameter);
}
}

4 changes: 2 additions & 2 deletions library.properties
Expand Up @@ -36,7 +36,7 @@ paragraph =
# is used to compare different versions of the same library, and
# check if an update is available. You should think of it as a
# counter, counting the total number of releases you've had.
version = 2 # This must be parsable as an int
version = 4 # This must be parsable as an int

# The version as the user will see it. If blank, the version attribute will be used here
prettyVersion = 2.0 # This is treated as a String
prettyVersion = 2.2 # This is treated as a String
4 changes: 2 additions & 2 deletions reference/allclasses-frame.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Tue Sep 27 15:44:29 BST 2011 -->
<!-- Generated by javadoc (build 1.6.0_31) on Thu Apr 19 16:48:52 BST 2012 -->
<TITLE>
All Classes (Javadocs: Ani)
</TITLE>

<META NAME="date" CONTENT="2011-09-27">
<META NAME="date" CONTENT="2012-04-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions reference/allclasses-noframe.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Tue Sep 27 15:44:29 BST 2011 -->
<!-- Generated by javadoc (build 1.6.0_31) on Thu Apr 19 16:48:52 BST 2012 -->
<TITLE>
All Classes (Javadocs: Ani)
</TITLE>

<META NAME="date" CONTENT="2011-09-27">
<META NAME="date" CONTENT="2012-04-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
8 changes: 4 additions & 4 deletions reference/constant-values.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Tue Sep 27 15:44:29 BST 2011 -->
<!-- Generated by javadoc (build 1.6.0_31) on Thu Apr 19 16:48:52 BST 2012 -->
<TITLE>
Constant Field Values (Javadocs: Ani)
</TITLE>

<META NAME="date" CONTENT="2011-09-27">
<META NAME="date" CONTENT="2012-04-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -189,7 +189,7 @@ <H1>
<A NAME="de.looksgood.ani.AniConstants.VERSION"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
<CODE>public&nbsp;static&nbsp;final&nbsp;java.lang.String</CODE></FONT></TD>
<TD ALIGN="left"><CODE><A HREF="de/looksgood/ani/AniConstants.html#VERSION">VERSION</A></CODE></TD>
<TD ALIGN="right"><CODE>"2.0"</CODE></TD>
<TD ALIGN="right"><CODE>"2.2"</CODE></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<A NAME="de.looksgood.ani.AniConstants.YOYO"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
Expand Down Expand Up @@ -257,6 +257,6 @@ <H1>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library Ani by Benedikt Gross. (c) 2011
processing library Ani by Benedikt Gross. (c) 2012
</BODY>
</HTML>
6 changes: 3 additions & 3 deletions reference/de/looksgood/ani/Ani.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Tue Sep 27 15:44:28 BST 2011 -->
<!-- Generated by javadoc (build 1.6.0_31) on Thu Apr 19 16:48:51 BST 2012 -->
<TITLE>
Ani (Javadocs: Ani)
</TITLE>

<META NAME="date" CONTENT="2011-09-27">
<META NAME="date" CONTENT="2012-04-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -1444,6 +1444,6 @@ <H2>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library Ani by Benedikt Gross. (c) 2011
processing library Ani by Benedikt Gross. (c) 2012
</BODY>
</HTML>
18 changes: 9 additions & 9 deletions reference/de/looksgood/ani/AniConstants.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Tue Sep 27 15:44:28 BST 2011 -->
<!-- Generated by javadoc (build 1.6.0_31) on Thu Apr 19 16:48:51 BST 2012 -->
<TITLE>
AniConstants (Javadocs: Ani)
</TITLE>

<META NAME="date" CONTENT="2011-09-27">
<META NAME="date" CONTENT="2012-04-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -714,20 +714,20 @@ <H2>
</DL>
<HR>

<A NAME="CUBIC_IN_OUT"><!-- --></A><H3>
CUBIC_IN_OUT</H3>
<A NAME="CUBIC_OUT"><!-- --></A><H3>
CUBIC_OUT</H3>
<PRE>
static final <A HREF="../../../de/looksgood/ani/easing/Easing.html" title="class in de.looksgood.ani.easing">Easing</A> <B>CUBIC_IN_OUT</B></PRE>
static final <A HREF="../../../de/looksgood/ani/easing/Easing.html" title="class in de.looksgood.ani.easing">Easing</A> <B>CUBIC_OUT</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>

<A NAME="CUBIC_OUT"><!-- --></A><H3>
CUBIC_OUT</H3>
<A NAME="CUBIC_IN_OUT"><!-- --></A><H3>
CUBIC_IN_OUT</H3>
<PRE>
static final <A HREF="../../../de/looksgood/ani/easing/Easing.html" title="class in de.looksgood.ani.easing">Easing</A> <B>CUBIC_OUT</B></PRE>
static final <A HREF="../../../de/looksgood/ani/easing/Easing.html" title="class in de.looksgood.ani.easing">Easing</A> <B>CUBIC_IN_OUT</B></PRE>
<DL>
<DL>
</DL>
Expand Down Expand Up @@ -1032,6 +1032,6 @@ <H2>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library Ani by Benedikt Gross. (c) 2011
processing library Ani by Benedikt Gross. (c) 2012
</BODY>
</HTML>

0 comments on commit 3dfaa77

Please sign in to comment.