Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

`VisibleAfter`

, `VisibleBefore`

, `VisibleFromTo`

Object visible at time value

**MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.**

**MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.**

`VisibleAfter` , `VisibleBefore` , `VisibleFromTo` | Library wrapper for “`TimeEnd` , `TimeBegin` , `VisibleAfterEnd` ,
and `VisibleBeforeBegin` ” | Non-negative real number |

`VisibleAfter = t`

renders
an object invisible until the real time _{0}`t`

has
elapsed in an animation. Then the object becomes visible._{0}

`VisibleBefore = t`

renders
an object visible until the time _{1}`t`

.
Then the object becomes invisible._{1}

`VisibleFrom = t_0 .. t_1`

renders an object
invisible until the time `t`

.
Then the object becomes visible. After the time _{0}`t`

it
becomes invisible again._{1}

`VisibleAfter`

, `VisibleBefore`

, `VisibleFromTo`

allow
to implement animated visibility of objects. This also includes otherwise
static objects, which become animated objects when one of these attributes
is used.

The attributes `VisibleBeforeBegin`

and `VisibleAfterEnd`

control
the visibility of objects outside the time range of their animation
set by `TimeBegin`

and `TimeEnd`

.
See `TimeBegin`

, `TimeEnd`

for
details.

`VisibleAfter`

, `VisibleBefore`

, `VisibleFromTo`

provide
short cuts for suitable settings of the attributes `TimeBegin`

, `VisibleBeforeBegin`

, `TimeEnd`

, `VisibleAfterEnd`

that
produce the desired visibility effects.

`VisibleAfter`

= `t`

is
a short cut for setting the following attribute values:_{0}

`TimeBegin`

= `t`

, _{0}`VisibleBeforeBegin`

= `FALSE`

,

`TimeEnd`

= `t`

, _{0}`VisibleAfterEnd`

= `TRUE`

.

The resulting effect is that the corresponding object is invisible
at the beginning of the animation. It becomes visible at the time `t`

,
staying visible until the end of the animation._{0}

The time `t`

has to
be a real numerical value giving the real time in seconds._{0}

`VisibleBefore`

= `t`

is
a short cut for setting the following attribute values:_{1}

`TimeBegin`

= `t`

, _{1}`VisibleBeforeBegin`

= `TRUE`

,

`TimeEnd`

= `t`

, _{1}`VisibleAfterEnd`

= `FALSE`

.

The resulting effect is that the corresponding object is visible
at the beginning of the animation. At the time `t`

it
becomes invisible, staying invisible until the end of the animation._{1}

The time `t`

has to
be a real numerical value giving the real time in seconds._{1}

`VisibleFromTo`

= `t_0 .. t_1`

is
a short cut for setting the following attribute values:

`TimeBegin`

= `t`

, _{0}`VisibleBeforeBegin`

= `FALSE`

,

`TimeEnd`

= `t`

, _{1}`VisibleAfterEnd`

= `FALSE`

.

The resulting effect is that the corresponding object is visible
only from the time `t`

until
the time _{0}`t`

._{1}

The attributes `VisibleAfter = t`

and _{0}```
VisibleBefore
= t
```

should not be combined to create
visibility for the time range between _{1}`t`

and _{0}`t`

.
(Conflicting values are set implicitly for _{1}`VisibleBeforeBegin`

etc.)
Use `VisibleFromTo = t_0 .. t_1`

instead.

`VisibleAfter`

, `VisibleBefore`

, `VisibleFromTo`

should
not be combined with any of the the attributes `TimeBegin`

, `TimeEnd`

, `VisibleBeforeBegin`

or `VisibleAfterEnd`

,
since implicit values for these attributes are set.

The following animation consists of 100 pieces of the graph
of the function *x* *sin*(*x*).
At the times *t* = 0.1, 0.2 etc.,
an additional piece of the function becomes visible until, finally,
the whole graph is built up:

plot(plot::Function2d(x*sin(x), x = (i - 1)*PI/100 .. i*PI/100, VisibleAfter = i/10) $ i = 1..100)

This example creates an animated “spider net”.
It consists of several lines which appear one after the other at the
times given by `VisibleAfter`

until the full net
is visible at the end of the animation:

SpiderNet := proc(move, move1, rc, gc, bc) local r, lines, x, y, x1, y1; begin r := 1.0: lines := [FAIL $ 361]: for i from 0 to 360 do thet := float(i*PI/180); x := r * cos(move * thet); y := r * sin(move * thet); x1 := r * cos(move1 * thet); y1 := r * sin(move1 * thet); lines[i+1] := plot::Line2d([x, y] ,[x1, y1], Color = [abs(rc*sin(i*PI/360)), abs(gc*sin(i*PI/360 + PI/4)), abs(bc*sin(i*PI/360 + PI/2))], VisibleAfter = i/36 ); end_for: plot::Group2d(op(lines), Name = "SpiderNet", Axes = None, Scaling = Constrained) end_proc:

plot(SpiderNet(3, 7, 0.9, 0.1, 0.5))

delete SpiderNet:

This example creates an animated “Maurer rose”.
Here the animation starts with the full object. During the animation
the lines disappear at the times given by `VisibleBefore`

:

MaurerRose := proc(n, b, rc, gc, bc) local lines, i, thet, r, x, y, x1, y1; begin r := 1.0; lines := [FAIL $ 361]: b := float(b*PI/180); for i from 0 to 360 do thet := float(i*PI/180); x := r * sin(n*thet) * cos(thet); y := r * sin(n*thet) * sin(thet); x1 := r * sin(n*(thet+b))* cos(thet+b); y1 := r * sin(n*(thet+b))* sin(thet+b); lines[i+1] := plot::Line2d([x, y], [x1, y1], Color = [abs(rc*sin(i*PI/360)), abs(gc*sin(i*PI/360 + PI/4)), abs(bc*sin(i*PI/360 + PI/2))], VisibleBefore = i/36 ); end_for: plot::Group2d(op(lines), Name = "MaurerRose", Axes = None, Scaling = Constrained): end_proc:

plot(MaurerRose(4, 120, 0.1, 0.5, 0.9)):

delete MaurerRose:

This example creates an animated “Lissajous net”.
It is built up from lines that have a life span of only 2 seconds
each, set by `VisibleFromTo`

:

LissajousNet := proc(r, a, b, R, A, B, rc, gc, bc) local lines, i, thet; begin lines := [FAIL $ 361]: for i from 0 to 360 do thet := float(i*PI/180); x := r * cos(a*thet); y := r * sin(b*thet); x1 := R * cos(A*thet); y1 := R * sin(B*thet); lines[i+1] := plot::Line2d([x, y], [x1, y1], Color = [abs(rc*sin(i*PI/360)), abs(gc*sin(i*PI/360 + PI/4)), abs(bc*sin(i*PI/360 + PI/2))], VisibleFromTo = i/36 .. i/36 + 2 ); end_for: plot::Group2d(op(lines), Name = "LissajousNet", Axes = None, Scaling = Constrained): end_proc:

plot(LissajousNet(2, 3, 4, 1, 6, 3, 0.7, 0.1, 0.99))

delete LissajousNet:

Here is a 3D example of an animation. A “spider net” is built up with lines that have a life span of 4 seconds each:

SpiderNet3d := proc(a, b, c, rc, gc, bc) local r, lines, i, x, x1, y, y1, thet, z1, z; begin r := 1.0: lines := [FAIL $ 361]: for i from 0 to 360 do thet := float(i*PI/180); x := r * cos(thet)*cos(thet); y := r * sin(thet)*cos(thet); z := r * sin(thet): x1 := r * cos(a*thet)*cos(a*thet); y1 := r * sin(b*thet)*cos(b*thet); z1 := r * sin(c*thet): lines[i+1] := plot::Line3d([x,y,z],[x1,y1,z1], Color = [abs(rc*sin(i*PI/360)), abs(gc*sin(i*PI/360 + PI/4)), abs(bc*sin(i*PI/360 + PI/2))], VisibleFromTo = i/36 .. i/36 + 4 ); end_for: plot::Group3d(op(lines), Name = "SpiderNet3d"): end_proc:

plot(SpiderNet3d(2, 1, 3, 0.99, 0.9, 0.1))

The last examples on this page are taken from the mathPAD Online
Edition (`http://www.mupad.com/mathpad/recreations.html`

)
written by Prof. Mirek Majewski. See there for details about the mathematics
behind the examples above.

Was this topic helpful?