Skip to content

Special Effects

Matt DeFano edited this page Mar 9, 2019 · 4 revisions

Visual Effects | Sound Effects | Music | Speech

WyldCard supports a nearly identical set special effects as HyperCard, including the ability to animate card changes and transitions, play music and synthesize speech.

Visual Effects

WyldCard provides a selection of visual effects that can be applied to card-to-card transitions or when "revealing" changes made by a script.

A script can "lock" the screen to prevent the user from seeing what the script is doing. As long as the screen is locked, the user will see no changes made to the card or stack until WyldCard is idle (has no more pending scripts to execute) or the script invokes the unlock screen command.

For example, consider this script which secretly navigates to the next card in the stack, draws a diagonal line on it, and then navigates back. While this script executes, the user has no knowledge that "behind the scenes" we've moved to another card and modified it:

on mouseUp
  lock screen
  go to the next card
  choose brush tool
  drag from 50,50 to 200,200
  go prev card
  unlock screen  -- note that screen will unlock automatically on idle
end mouseUp

When navigating between cards or unlocking the screen, a visual effect can be applied to animate the change. WyldCard supports these animations:

Visual Effect Name Description
dissolve dissolve Cross-dissolve from one card image to the next.
checkerboard checkerboard Destination card image appears in a 8x8 matrix.
venetian blinds venetian blinds Destination appears in "louvered" horizontal stripes.
scroll left scroll left Scroll from right to left.
scroll right scroll right Scroll from left to right.
scroll up scroll up Scroll from bottom to top.
scroll down scroll down Scroll from top to bottom.
wipe left wipe left Slides the resulting image over the source from right to left.
wipe right wipe right Slides the resulting image over the source from left to right.
wipe up wipe up Slides the resulting image over the source from bottom to top.
wipe down wipe down Slides the resulting image over the source from top to bottom.
zoom open zoom open The resulting card image expands over the source in a rectangle aperture.
zoom close zoom close The resulting card collapses over the source in a rectangle aperture.
iris open iris open The resulting card image expands over the source in a circular aperture.
iris close iris close The resulting card image collapses over the source in a circular aperture.
barn door open barn door open The source image is split horizontally and each side slides out left/right to expose the resulting image.
barn door close barn door close The resulting image slides in the from the left/right obscuring the source image.
shrink to bottom shrink to bottom The source image shrinks downward exposing the destination.
shrink to top shrink to top The source image shrinks upward exposing the destination.
shrink to center shrink to center The source image shrinks from the center of the screen exposing the destination.
stretch from bottom stretch from bottom The destination image grows from the bottom obscuring the source underneath it.
stretch from top stretch from top The destination image grows from the top obscuring the source underneath it.
stretch from center stretch from center The destination image grows from the center of the screen obscuring the source underneath it.

The syntax for specifying a visual effect is:

visual [effect] <effect-name> [to <image>] [speed]

Where <effect-name> is the name of a visual effect (from the table above); <image> is one of card, gray, black, white or inverse (of the destination card) and speed is one of fast, slow, slowly, very fast or very slow.

A visual effect can be applied when unlocking the screen or when navigating between cards. For example:

unlock screen with visual effect dissolve
go next with visual barn door open slowly
go to card 3 with visual effect iris open to black very fast

Sound Effects

WyldCard has three built-in sounds (harpsichord, flute and boing) that can be played either as a simple sound effect or as a sequence of musical notes with the play command. Touch-Tone phone sounds can be produced with the dial command, and the system alert sound can be emitted with beep.

play harpsichord
play boing
play flute
dial "1-800-588-2300"
beep

Music

To produce music, use the syntax play <sound> [tempo <speed>] <musical-expression> where:

  • <sound> is one of boing, harpsichord or flute.
  • <speed> is the rate at which notes are played, measured in quarter notes per minute. When not specified, a tempo of 120 is assumed.
  • <musical-expression> is an expression in which each word is interpreted as a musical note.

Each musical note is written in the format <name>[<octave>][<accidental>][<duration>], where:

  • <name> is a single character representing the pitch; one of c, d, e, f, g, a, b or r (for a rest note).
  • <octave> is a single-digit integer representing the note's octave; higher numbers are higher pitched. One of 0, 1, 2, 3, 4, 5, 6, 7, or 8.
  • <accidental> is a half-note increase or decrease in pitch; of one b (flat, decreased pitch) or # (sharp, increased pitch).
  • <duration> is a single-character representation of the length of the note, plus an optional . to represented a dotted-note (played for one and a half times its un-dotted duration). Duration is one of w (whole note), h (half note), q (quarter note), e (eighth note), s (sixteenth note), t (thirty-second note), x (sixty-fourth note).

When not explicitly specified, each note "inherits" its duration and octave from the previous note played. The first note in the musical sequence is assumed to be a 4th-octave quarter note (if not explicitly noted). For example, in the musical sequence "g ce5 d", the first note (g) is played as a quarter note in the 4th octave, but the third note (d) is played as an eighth note in the 5th octave.

For example, to play "Mary Had a Little Lamb" on the harpsichord,

play harpsichord "be a g a b b b r a a a r b d5 d r b4 a g a b b b b a a b a g"

Use the sound function to determine the currently playing sound (returns done when no sound is playing). This may be used to cause a script to wait until a sequence of notes has finished playing:

play flute "c d e f g"
wait until the sound is done
put "Finally some peace and quiet!"

Speech

WyldCard can speak text using one of several pre-installed, English-speaking voices. The syntax for speaking text is speak <text> [ with { <gender> voice } | { voice <name>} ] where:

  • <text> is an expression representing the text to be spoken.
  • <gender> is one of male, female, robotic or neuter. If a voice of the requested gender is unavailable, then the default voice will be used.
  • <name> is the name of an installed voice (an item in the voices). If the requested voice is not available, then the default voice will be used.

For example, this script will have each voice introduce itself to you:

repeat with v = 1 to the number of items in the voices
  put item v of the voices into theVoice
  speak "Hi, my name is " & theVoice with voice theVoice
end repeat

Speaking occurs asynchronously to other script actions (that is, the rest of the script continues to execute while the text is being spoken). Subsequent calls to speak will be enqueued and begin "speaking" when the current speech is complete. Use the speech function to determine what (if any) text is currently being spoken; the speech returns the text currently being spoken or done when nothing is being spoken.

WyldCard utilizes the MaryTTS library for text-to-speech capabilities and does not delegate to the operating system. Therefore, voices installed on your system are not available to WyldCard. WyldCard provides a function called the voices that returns a list of available speaking voices (note that this function does not exist in HyperCard).

Clone this wiki locally