trect: Morf Rectangle

Description Usage Arguments Value Author(s) See Also Examples

View source: R/animatoR-functions-knitr.R

Description

Morf one rectangle to another

Usage

1
2
trect(xleft0, ybottom0, xright0, ytop0, xleft1, ybottom1, xright1, ytop1, t,
  p = 1, when, ...)

Arguments

xleft0

a vector (or scalar) of left x positions.

ybottom0

a vector (or scalar) of bottom y positions.

xright0

a vector (or scalar) of right x positions.

ytop0

a vector (or scalar) of top y positions.

xleft1

a vector (or scalar) of left x positions.

ybottom1

a vector (or scalar) of bottom y positions.

xright1

a vector (or scalar) of right x positions.

ytop1

a vector (or scalar) of top y positions.

t

numeric, homotopy parameter, limited between 0 and 1. This parameter can be considered as fraction of animation duration time.

p

numeric, homotopy power parameter. Defaults to 1.

when

numeric vector. This parameter controls the times of: entrance, exit, start of movement and, end of movement.

...

additional arguments passed to rect.

Value

List with numerical components x and y with current position

Author(s)

Andrej Blejec andrej.blejec@nib.si

See Also

rect and tpolygon for moving a polygon.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
xleft0   <- 1
ybottom0 <- 1
xright0  <- 5
ytop0    <- 5
xleft1   <- 3
ybottom1 <- 3
xright1  <- 6
ytop1    <- 9
newplot()
rect( xleft0, ybottom0, xright0, ytop0,lty=2,border=2)
rect( xleft1, ybottom1, xright1, ytop1,lty=2,border=4)
arrows(
c(xleft0,xright0),c(ybottom0,ytop0),
c(xleft1,xright1),c(ybottom1,ytop1),lty=2)
## Intermediate rectangle
pos <- trect(xleft0, ybottom0, xright0, ytop0,
                xleft1, ybottom1, xright1, ytop1, t= 0.75)
str(pos)
#############

ablejec/animatoR documentation built on Feb. 21, 2020, 10:09 p.m.