Source language: Translate to:

RTF text effects and animations

Share sample pubs, scripts, etc. with other NeoBook users

Moderator: Neosoft Support

RTF text effects and animations

Postby Jim Brammer » Thu Feb 07, 2002 6:54 pm

Hello all,

in NB 3.2 it was possible to include action commands to a text file, for example to change the text color inside a text or to add NB action commands.

Something like ^P255This Text is red^p^P16711680 and this is blue^p worked fine, NeoEdit and NeoWrite are tools, which support that in a very good way.

It seems that NB 4.x does not support this feature. Here now I want to show another way, to change the color or the size of a text at runtime, either the complete text or only parts of.

The trick to do is to use RTF-format codes to modify a text and display the so modified text inside a variable, showen in a text-field.

That means, you have to change a simple text to a RTF-text, consists of a RTF-header and the modified text itself.

The header can be defined once and added every time needed.

setvar "[header]" "{\rtf0\ansi \deff0{\fonttbl{\f1 \fnil Arial;}}{\colortbl\red255\green255\blue255;\red0\green0\blue0;\red255\green0\blue0;\red0\green255\blue0;\red0\green0\blue255;\red0\green255\blue255;\red255\green0\blue255;\red255\green255\blue0;}"


setvar "[Text]" "[header]\qc\f1\cf4\fs20 TESTTEXT\par"


[Text] Is the displayed variable

\qc centers the text
\f1 takes font 1, defined in the header part (ARIAL)
\FS fontsize in points
\cf used color, defined in the header part
\par does a CR/LF

when using variables like \fs[x] or \cf[z] you can change very easy the showen text or parts of at runtime

setvar "[Text]" "[header]\qc\f1\fs20\cf1 T\cf2E\cf3S\cf4T\cf5T\cf6E\cf7X\cf8T\par"

this will show the word TESTTEXT, each character in another color

With that technique you can manipulate every kind of text at runtime, like blink, fade in, fade out, animations, color cycling and lots of more.

A little demonstration can be downloaded at www.gerhard-kropf.de/neobook/rtf-demo.zip


Regards

Gerhard
Jim Brammer
 

Return to Sample NeoBook Pubs

Who is online

Users browsing this forum: No registered users and 1 guest