This project is read-only.
A transition is a function from a progress value (R1), random seed (R1) and next texture to a pixel effect that implements the transition. Transitions encapsulate pixel-level slide transitions that you might see in presentation programs such as PowerPoint. Example encoding of a crumple transition:

public static readonly Transition Crumple = new Transition((Progress, RandomSeed, NextInput) =>
 new PixelEffect(Input => {
   DoubleBl p = Progress * 2d;
   p = (p > 1.0).Condition(1.0 - (p - 1.0), p);
   ColorBl t1 = CloudPoint(Input, 10, RandomSeed, p);
   ColorBl t2 = CloudPoint(NextInput, 10, RandomSeed, p);
   return Progress.Lerp(t1, t2);
}));


CloudPoint is a method that distorts based on a cloud texture, implemented in three one line methods:

public static Texture CloudPointT(DoubleBl Div, DoubleBl RandomSeed) {
 return Driver.CloudImage.Distort((uv => (uv / Div).MapY(y => (y + 0.9.Bl().Min(RandomSeed)).Frac)));
}
public static PointBl CloudPoint(PointBl uv, DoubleBl div, DoubleBl RandomSeed) {
 return CloudPointT(div, RandomSeed)[uv].XY() * 2.0 - 1.0.Bl();
}
public static Texture CloudPoint(this Texture Input, DoubleBl Div, DoubleBl RandomSeed, PointBl Progress) {
 return Input.Distort(uv =>  (uv + CloudPoint(uv, Div, RandomSeed) * Progress).Frac);
}

Result of an intermediate crumple:

crumple.PNG

As with pixel effects, transitions can be composed, where Max and Min and Lerp are the most useful composition functions.

Last edited Jul 20, 2009 at 4:18 PM by mcdirmid, version 2

Comments

No comments yet.