POV-Ray : Newsgroups : povray.text.scene-files : Simple Text Fading From Left To Right Server Time
31 Oct 2024 16:14:21 EDT (-0400)
  Simple Text Fading From Left To Right (Message 1 to 1 of 1)  
From: Dave Blandston
Subject: Simple Text Fading From Left To Right
Date: 24 Jan 2007 19:45:01
Message: <web.45b7fce016b154818bf1dde90@news.povray.org>
global_settings {assumed_gamma 2.2}

#include "colors.inc"

camera {
   location <0, 0, -8>
   direction <0, 0,  1.3>
   look_at <0, 0, 0>
} //camera

light_source {<0, 0, -1000> color White * 1.5}

#if (clock <= .5)
   #local NewClock = clock * 2;
#else
   #local NewClock = (clock - .5) * 2;
#end //#if

#local LeftReductionFactor = 1;   //Reduce intensity by this much during
first pass.
#local RightReductionFactor = .2; //0 means no reduction, 1 means total
reduction.
                                  //Switch values to fade from right to
left, or
                                  //use "gradient y" to fade from top to
bottom or
                                  //bottom to top. This method can be
adapted to use
                                  //"radial" to fade in a circular pattern.
Also,
                                  //use the clock value to adjust brightness
of any
                                  //texture, not just plain white.

#local TitleColor = texture {
   pigment {
      gradient x
      color_map {
         #if (clock <= .5)
            [0 color White * (1 - NewClock * LeftReductionFactor)] //Left
            [1 color White * (1 - NewClock * RightReductionFactor)] //Right
         #else
            [0 color White * ((1 - LeftReductionFactor) - NewClock * (1 -
LeftReductionFactor))] //Left
            [1 color White * ((1 - RightReductionFactor) - NewClock * (1 -
RightReductionFactor))] //Right
         #end //#if
      } //color_map
   } //pigment
} //texture

//#local TitleColor = texture {pigment {color White * clock}} //Plain fade

#local TitleText = text {ttf "c:windowsfontsTimes.ttf" "Hi There, Everyone!"
..0001, 0}

#local TitleSize = max_extent (TitleText) - min_extent (TitleText);
#local TitleWidth = TitleSize.x;
#local TitleTextScaleFactor = 7 / TitleWidth;
#local TitleWidth = TitleWidth * TitleTextScaleFactor;
#local TitleText = object {TitleText scale <TitleTextScaleFactor,
TitleTextScaleFactor, 1>}

#local Title = object {
   TitleText
   texture {TitleColor scale <TitleWidth, 1, 1>}
   translate <-TitleWidth / 2, 1, 0>
} //object

object {Title}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.