Skip to Main Content Skip to Search
Product Documentation

VisibleAfterobject visible after this time value

VisibleBeforeobject visible until this time value

VisibleFromToobject visible during this time range

VisibleAfter = t_0 renders an object invisible until the real time t0 has elapsed in an animation. Then the object becomes visible.

VisibleBefore = t_1 renders an object visible until the time t1. Then the object becomes invisible.

VisibleFrom = t_0..t_1 renders an object invisible until the time t0. Then the object becomes visible. After the time t1 it becomes invisible again.

→ Examples

Attribute

Type

Value

See Also:

Frames, ParameterBegin, ParameterEnd, ParameterName, ParameterRange, TimeBegin, TimeEnd, TimeRange, VisibleAfterEnd, VisibleBeforeBegin

See Also:

See section SectionAnimations in this document. In particular, see subsection Frame by Frame Animations for details on VisibleAfter, VisibleBefore, VisibleFromTo.

Details:

 

Example 1

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)

MuPAD graphicsimage

Example 2

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))

MuPAD graphicsimage

delete SpiderNet:

Example 3

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)):

MuPAD graphicsimage

delete MaurerRose:

Example 4

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))

MuPAD graphicsimage

delete LissajousNet:

Example 5

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))

MuPAD graphicsimage

Background:

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.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS