banner



How To Change The Speed Of Racket Animate

8Animation Helpers

These functions are designed to piece of work with the slide constructors in slideshow/play.

8.1Pict Interpolations

Interpolates p1 and p2, where the result with northward as 0.0 is p1, and the outcome with northward as 1.0 is p2. For intermediate points, p1 fades out while p2 fades in equally n changes from 0.0 to ane.0. At the same time, the width and tiptop of the generated pict are intermediate between p1 and p2, and the relative baselines and last pict correspondingly morph within the bounding box.

The combine argument determines how p1 and p2 are aligned for morphing. For example, if p1 and p2 both contain multiple lines of text with the same line height only different number of lines, then using ctl-superimpose would keep the ascent line in a fixed location relative to the tiptop of the resulting pict as the balance of the shape morphs around it.

Examples:

image

Like to fade-pict, but the target is non a fixed p2, but instead a part make-p2 that takes a laundered ghost of p1 and places it into a larger scene. Too, p1 does not fade out as n increases; instead, p1 is placed wherever its ghost appears in the result of make-p2.

For case,

> ( get-current-code-font-size ( λ ( ) xx ) )
> ( define do-fade
( lambda ( n )
( fade-around-pict due north
( lawmaking x )
( lambda ( thousand ) ( code ( + #, g 1 ) ) ) ) ) )

image

animates the wrapping of x with a ( + .... one ) form.

Pins p onto base, sliding from p-from to p-to (which are picts within base) as n goes from 0.0 to 1.0. The top-left locations of p-from and p-to determine the placement of the top-left of p.

The p-from and p-to picts are typically laundered ghostdue south of p within base, simply they can be any picts inside base.

Examples:

image

Like slide-pict, simply aligns the center of p with p-from and p-to.

Examples:

image

8.2Merging Animations

Converts a list of gen functions into a single function that uses each gen in sequence.

Converts a list of gen functions into a unmarried office that run ( sequence-animations gen ... ) in reverse.

8.3Stretching and Squashing Fourth dimension

Monotonically but not-uniformly maps n with fixed points at 0.0 and 1.0.

Suppose that we have the following definitions for our examples:

A normal apply of the animation looks like this:

> ( run-animation ( λ ( due north ) n ) )

image

The fast-showtime mapping is convex, so that

( slide-pict base p p1 p2 ( fast-start n ) )

appears to move quickly away from p1 and then slowly every bit information technology approaches p2, assuming that northward increases uniformly.

Applying it to the animation to a higher place produces this:

> ( run-animation fast-start )

image

The fast-finish mapping is concave, so that

( slide-pict base p p1 p2 ( fast-stop n ) )

appears to movement slowly away from p1 so quickly as it approaches p2, assuming that n increases uniformly.

> ( run-animation fast-end )

image

The fast-edges mapping is convex at first and concave at the finish, so that

( slide-pict base p p1 p2 ( fast-edges northward ) )

appears to move speedily abroad from p1, and then more slowly, and then quickly again nigh p2, assuming that n increases uniformly.

> ( run-animation fast-edges )

image

The fast-centre mapping is concave at beginning and convex at the cease, and then that

( slide-pict base p p1 p2 ( fast-middle n ) )

> ( run-blitheness fast-middle )

image

appears to move slowly away from p1, so more than chop-chop, and and then slowly again about p2, assuming that n increases uniformly.

Splits the progression of n from 0.0 to 1.0 into a progression from ( values 0.0 0.0 ) to ( values 1.0 0.0 ) and then ( values 1.0 0.0 ) to ( values i.0 ane.0 ).

Here is an example that shows how to apply carve up-stage to the animation from the examples for fast-commencement:

image

Source: https://docs.racket-lang.org/pict/Animation_Helpers.html

Posted by: jacquespueed1957.blogspot.com

0 Response to "How To Change The Speed Of Racket Animate"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel